From 0876c5096fe5a70709e05371f69cca51856fa654 Mon Sep 17 00:00:00 2001 From: Pablo Veyrat Date: Mon, 6 Nov 2023 16:23:28 +0100 Subject: [PATCH 1/3] feat: deploy Merkl contracts on Filecoin --- deploy/0_distributor.ts | 5 +- deploy/1_distributionCreator.ts | 44 +- deployments/filecoin/.chainId | 1 + deployments/filecoin/DistributionCreator.json | 132 + .../DistributionCreator_Implementation_7.json | 4743 +++++++++++++++++ deployments/filecoin/Distributor.json | 132 + .../Distributor_Implementation_2.json | 1248 +++++ .../1d17a992f70400315a977c7229541e31.json | 132 + .../69984a2380fa2fad0c3afbbb08b5652b.json | 98 + .../e77f17fbb4334e4df730b35bdfde2517.json | 213 + hardhat.config.ts | 17 +- scripts/{message.ts => getMessage.ts} | 5 +- scripts/setDisputeAmount.ts | 21 + scripts/setDisputePeriod.ts | 21 + scripts/setDisputeToken.ts | 21 + scripts/setFeeRecipient.ts | 21 + scripts/setMessage.ts | 23 + scripts/setRewardTokenMinAmount.ts | 27 + scripts/toggleTokenWhitelist.ts | 24 + scripts/toggleTrusted.ts | 21 + 20 files changed, 6922 insertions(+), 27 deletions(-) create mode 100644 deployments/filecoin/.chainId create mode 100644 deployments/filecoin/DistributionCreator.json create mode 100644 deployments/filecoin/DistributionCreator_Implementation_7.json create mode 100644 deployments/filecoin/Distributor.json create mode 100644 deployments/filecoin/Distributor_Implementation_2.json create mode 100644 deployments/filecoin/solcInputs/1d17a992f70400315a977c7229541e31.json create mode 100644 deployments/filecoin/solcInputs/69984a2380fa2fad0c3afbbb08b5652b.json create mode 100644 deployments/filecoin/solcInputs/e77f17fbb4334e4df730b35bdfde2517.json rename scripts/{message.ts => getMessage.ts} (84%) create mode 100644 scripts/setDisputeAmount.ts create mode 100644 scripts/setDisputePeriod.ts create mode 100644 scripts/setDisputeToken.ts create mode 100644 scripts/setFeeRecipient.ts create mode 100644 scripts/setMessage.ts create mode 100644 scripts/setRewardTokenMinAmount.ts create mode 100644 scripts/toggleTokenWhitelist.ts create mode 100644 scripts/toggleTrusted.ts diff --git a/deploy/0_distributor.ts b/deploy/0_distributor.ts index 18a702d..a31f3db 100644 --- a/deploy/0_distributor.ts +++ b/deploy/0_distributor.ts @@ -10,7 +10,7 @@ const func: DeployFunction = async ({ deployments, ethers, network }) => { const { deployer } = await ethers.getNamedSigners(); let core: string; - core = '0xC16B81Af351BA9e64C1a069E3Ab18c244A1E3049'; + core = '0x3E399AE5B4D8bc0021e53b51c8BCdD66DD62c03b'; /* if (!network.live) { // If we're in mainnet fork, we're using the `CoreBorrow` address from mainnet @@ -23,7 +23,7 @@ const func: DeployFunction = async ({ deployments, ethers, network }) => { console.log('Let us get started with deployment'); console.log(deployer.address); - + /* console.log('Now deploying Distributor'); console.log('Starting with the implementation'); @@ -32,6 +32,7 @@ const func: DeployFunction = async ({ deployments, ethers, network }) => { from: deployer.address, log: !argv.ci, }); + */ const implementationAddress = (await ethers.getContract('Distributor_Implementation_2')).address; diff --git a/deploy/1_distributionCreator.ts b/deploy/1_distributionCreator.ts index 6dfec98..5b5e789 100644 --- a/deploy/1_distributionCreator.ts +++ b/deploy/1_distributionCreator.ts @@ -11,6 +11,8 @@ const func: DeployFunction = async ({ deployments, ethers, network }) => { const { deployer } = await ethers.getNamedSigners(); let core: string; + core = '0x3E399AE5B4D8bc0021e53b51c8BCdD66DD62c03b'; + /* if (!network.live) { // If we're in mainnet fork, we're using the `CoreBorrow` address from mainnet core = registry(ChainId.MAINNET)?.Merkl?.CoreMerkl!; @@ -18,9 +20,9 @@ const func: DeployFunction = async ({ deployments, ethers, network }) => { // Otherwise, we're using the proxy admin address from the desired network core = registry(network.config.chainId as ChainId)?.Merkl?.CoreMerkl!; } + */ console.log(deployer.address); - console.log('Now deploying DistributionCreator'); console.log('Starting with the implementation'); console.log('deployer ', await deployer.getBalance()); @@ -35,29 +37,29 @@ const func: DeployFunction = async ({ deployments, ethers, network }) => { console.log(`Successfully deployed the implementation for DistributionCreator at ${implementationAddress}`); console.log(''); - // const distributor = (await deployments.get('Distributor')).address; - // console.log('Now deploying the Proxy'); + const distributor = (await deployments.get('Distributor')).address; + console.log('Now deploying the Proxy'); - // await deploy('DistributionCreator', { - // contract: 'ERC1967Proxy', - // from: deployer.address, - // args: [implementationAddress, '0x'], - // log: !argv.ci, - // }); + await deploy('DistributionCreator', { + contract: 'ERC1967Proxy', + from: deployer.address, + args: [implementationAddress, '0x'], + log: !argv.ci, + }); - // const manager = (await deployments.get('DistributionCreator')).address; - // console.log(`Successfully deployed contract at the address ${manager}`); - // console.log('Initializing the contract'); - // const contract = new ethers.Contract( - // manager, - // DistributionCreator__factory.createInterface(), - // deployer, - // ) as DistributionCreator; + const manager = (await deployments.get('DistributionCreator')).address; + console.log(`Successfully deployed contract at the address ${manager}`); + console.log('Initializing the contract'); + const contract = new ethers.Contract( + manager, + DistributionCreator__factory.createInterface(), + deployer, + ) as DistributionCreator; - // await (await contract.connect(deployer).initialize(core, distributor, parseAmount.gwei('0.03'))).wait(); - // console.log('Contract successfully initialized'); - // console.log(''); - // console.log(await contract.core()); + await (await contract.connect(deployer).initialize(core, distributor, parseAmount.gwei('0.03'))).wait(); + console.log('Contract successfully initialized'); + console.log(''); + console.log(await contract.core()); /* Once good some functions need to be called to have everything setup. diff --git a/deployments/filecoin/.chainId b/deployments/filecoin/.chainId new file mode 100644 index 0000000..c0d6976 --- /dev/null +++ b/deployments/filecoin/.chainId @@ -0,0 +1 @@ +314 \ No newline at end of file diff --git a/deployments/filecoin/DistributionCreator.json b/deployments/filecoin/DistributionCreator.json new file mode 100644 index 0000000..258dc9a --- /dev/null +++ b/deployments/filecoin/DistributionCreator.json @@ -0,0 +1,132 @@ +{ + "address": "0x8BB4C975Ff3c250e0ceEA271728547f3802B36Fd", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_logic", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "stateMutability": "payable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "previousAdmin", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "AdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "beacon", + "type": "address" + } + ], + "name": "BeaconUpgraded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "stateMutability": "payable", + "type": "receive" + } + ], + "transactionHash": "0x144a53c4df2af46cb495162b6d6e5ebffaff534cf6b93b2427c986eec9eeea78", + "receipt": { + "to": null, + "from": "0x9f76a95AA7535bb0893cf88A146396e00ed21A12", + "contractAddress": "0x8BB4C975Ff3c250e0ceEA271728547f3802B36Fd", + "transactionIndex": 32, + "gasUsed": "66829526", + "logsBloom": "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", + "blockHash": "0xa673488d51a63086f93a86342b605886ffb711be941ceb34c7e80f09a3beb187", + "transactionHash": "0x144a53c4df2af46cb495162b6d6e5ebffaff534cf6b93b2427c986eec9eeea78", + "logs": [ + { + "transactionIndex": 32, + "blockNumber": 3365868, + "transactionHash": "0x144a53c4df2af46cb495162b6d6e5ebffaff534cf6b93b2427c986eec9eeea78", + "address": "0x8BB4C975Ff3c250e0ceEA271728547f3802B36Fd", + "topics": [ + "0xbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b", + "0x0000000000000000000000007db28175b63f154587bbb1cae62d39ea80a23383" + ], + "data": "0x", + "logIndex": 0, + "blockHash": "0xa673488d51a63086f93a86342b605886ffb711be941ceb34c7e80f09a3beb187" + } + ], + "blockNumber": 3365868, + "cumulativeGasUsed": "0", + "status": 1, + "byzantium": true + }, + "args": [ + "0x7Db28175B63f154587BbB1Cae62D39Ea80A23383", + "0x" + ], + "numDeployments": 1, + "solcInputHash": "e77f17fbb4334e4df730b35bdfde2517", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_logic\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"previousAdmin\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"AdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"beacon\",\"type\":\"address\"}],\"name\":\"BeaconUpgraded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"implementation\",\"type\":\"address\"}],\"name\":\"Upgraded\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"details\":\"This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an implementation address that can be changed. This address is stored in storage in the location specified by https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the implementation behind the proxy.\",\"kind\":\"dev\",\"methods\":{\"constructor\":{\"details\":\"Initializes the upgradeable proxy with an initial implementation specified by `_logic`. If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded function call, and allows initializing the storage of the proxy like a Solidity constructor.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol\":\"ERC1967Proxy\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":100000},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/interfaces/draft-IERC1822.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\\n * proxy whose upgrades are fully controlled by the current implementation.\\n */\\ninterface IERC1822Proxiable {\\n /**\\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\\n * address.\\n *\\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\\n * function revert if invoked through a proxy.\\n */\\n function proxiableUUID() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0x1d4afe6cb24200cc4545eed814ecf5847277dfe5d613a1707aad5fceecebcfff\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/ERC1967/ERC1967Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../Proxy.sol\\\";\\nimport \\\"./ERC1967Upgrade.sol\\\";\\n\\n/**\\n * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an\\n * implementation address that can be changed. This address is stored in storage in the location specified by\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the\\n * implementation behind the proxy.\\n */\\ncontract ERC1967Proxy is Proxy, ERC1967Upgrade {\\n /**\\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.\\n *\\n * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded\\n * function call, and allows initializing the storage of the proxy like a Solidity constructor.\\n */\\n constructor(address _logic, bytes memory _data) payable {\\n _upgradeToAndCall(_logic, _data, false);\\n }\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _implementation() internal view virtual override returns (address impl) {\\n return ERC1967Upgrade._getImplementation();\\n }\\n}\\n\",\"keccak256\":\"0xa2b22da3032e50b55f95ec1d13336102d675f341167aa76db571ef7f8bb7975d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/ERC1967/ERC1967Upgrade.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (proxy/ERC1967/ERC1967Upgrade.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../beacon/IBeacon.sol\\\";\\nimport \\\"../../interfaces/draft-IERC1822.sol\\\";\\nimport \\\"../../utils/Address.sol\\\";\\nimport \\\"../../utils/StorageSlot.sol\\\";\\n\\n/**\\n * @dev This abstract contract provides getters and event emitting update functions for\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\\n *\\n * _Available since v4.1._\\n *\\n * @custom:oz-upgrades-unsafe-allow delegatecall\\n */\\nabstract contract ERC1967Upgrade {\\n // This is the keccak-256 hash of \\\"eip1967.proxy.rollback\\\" subtracted by 1\\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\\n\\n /**\\n * @dev Storage slot with the address of the current implementation.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n /**\\n * @dev Emitted when the implementation is upgraded.\\n */\\n event Upgraded(address indexed implementation);\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _getImplementation() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 implementation slot.\\n */\\n function _setImplementation(address newImplementation) private {\\n require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n }\\n\\n /**\\n * @dev Perform implementation upgrade\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeTo(address newImplementation) internal {\\n _setImplementation(newImplementation);\\n emit Upgraded(newImplementation);\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCall(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _upgradeTo(newImplementation);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(newImplementation, data);\\n }\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCallUUPS(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n // Upgrades from old implementations will perform a rollback test. This test requires the new\\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\\n // this special case will break upgrade paths from old UUPS implementation to new ones.\\n if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) {\\n _setImplementation(newImplementation);\\n } else {\\n try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {\\n require(slot == _IMPLEMENTATION_SLOT, \\\"ERC1967Upgrade: unsupported proxiableUUID\\\");\\n } catch {\\n revert(\\\"ERC1967Upgrade: new implementation is not UUPS\\\");\\n }\\n _upgradeToAndCall(newImplementation, data, forceCall);\\n }\\n }\\n\\n /**\\n * @dev Storage slot with the admin of the contract.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.admin\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n /**\\n * @dev Emitted when the admin account has changed.\\n */\\n event AdminChanged(address previousAdmin, address newAdmin);\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _getAdmin() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 admin slot.\\n */\\n function _setAdmin(address newAdmin) private {\\n require(newAdmin != address(0), \\\"ERC1967: new admin is the zero address\\\");\\n StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n */\\n function _changeAdmin(address newAdmin) internal {\\n emit AdminChanged(_getAdmin(), newAdmin);\\n _setAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\\n */\\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\\n\\n /**\\n * @dev Emitted when the beacon is upgraded.\\n */\\n event BeaconUpgraded(address indexed beacon);\\n\\n /**\\n * @dev Returns the current beacon.\\n */\\n function _getBeacon() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_BEACON_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new beacon in the EIP1967 beacon slot.\\n */\\n function _setBeacon(address newBeacon) private {\\n require(Address.isContract(newBeacon), \\\"ERC1967: new beacon is not a contract\\\");\\n require(\\n Address.isContract(IBeacon(newBeacon).implementation()),\\n \\\"ERC1967: beacon implementation is not a contract\\\"\\n );\\n StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon;\\n }\\n\\n /**\\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\\n *\\n * Emits a {BeaconUpgraded} event.\\n */\\n function _upgradeBeaconToAndCall(\\n address newBeacon,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _setBeacon(newBeacon);\\n emit BeaconUpgraded(newBeacon);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xabf3f59bc0e5423eae45e459dbe92e7052c6983628d39008590edc852a62f94a\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (proxy/Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\\n * be specified by overriding the virtual {_implementation} function.\\n *\\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\\n * different contract through the {_delegate} function.\\n *\\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\\n */\\nabstract contract Proxy {\\n /**\\n * @dev Delegates the current call to `implementation`.\\n *\\n * This function does not return to its internal call site, it will return directly to the external caller.\\n */\\n function _delegate(address implementation) internal virtual {\\n assembly {\\n // Copy msg.data. We take full control of memory in this inline assembly\\n // block because it will not return to Solidity code. We overwrite the\\n // Solidity scratch pad at memory position 0.\\n calldatacopy(0, 0, calldatasize())\\n\\n // Call the implementation.\\n // out and outsize are 0 because we don't know the size yet.\\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\\n\\n // Copy the returned data.\\n returndatacopy(0, 0, returndatasize())\\n\\n switch result\\n // delegatecall returns 0 on error.\\n case 0 {\\n revert(0, returndatasize())\\n }\\n default {\\n return(0, returndatasize())\\n }\\n }\\n }\\n\\n /**\\n * @dev This is a virtual function that should be overridden so it returns the address to which the fallback function\\n * and {_fallback} should delegate.\\n */\\n function _implementation() internal view virtual returns (address);\\n\\n /**\\n * @dev Delegates the current call to the address returned by `_implementation()`.\\n *\\n * This function does not return to its internal call site, it will return directly to the external caller.\\n */\\n function _fallback() internal virtual {\\n _beforeFallback();\\n _delegate(_implementation());\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\\n * function in the contract matches the call data.\\n */\\n fallback() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data\\n * is empty.\\n */\\n receive() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`\\n * call, or as part of the Solidity `fallback` or `receive` functions.\\n *\\n * If overridden should call `super._beforeFallback()`.\\n */\\n function _beforeFallback() internal virtual {}\\n}\\n\",\"keccak256\":\"0xc130fe33f1b2132158531a87734153293f6d07bc263ff4ac90e85da9c82c0e27\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/beacon/IBeacon.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\\n */\\ninterface IBeacon {\\n /**\\n * @dev Must return an address that can be used as a delegate call target.\\n *\\n * {BeaconProxy} will check that this address is a contract.\\n */\\n function implementation() external view returns (address);\\n}\\n\",\"keccak256\":\"0xd50a3421ac379ccb1be435fa646d66a65c986b4924f0849839f08692f39dde61\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\n *\\n * _Available since v4.8._\\n */\\n function verifyCallResultFromTarget(\\n address target,\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n if (success) {\\n if (returndata.length == 0) {\\n // only check isContract if the call was successful and the return data is empty\\n // otherwise we already know that it was a contract\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n }\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason or using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xf96f969e24029d43d0df89e59d365f277021dac62b48e1c1e3ebe0acdd7f1ca1\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/StorageSlot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/StorageSlot.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for reading and writing primitive types to specific storage slots.\\n *\\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\\n * This library helps with reading and writing to such slots without the need for inline assembly.\\n *\\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\\n *\\n * Example usage to set ERC1967 implementation slot:\\n * ```\\n * contract ERC1967 {\\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n *\\n * function _getImplementation() internal view returns (address) {\\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n * }\\n *\\n * function _setImplementation(address newImplementation) internal {\\n * require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n * }\\n * }\\n * ```\\n *\\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\\n */\\nlibrary StorageSlot {\\n struct AddressSlot {\\n address value;\\n }\\n\\n struct BooleanSlot {\\n bool value;\\n }\\n\\n struct Bytes32Slot {\\n bytes32 value;\\n }\\n\\n struct Uint256Slot {\\n uint256 value;\\n }\\n\\n /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\\n */\\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\\n */\\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\\n */\\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd5c50c54bf02740ebd122ff06832546cb5fa84486d52695a9ccfd11666e0c81d\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x60806040526040516107ad3803806107ad83398101604081905261002291610319565b61002e82826000610035565b5050610436565b61003e8361006b565b60008251118061004b5750805b156100665761006483836100ab60201b6100291760201c565b505b505050565b610074816100d7565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b60606100d08383604051806060016040528060278152602001610786602791396101a9565b9392505050565b6100ea8161022260201b6100551760201c565b6101515760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b60648201526084015b60405180910390fd5b806101887f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc60001b61023160201b6100711760201c565b80546001600160a01b0319166001600160a01b039290921691909117905550565b6060600080856001600160a01b0316856040516101c691906103e7565b600060405180830381855af49150503d8060008114610201576040519150601f19603f3d011682016040523d82523d6000602084013e610206565b606091505b50909250905061021886838387610234565b9695505050505050565b6001600160a01b03163b151590565b90565b606083156102a357825160000361029c576001600160a01b0385163b61029c5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610148565b50816102ad565b6102ad83836102b5565b949350505050565b8151156102c55781518083602001fd5b8060405162461bcd60e51b81526004016101489190610403565b634e487b7160e01b600052604160045260246000fd5b60005b838110156103105781810151838201526020016102f8565b50506000910152565b6000806040838503121561032c57600080fd5b82516001600160a01b038116811461034357600080fd5b60208401519092506001600160401b038082111561036057600080fd5b818501915085601f83011261037457600080fd5b815181811115610386576103866102df565b604051601f8201601f19908116603f011681019083821181831017156103ae576103ae6102df565b816040528281528860208487010111156103c757600080fd5b6103d88360208301602088016102f5565b80955050505050509250929050565b600082516103f98184602087016102f5565b9190910192915050565b60208152600082518060208401526104228160408501602087016102f5565b601f01601f19169190910160400192915050565b610341806104456000396000f3fe60806040523661001357610011610017565b005b6100115b610027610022610074565b6100b9565b565b606061004e83836040518060600160405280602781526020016102e5602791396100dd565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b90565b60006100b47f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5473ffffffffffffffffffffffffffffffffffffffff1690565b905090565b3660008037600080366000845af43d6000803e8080156100d8573d6000f35b3d6000fd5b60606000808573ffffffffffffffffffffffffffffffffffffffff16856040516101079190610277565b600060405180830381855af49150503d8060008114610142576040519150601f19603f3d011682016040523d82523d6000602084013e610147565b606091505b509150915061015886838387610162565b9695505050505050565b606083156101fd5782516000036101f65773ffffffffffffffffffffffffffffffffffffffff85163b6101f6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064015b60405180910390fd5b5081610207565b610207838361020f565b949350505050565b81511561021f5781518083602001fd5b806040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016101ed9190610293565b60005b8381101561026e578181015183820152602001610256565b50506000910152565b60008251610289818460208701610253565b9190910192915050565b60208152600082518060208401526102b2816040850160208701610253565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a26469706673582212208d6f628b23c1e021c9b2ae38fc6a126b22b03b9629f5dfe1de8fc7f044229aec64736f6c63430008110033416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564", + "deployedBytecode": "0x60806040523661001357610011610017565b005b6100115b610027610022610074565b6100b9565b565b606061004e83836040518060600160405280602781526020016102e5602791396100dd565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b90565b60006100b47f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5473ffffffffffffffffffffffffffffffffffffffff1690565b905090565b3660008037600080366000845af43d6000803e8080156100d8573d6000f35b3d6000fd5b60606000808573ffffffffffffffffffffffffffffffffffffffff16856040516101079190610277565b600060405180830381855af49150503d8060008114610142576040519150601f19603f3d011682016040523d82523d6000602084013e610147565b606091505b509150915061015886838387610162565b9695505050505050565b606083156101fd5782516000036101f65773ffffffffffffffffffffffffffffffffffffffff85163b6101f6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064015b60405180910390fd5b5081610207565b610207838361020f565b949350505050565b81511561021f5781518083602001fd5b806040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016101ed9190610293565b60005b8381101561026e578181015183820152602001610256565b50506000910152565b60008251610289818460208701610253565b9190910192915050565b60208152600082518060208401526102b2816040850160208701610253565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a26469706673582212208d6f628b23c1e021c9b2ae38fc6a126b22b03b9629f5dfe1de8fc7f044229aec64736f6c63430008110033", + "devdoc": { + "details": "This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an implementation address that can be changed. This address is stored in storage in the location specified by https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the implementation behind the proxy.", + "kind": "dev", + "methods": { + "constructor": { + "details": "Initializes the upgradeable proxy with an initial implementation specified by `_logic`. If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded function call, and allows initializing the storage of the proxy like a Solidity constructor." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/deployments/filecoin/DistributionCreator_Implementation_7.json b/deployments/filecoin/DistributionCreator_Implementation_7.json new file mode 100644 index 0000000..3f3b8a3 --- /dev/null +++ b/deployments/filecoin/DistributionCreator_Implementation_7.json @@ -0,0 +1,4743 @@ +{ + "address": "0x7Db28175B63f154587BbB1Cae62D39Ea80A23383", + "abi": [ + { + "inputs": [], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "InvalidLengths", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidParam", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidReward", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidSignature", + "type": "error" + }, + { + "inputs": [], + "name": "NotGovernorOrGuardian", + "type": "error" + }, + { + "inputs": [], + "name": "NotSigned", + "type": "error" + }, + { + "inputs": [], + "name": "ZeroAddress", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "previousAdmin", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "AdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "beacon", + "type": "address" + } + ], + "name": "BeaconUpgraded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "_distributor", + "type": "address" + } + ], + "name": "DistributorUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "userFeeRebate", + "type": "uint256" + } + ], + "name": "FeeRebateUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "_feeRecipient", + "type": "address" + } + ], + "name": "FeeRecipientUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "_fees", + "type": "uint256" + } + ], + "name": "FeesSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "bytes32", + "name": "_messageHash", + "type": "bytes32" + } + ], + "name": "MessageUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "components": [ + { + "internalType": "bytes32", + "name": "rewardId", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "uniV3Pool", + "type": "address" + }, + { + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address[]", + "name": "positionWrappers", + "type": "address[]" + }, + { + "internalType": "uint32[]", + "name": "wrapperTypes", + "type": "uint32[]" + }, + { + "internalType": "uint32", + "name": "propToken0", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propToken1", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propFees", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "epochStart", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "numEpoch", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "isOutOfRangeIncentivized", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "boostedReward", + "type": "uint32" + }, + { + "internalType": "address", + "name": "boostingAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "additionalData", + "type": "bytes" + } + ], + "indexed": false, + "internalType": "struct DistributionParameters", + "name": "distribution", + "type": "tuple" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "NewDistribution", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "RewardTokenMinimumAmountUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "toggleStatus", + "type": "uint256" + } + ], + "name": "TokenWhitelistToggled", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "bytes32", + "name": "messageHash", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + } + ], + "name": "UserSigned", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "toggleStatus", + "type": "uint256" + } + ], + "name": "UserSigningWhitelistToggled", + "type": "event" + }, + { + "inputs": [], + "name": "BASE_9", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "EPOCH_DURATION", + "outputs": [ + { + "internalType": "uint32", + "name": "", + "type": "uint32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "core", + "outputs": [ + { + "internalType": "contract ICore", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "bytes32", + "name": "rewardId", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "uniV3Pool", + "type": "address" + }, + { + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address[]", + "name": "positionWrappers", + "type": "address[]" + }, + { + "internalType": "uint32[]", + "name": "wrapperTypes", + "type": "uint32[]" + }, + { + "internalType": "uint32", + "name": "propToken0", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propToken1", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propFees", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "epochStart", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "numEpoch", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "isOutOfRangeIncentivized", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "boostedReward", + "type": "uint32" + }, + { + "internalType": "address", + "name": "boostingAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "additionalData", + "type": "bytes" + } + ], + "internalType": "struct DistributionParameters", + "name": "distribution", + "type": "tuple" + } + ], + "name": "createDistribution", + "outputs": [ + { + "internalType": "uint256", + "name": "distributionAmount", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "bytes32", + "name": "rewardId", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "uniV3Pool", + "type": "address" + }, + { + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address[]", + "name": "positionWrappers", + "type": "address[]" + }, + { + "internalType": "uint32[]", + "name": "wrapperTypes", + "type": "uint32[]" + }, + { + "internalType": "uint32", + "name": "propToken0", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propToken1", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propFees", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "epochStart", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "numEpoch", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "isOutOfRangeIncentivized", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "boostedReward", + "type": "uint32" + }, + { + "internalType": "address", + "name": "boostingAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "additionalData", + "type": "bytes" + } + ], + "internalType": "struct DistributionParameters[]", + "name": "distributions", + "type": "tuple[]" + } + ], + "name": "createDistributions", + "outputs": [ + { + "internalType": "uint256[]", + "name": "", + "type": "uint256[]" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "distributionList", + "outputs": [ + { + "internalType": "bytes32", + "name": "rewardId", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "uniV3Pool", + "type": "address" + }, + { + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "uint32", + "name": "propToken0", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propToken1", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propFees", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "epochStart", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "numEpoch", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "isOutOfRangeIncentivized", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "boostedReward", + "type": "uint32" + }, + { + "internalType": "address", + "name": "boostingAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "additionalData", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "distributor", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "feeRebate", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "feeRecipient", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "fees", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getActiveDistributions", + "outputs": [ + { + "components": [ + { + "components": [ + { + "internalType": "bytes32", + "name": "rewardId", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "uniV3Pool", + "type": "address" + }, + { + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address[]", + "name": "positionWrappers", + "type": "address[]" + }, + { + "internalType": "uint32[]", + "name": "wrapperTypes", + "type": "uint32[]" + }, + { + "internalType": "uint32", + "name": "propToken0", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propToken1", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propFees", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "epochStart", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "numEpoch", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "isOutOfRangeIncentivized", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "boostedReward", + "type": "uint32" + }, + { + "internalType": "address", + "name": "boostingAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "additionalData", + "type": "bytes" + } + ], + "internalType": "struct DistributionParameters", + "name": "base", + "type": "tuple" + }, + { + "internalType": "uint24", + "name": "poolFee", + "type": "uint24" + }, + { + "components": [ + { + "internalType": "address", + "name": "add", + "type": "address" + }, + { + "internalType": "uint8", + "name": "decimals", + "type": "uint8" + }, + { + "internalType": "string", + "name": "symbol", + "type": "string" + }, + { + "internalType": "uint256", + "name": "poolBalance", + "type": "uint256" + } + ], + "internalType": "struct UniswapTokenData", + "name": "token0", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "address", + "name": "add", + "type": "address" + }, + { + "internalType": "uint8", + "name": "decimals", + "type": "uint8" + }, + { + "internalType": "string", + "name": "symbol", + "type": "string" + }, + { + "internalType": "uint256", + "name": "poolBalance", + "type": "uint256" + } + ], + "internalType": "struct UniswapTokenData", + "name": "token1", + "type": "tuple" + }, + { + "internalType": "string", + "name": "rewardTokenSymbol", + "type": "string" + }, + { + "internalType": "uint8", + "name": "rewardTokenDecimals", + "type": "uint8" + } + ], + "internalType": "struct ExtensiveDistributionParameters[]", + "name": "searchDistributions", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint32", + "name": "skip", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "first", + "type": "uint32" + } + ], + "name": "getActiveDistributions", + "outputs": [ + { + "components": [ + { + "components": [ + { + "internalType": "bytes32", + "name": "rewardId", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "uniV3Pool", + "type": "address" + }, + { + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address[]", + "name": "positionWrappers", + "type": "address[]" + }, + { + "internalType": "uint32[]", + "name": "wrapperTypes", + "type": "uint32[]" + }, + { + "internalType": "uint32", + "name": "propToken0", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propToken1", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propFees", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "epochStart", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "numEpoch", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "isOutOfRangeIncentivized", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "boostedReward", + "type": "uint32" + }, + { + "internalType": "address", + "name": "boostingAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "additionalData", + "type": "bytes" + } + ], + "internalType": "struct DistributionParameters", + "name": "base", + "type": "tuple" + }, + { + "internalType": "uint24", + "name": "poolFee", + "type": "uint24" + }, + { + "components": [ + { + "internalType": "address", + "name": "add", + "type": "address" + }, + { + "internalType": "uint8", + "name": "decimals", + "type": "uint8" + }, + { + "internalType": "string", + "name": "symbol", + "type": "string" + }, + { + "internalType": "uint256", + "name": "poolBalance", + "type": "uint256" + } + ], + "internalType": "struct UniswapTokenData", + "name": "token0", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "address", + "name": "add", + "type": "address" + }, + { + "internalType": "uint8", + "name": "decimals", + "type": "uint8" + }, + { + "internalType": "string", + "name": "symbol", + "type": "string" + }, + { + "internalType": "uint256", + "name": "poolBalance", + "type": "uint256" + } + ], + "internalType": "struct UniswapTokenData", + "name": "token1", + "type": "tuple" + }, + { + "internalType": "string", + "name": "rewardTokenSymbol", + "type": "string" + }, + { + "internalType": "uint8", + "name": "rewardTokenDecimals", + "type": "uint8" + } + ], + "internalType": "struct ExtensiveDistributionParameters[]", + "name": "searchDistributions", + "type": "tuple[]" + }, + { + "internalType": "uint256", + "name": "lastIndexDistribution", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "uniV3Pool", + "type": "address" + } + ], + "name": "getActivePoolDistributions", + "outputs": [ + { + "components": [ + { + "components": [ + { + "internalType": "bytes32", + "name": "rewardId", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "uniV3Pool", + "type": "address" + }, + { + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address[]", + "name": "positionWrappers", + "type": "address[]" + }, + { + "internalType": "uint32[]", + "name": "wrapperTypes", + "type": "uint32[]" + }, + { + "internalType": "uint32", + "name": "propToken0", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propToken1", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propFees", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "epochStart", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "numEpoch", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "isOutOfRangeIncentivized", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "boostedReward", + "type": "uint32" + }, + { + "internalType": "address", + "name": "boostingAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "additionalData", + "type": "bytes" + } + ], + "internalType": "struct DistributionParameters", + "name": "base", + "type": "tuple" + }, + { + "internalType": "uint24", + "name": "poolFee", + "type": "uint24" + }, + { + "components": [ + { + "internalType": "address", + "name": "add", + "type": "address" + }, + { + "internalType": "uint8", + "name": "decimals", + "type": "uint8" + }, + { + "internalType": "string", + "name": "symbol", + "type": "string" + }, + { + "internalType": "uint256", + "name": "poolBalance", + "type": "uint256" + } + ], + "internalType": "struct UniswapTokenData", + "name": "token0", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "address", + "name": "add", + "type": "address" + }, + { + "internalType": "uint8", + "name": "decimals", + "type": "uint8" + }, + { + "internalType": "string", + "name": "symbol", + "type": "string" + }, + { + "internalType": "uint256", + "name": "poolBalance", + "type": "uint256" + } + ], + "internalType": "struct UniswapTokenData", + "name": "token1", + "type": "tuple" + }, + { + "internalType": "string", + "name": "rewardTokenSymbol", + "type": "string" + }, + { + "internalType": "uint8", + "name": "rewardTokenDecimals", + "type": "uint8" + } + ], + "internalType": "struct ExtensiveDistributionParameters[]", + "name": "searchDistributions", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "uniV3Pool", + "type": "address" + }, + { + "internalType": "uint32", + "name": "skip", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "first", + "type": "uint32" + } + ], + "name": "getActivePoolDistributions", + "outputs": [ + { + "components": [ + { + "components": [ + { + "internalType": "bytes32", + "name": "rewardId", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "uniV3Pool", + "type": "address" + }, + { + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address[]", + "name": "positionWrappers", + "type": "address[]" + }, + { + "internalType": "uint32[]", + "name": "wrapperTypes", + "type": "uint32[]" + }, + { + "internalType": "uint32", + "name": "propToken0", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propToken1", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propFees", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "epochStart", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "numEpoch", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "isOutOfRangeIncentivized", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "boostedReward", + "type": "uint32" + }, + { + "internalType": "address", + "name": "boostingAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "additionalData", + "type": "bytes" + } + ], + "internalType": "struct DistributionParameters", + "name": "base", + "type": "tuple" + }, + { + "internalType": "uint24", + "name": "poolFee", + "type": "uint24" + }, + { + "components": [ + { + "internalType": "address", + "name": "add", + "type": "address" + }, + { + "internalType": "uint8", + "name": "decimals", + "type": "uint8" + }, + { + "internalType": "string", + "name": "symbol", + "type": "string" + }, + { + "internalType": "uint256", + "name": "poolBalance", + "type": "uint256" + } + ], + "internalType": "struct UniswapTokenData", + "name": "token0", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "address", + "name": "add", + "type": "address" + }, + { + "internalType": "uint8", + "name": "decimals", + "type": "uint8" + }, + { + "internalType": "string", + "name": "symbol", + "type": "string" + }, + { + "internalType": "uint256", + "name": "poolBalance", + "type": "uint256" + } + ], + "internalType": "struct UniswapTokenData", + "name": "token1", + "type": "tuple" + }, + { + "internalType": "string", + "name": "rewardTokenSymbol", + "type": "string" + }, + { + "internalType": "uint8", + "name": "rewardTokenDecimals", + "type": "uint8" + } + ], + "internalType": "struct ExtensiveDistributionParameters[]", + "name": "", + "type": "tuple[]" + }, + { + "internalType": "uint256", + "name": "lastIndexDistribution", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getAllDistributions", + "outputs": [ + { + "components": [ + { + "internalType": "bytes32", + "name": "rewardId", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "uniV3Pool", + "type": "address" + }, + { + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address[]", + "name": "positionWrappers", + "type": "address[]" + }, + { + "internalType": "uint32[]", + "name": "wrapperTypes", + "type": "uint32[]" + }, + { + "internalType": "uint32", + "name": "propToken0", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propToken1", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propFees", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "epochStart", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "numEpoch", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "isOutOfRangeIncentivized", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "boostedReward", + "type": "uint32" + }, + { + "internalType": "address", + "name": "boostingAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "additionalData", + "type": "bytes" + } + ], + "internalType": "struct DistributionParameters[]", + "name": "", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint32", + "name": "epochStart", + "type": "uint32" + } + ], + "name": "getDistributionsAfterEpoch", + "outputs": [ + { + "components": [ + { + "components": [ + { + "internalType": "bytes32", + "name": "rewardId", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "uniV3Pool", + "type": "address" + }, + { + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address[]", + "name": "positionWrappers", + "type": "address[]" + }, + { + "internalType": "uint32[]", + "name": "wrapperTypes", + "type": "uint32[]" + }, + { + "internalType": "uint32", + "name": "propToken0", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propToken1", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propFees", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "epochStart", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "numEpoch", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "isOutOfRangeIncentivized", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "boostedReward", + "type": "uint32" + }, + { + "internalType": "address", + "name": "boostingAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "additionalData", + "type": "bytes" + } + ], + "internalType": "struct DistributionParameters", + "name": "base", + "type": "tuple" + }, + { + "internalType": "uint24", + "name": "poolFee", + "type": "uint24" + }, + { + "components": [ + { + "internalType": "address", + "name": "add", + "type": "address" + }, + { + "internalType": "uint8", + "name": "decimals", + "type": "uint8" + }, + { + "internalType": "string", + "name": "symbol", + "type": "string" + }, + { + "internalType": "uint256", + "name": "poolBalance", + "type": "uint256" + } + ], + "internalType": "struct UniswapTokenData", + "name": "token0", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "address", + "name": "add", + "type": "address" + }, + { + "internalType": "uint8", + "name": "decimals", + "type": "uint8" + }, + { + "internalType": "string", + "name": "symbol", + "type": "string" + }, + { + "internalType": "uint256", + "name": "poolBalance", + "type": "uint256" + } + ], + "internalType": "struct UniswapTokenData", + "name": "token1", + "type": "tuple" + }, + { + "internalType": "string", + "name": "rewardTokenSymbol", + "type": "string" + }, + { + "internalType": "uint8", + "name": "rewardTokenDecimals", + "type": "uint8" + } + ], + "internalType": "struct ExtensiveDistributionParameters[]", + "name": "searchDistributions", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint32", + "name": "epochStart", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "skip", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "first", + "type": "uint32" + } + ], + "name": "getDistributionsAfterEpoch", + "outputs": [ + { + "components": [ + { + "components": [ + { + "internalType": "bytes32", + "name": "rewardId", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "uniV3Pool", + "type": "address" + }, + { + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address[]", + "name": "positionWrappers", + "type": "address[]" + }, + { + "internalType": "uint32[]", + "name": "wrapperTypes", + "type": "uint32[]" + }, + { + "internalType": "uint32", + "name": "propToken0", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propToken1", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propFees", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "epochStart", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "numEpoch", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "isOutOfRangeIncentivized", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "boostedReward", + "type": "uint32" + }, + { + "internalType": "address", + "name": "boostingAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "additionalData", + "type": "bytes" + } + ], + "internalType": "struct DistributionParameters", + "name": "base", + "type": "tuple" + }, + { + "internalType": "uint24", + "name": "poolFee", + "type": "uint24" + }, + { + "components": [ + { + "internalType": "address", + "name": "add", + "type": "address" + }, + { + "internalType": "uint8", + "name": "decimals", + "type": "uint8" + }, + { + "internalType": "string", + "name": "symbol", + "type": "string" + }, + { + "internalType": "uint256", + "name": "poolBalance", + "type": "uint256" + } + ], + "internalType": "struct UniswapTokenData", + "name": "token0", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "address", + "name": "add", + "type": "address" + }, + { + "internalType": "uint8", + "name": "decimals", + "type": "uint8" + }, + { + "internalType": "string", + "name": "symbol", + "type": "string" + }, + { + "internalType": "uint256", + "name": "poolBalance", + "type": "uint256" + } + ], + "internalType": "struct UniswapTokenData", + "name": "token1", + "type": "tuple" + }, + { + "internalType": "string", + "name": "rewardTokenSymbol", + "type": "string" + }, + { + "internalType": "uint8", + "name": "rewardTokenDecimals", + "type": "uint8" + } + ], + "internalType": "struct ExtensiveDistributionParameters[]", + "name": "", + "type": "tuple[]" + }, + { + "internalType": "uint256", + "name": "lastIndexDistribution", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint32", + "name": "epochStart", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "epochEnd", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "skip", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "first", + "type": "uint32" + } + ], + "name": "getDistributionsBetweenEpochs", + "outputs": [ + { + "components": [ + { + "components": [ + { + "internalType": "bytes32", + "name": "rewardId", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "uniV3Pool", + "type": "address" + }, + { + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address[]", + "name": "positionWrappers", + "type": "address[]" + }, + { + "internalType": "uint32[]", + "name": "wrapperTypes", + "type": "uint32[]" + }, + { + "internalType": "uint32", + "name": "propToken0", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propToken1", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propFees", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "epochStart", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "numEpoch", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "isOutOfRangeIncentivized", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "boostedReward", + "type": "uint32" + }, + { + "internalType": "address", + "name": "boostingAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "additionalData", + "type": "bytes" + } + ], + "internalType": "struct DistributionParameters", + "name": "base", + "type": "tuple" + }, + { + "internalType": "uint24", + "name": "poolFee", + "type": "uint24" + }, + { + "components": [ + { + "internalType": "address", + "name": "add", + "type": "address" + }, + { + "internalType": "uint8", + "name": "decimals", + "type": "uint8" + }, + { + "internalType": "string", + "name": "symbol", + "type": "string" + }, + { + "internalType": "uint256", + "name": "poolBalance", + "type": "uint256" + } + ], + "internalType": "struct UniswapTokenData", + "name": "token0", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "address", + "name": "add", + "type": "address" + }, + { + "internalType": "uint8", + "name": "decimals", + "type": "uint8" + }, + { + "internalType": "string", + "name": "symbol", + "type": "string" + }, + { + "internalType": "uint256", + "name": "poolBalance", + "type": "uint256" + } + ], + "internalType": "struct UniswapTokenData", + "name": "token1", + "type": "tuple" + }, + { + "internalType": "string", + "name": "rewardTokenSymbol", + "type": "string" + }, + { + "internalType": "uint8", + "name": "rewardTokenDecimals", + "type": "uint8" + } + ], + "internalType": "struct ExtensiveDistributionParameters[]", + "name": "", + "type": "tuple[]" + }, + { + "internalType": "uint256", + "name": "lastIndexDistribution", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint32", + "name": "epochStart", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "epochEnd", + "type": "uint32" + } + ], + "name": "getDistributionsBetweenEpochs", + "outputs": [ + { + "components": [ + { + "components": [ + { + "internalType": "bytes32", + "name": "rewardId", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "uniV3Pool", + "type": "address" + }, + { + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address[]", + "name": "positionWrappers", + "type": "address[]" + }, + { + "internalType": "uint32[]", + "name": "wrapperTypes", + "type": "uint32[]" + }, + { + "internalType": "uint32", + "name": "propToken0", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propToken1", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propFees", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "epochStart", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "numEpoch", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "isOutOfRangeIncentivized", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "boostedReward", + "type": "uint32" + }, + { + "internalType": "address", + "name": "boostingAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "additionalData", + "type": "bytes" + } + ], + "internalType": "struct DistributionParameters", + "name": "base", + "type": "tuple" + }, + { + "internalType": "uint24", + "name": "poolFee", + "type": "uint24" + }, + { + "components": [ + { + "internalType": "address", + "name": "add", + "type": "address" + }, + { + "internalType": "uint8", + "name": "decimals", + "type": "uint8" + }, + { + "internalType": "string", + "name": "symbol", + "type": "string" + }, + { + "internalType": "uint256", + "name": "poolBalance", + "type": "uint256" + } + ], + "internalType": "struct UniswapTokenData", + "name": "token0", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "address", + "name": "add", + "type": "address" + }, + { + "internalType": "uint8", + "name": "decimals", + "type": "uint8" + }, + { + "internalType": "string", + "name": "symbol", + "type": "string" + }, + { + "internalType": "uint256", + "name": "poolBalance", + "type": "uint256" + } + ], + "internalType": "struct UniswapTokenData", + "name": "token1", + "type": "tuple" + }, + { + "internalType": "string", + "name": "rewardTokenSymbol", + "type": "string" + }, + { + "internalType": "uint8", + "name": "rewardTokenDecimals", + "type": "uint8" + } + ], + "internalType": "struct ExtensiveDistributionParameters[]", + "name": "searchDistributions", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint32", + "name": "epoch", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "skip", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "first", + "type": "uint32" + } + ], + "name": "getDistributionsForEpoch", + "outputs": [ + { + "components": [ + { + "components": [ + { + "internalType": "bytes32", + "name": "rewardId", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "uniV3Pool", + "type": "address" + }, + { + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address[]", + "name": "positionWrappers", + "type": "address[]" + }, + { + "internalType": "uint32[]", + "name": "wrapperTypes", + "type": "uint32[]" + }, + { + "internalType": "uint32", + "name": "propToken0", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propToken1", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propFees", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "epochStart", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "numEpoch", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "isOutOfRangeIncentivized", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "boostedReward", + "type": "uint32" + }, + { + "internalType": "address", + "name": "boostingAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "additionalData", + "type": "bytes" + } + ], + "internalType": "struct DistributionParameters", + "name": "base", + "type": "tuple" + }, + { + "internalType": "uint24", + "name": "poolFee", + "type": "uint24" + }, + { + "components": [ + { + "internalType": "address", + "name": "add", + "type": "address" + }, + { + "internalType": "uint8", + "name": "decimals", + "type": "uint8" + }, + { + "internalType": "string", + "name": "symbol", + "type": "string" + }, + { + "internalType": "uint256", + "name": "poolBalance", + "type": "uint256" + } + ], + "internalType": "struct UniswapTokenData", + "name": "token0", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "address", + "name": "add", + "type": "address" + }, + { + "internalType": "uint8", + "name": "decimals", + "type": "uint8" + }, + { + "internalType": "string", + "name": "symbol", + "type": "string" + }, + { + "internalType": "uint256", + "name": "poolBalance", + "type": "uint256" + } + ], + "internalType": "struct UniswapTokenData", + "name": "token1", + "type": "tuple" + }, + { + "internalType": "string", + "name": "rewardTokenSymbol", + "type": "string" + }, + { + "internalType": "uint8", + "name": "rewardTokenDecimals", + "type": "uint8" + } + ], + "internalType": "struct ExtensiveDistributionParameters[]", + "name": "", + "type": "tuple[]" + }, + { + "internalType": "uint256", + "name": "lastIndexDistribution", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint32", + "name": "epoch", + "type": "uint32" + } + ], + "name": "getDistributionsForEpoch", + "outputs": [ + { + "components": [ + { + "components": [ + { + "internalType": "bytes32", + "name": "rewardId", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "uniV3Pool", + "type": "address" + }, + { + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address[]", + "name": "positionWrappers", + "type": "address[]" + }, + { + "internalType": "uint32[]", + "name": "wrapperTypes", + "type": "uint32[]" + }, + { + "internalType": "uint32", + "name": "propToken0", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propToken1", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propFees", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "epochStart", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "numEpoch", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "isOutOfRangeIncentivized", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "boostedReward", + "type": "uint32" + }, + { + "internalType": "address", + "name": "boostingAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "additionalData", + "type": "bytes" + } + ], + "internalType": "struct DistributionParameters", + "name": "base", + "type": "tuple" + }, + { + "internalType": "uint24", + "name": "poolFee", + "type": "uint24" + }, + { + "components": [ + { + "internalType": "address", + "name": "add", + "type": "address" + }, + { + "internalType": "uint8", + "name": "decimals", + "type": "uint8" + }, + { + "internalType": "string", + "name": "symbol", + "type": "string" + }, + { + "internalType": "uint256", + "name": "poolBalance", + "type": "uint256" + } + ], + "internalType": "struct UniswapTokenData", + "name": "token0", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "address", + "name": "add", + "type": "address" + }, + { + "internalType": "uint8", + "name": "decimals", + "type": "uint8" + }, + { + "internalType": "string", + "name": "symbol", + "type": "string" + }, + { + "internalType": "uint256", + "name": "poolBalance", + "type": "uint256" + } + ], + "internalType": "struct UniswapTokenData", + "name": "token1", + "type": "tuple" + }, + { + "internalType": "string", + "name": "rewardTokenSymbol", + "type": "string" + }, + { + "internalType": "uint8", + "name": "rewardTokenDecimals", + "type": "uint8" + } + ], + "internalType": "struct ExtensiveDistributionParameters[]", + "name": "searchDistributions", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "bytes32", + "name": "rewardId", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "uniV3Pool", + "type": "address" + }, + { + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address[]", + "name": "positionWrappers", + "type": "address[]" + }, + { + "internalType": "uint32[]", + "name": "wrapperTypes", + "type": "uint32[]" + }, + { + "internalType": "uint32", + "name": "propToken0", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propToken1", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propFees", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "epochStart", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "numEpoch", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "isOutOfRangeIncentivized", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "boostedReward", + "type": "uint32" + }, + { + "internalType": "address", + "name": "boostingAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "additionalData", + "type": "bytes" + } + ], + "internalType": "struct DistributionParameters", + "name": "distribution", + "type": "tuple" + } + ], + "name": "getExtensiveDistributionParameters", + "outputs": [ + { + "components": [ + { + "components": [ + { + "internalType": "bytes32", + "name": "rewardId", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "uniV3Pool", + "type": "address" + }, + { + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address[]", + "name": "positionWrappers", + "type": "address[]" + }, + { + "internalType": "uint32[]", + "name": "wrapperTypes", + "type": "uint32[]" + }, + { + "internalType": "uint32", + "name": "propToken0", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propToken1", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propFees", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "epochStart", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "numEpoch", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "isOutOfRangeIncentivized", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "boostedReward", + "type": "uint32" + }, + { + "internalType": "address", + "name": "boostingAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "additionalData", + "type": "bytes" + } + ], + "internalType": "struct DistributionParameters", + "name": "base", + "type": "tuple" + }, + { + "internalType": "uint24", + "name": "poolFee", + "type": "uint24" + }, + { + "components": [ + { + "internalType": "address", + "name": "add", + "type": "address" + }, + { + "internalType": "uint8", + "name": "decimals", + "type": "uint8" + }, + { + "internalType": "string", + "name": "symbol", + "type": "string" + }, + { + "internalType": "uint256", + "name": "poolBalance", + "type": "uint256" + } + ], + "internalType": "struct UniswapTokenData", + "name": "token0", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "address", + "name": "add", + "type": "address" + }, + { + "internalType": "uint8", + "name": "decimals", + "type": "uint8" + }, + { + "internalType": "string", + "name": "symbol", + "type": "string" + }, + { + "internalType": "uint256", + "name": "poolBalance", + "type": "uint256" + } + ], + "internalType": "struct UniswapTokenData", + "name": "token1", + "type": "tuple" + }, + { + "internalType": "string", + "name": "rewardTokenSymbol", + "type": "string" + }, + { + "internalType": "uint8", + "name": "rewardTokenDecimals", + "type": "uint8" + } + ], + "internalType": "struct ExtensiveDistributionParameters", + "name": "extensiveParams", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "uniV3Pool", + "type": "address" + }, + { + "internalType": "uint32", + "name": "epochStart", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "skip", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "first", + "type": "uint32" + } + ], + "name": "getPoolDistributionsAfterEpoch", + "outputs": [ + { + "components": [ + { + "components": [ + { + "internalType": "bytes32", + "name": "rewardId", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "uniV3Pool", + "type": "address" + }, + { + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address[]", + "name": "positionWrappers", + "type": "address[]" + }, + { + "internalType": "uint32[]", + "name": "wrapperTypes", + "type": "uint32[]" + }, + { + "internalType": "uint32", + "name": "propToken0", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propToken1", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propFees", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "epochStart", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "numEpoch", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "isOutOfRangeIncentivized", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "boostedReward", + "type": "uint32" + }, + { + "internalType": "address", + "name": "boostingAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "additionalData", + "type": "bytes" + } + ], + "internalType": "struct DistributionParameters", + "name": "base", + "type": "tuple" + }, + { + "internalType": "uint24", + "name": "poolFee", + "type": "uint24" + }, + { + "components": [ + { + "internalType": "address", + "name": "add", + "type": "address" + }, + { + "internalType": "uint8", + "name": "decimals", + "type": "uint8" + }, + { + "internalType": "string", + "name": "symbol", + "type": "string" + }, + { + "internalType": "uint256", + "name": "poolBalance", + "type": "uint256" + } + ], + "internalType": "struct UniswapTokenData", + "name": "token0", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "address", + "name": "add", + "type": "address" + }, + { + "internalType": "uint8", + "name": "decimals", + "type": "uint8" + }, + { + "internalType": "string", + "name": "symbol", + "type": "string" + }, + { + "internalType": "uint256", + "name": "poolBalance", + "type": "uint256" + } + ], + "internalType": "struct UniswapTokenData", + "name": "token1", + "type": "tuple" + }, + { + "internalType": "string", + "name": "rewardTokenSymbol", + "type": "string" + }, + { + "internalType": "uint8", + "name": "rewardTokenDecimals", + "type": "uint8" + } + ], + "internalType": "struct ExtensiveDistributionParameters[]", + "name": "", + "type": "tuple[]" + }, + { + "internalType": "uint256", + "name": "lastIndexDistribution", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "uniV3Pool", + "type": "address" + }, + { + "internalType": "uint32", + "name": "epochStart", + "type": "uint32" + } + ], + "name": "getPoolDistributionsAfterEpoch", + "outputs": [ + { + "components": [ + { + "components": [ + { + "internalType": "bytes32", + "name": "rewardId", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "uniV3Pool", + "type": "address" + }, + { + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address[]", + "name": "positionWrappers", + "type": "address[]" + }, + { + "internalType": "uint32[]", + "name": "wrapperTypes", + "type": "uint32[]" + }, + { + "internalType": "uint32", + "name": "propToken0", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propToken1", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propFees", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "epochStart", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "numEpoch", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "isOutOfRangeIncentivized", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "boostedReward", + "type": "uint32" + }, + { + "internalType": "address", + "name": "boostingAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "additionalData", + "type": "bytes" + } + ], + "internalType": "struct DistributionParameters", + "name": "base", + "type": "tuple" + }, + { + "internalType": "uint24", + "name": "poolFee", + "type": "uint24" + }, + { + "components": [ + { + "internalType": "address", + "name": "add", + "type": "address" + }, + { + "internalType": "uint8", + "name": "decimals", + "type": "uint8" + }, + { + "internalType": "string", + "name": "symbol", + "type": "string" + }, + { + "internalType": "uint256", + "name": "poolBalance", + "type": "uint256" + } + ], + "internalType": "struct UniswapTokenData", + "name": "token0", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "address", + "name": "add", + "type": "address" + }, + { + "internalType": "uint8", + "name": "decimals", + "type": "uint8" + }, + { + "internalType": "string", + "name": "symbol", + "type": "string" + }, + { + "internalType": "uint256", + "name": "poolBalance", + "type": "uint256" + } + ], + "internalType": "struct UniswapTokenData", + "name": "token1", + "type": "tuple" + }, + { + "internalType": "string", + "name": "rewardTokenSymbol", + "type": "string" + }, + { + "internalType": "uint8", + "name": "rewardTokenDecimals", + "type": "uint8" + } + ], + "internalType": "struct ExtensiveDistributionParameters[]", + "name": "searchDistributions", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "uniV3Pool", + "type": "address" + }, + { + "internalType": "uint32", + "name": "epochStart", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "epochEnd", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "skip", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "first", + "type": "uint32" + } + ], + "name": "getPoolDistributionsBetweenEpochs", + "outputs": [ + { + "components": [ + { + "components": [ + { + "internalType": "bytes32", + "name": "rewardId", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "uniV3Pool", + "type": "address" + }, + { + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address[]", + "name": "positionWrappers", + "type": "address[]" + }, + { + "internalType": "uint32[]", + "name": "wrapperTypes", + "type": "uint32[]" + }, + { + "internalType": "uint32", + "name": "propToken0", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propToken1", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propFees", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "epochStart", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "numEpoch", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "isOutOfRangeIncentivized", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "boostedReward", + "type": "uint32" + }, + { + "internalType": "address", + "name": "boostingAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "additionalData", + "type": "bytes" + } + ], + "internalType": "struct DistributionParameters", + "name": "base", + "type": "tuple" + }, + { + "internalType": "uint24", + "name": "poolFee", + "type": "uint24" + }, + { + "components": [ + { + "internalType": "address", + "name": "add", + "type": "address" + }, + { + "internalType": "uint8", + "name": "decimals", + "type": "uint8" + }, + { + "internalType": "string", + "name": "symbol", + "type": "string" + }, + { + "internalType": "uint256", + "name": "poolBalance", + "type": "uint256" + } + ], + "internalType": "struct UniswapTokenData", + "name": "token0", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "address", + "name": "add", + "type": "address" + }, + { + "internalType": "uint8", + "name": "decimals", + "type": "uint8" + }, + { + "internalType": "string", + "name": "symbol", + "type": "string" + }, + { + "internalType": "uint256", + "name": "poolBalance", + "type": "uint256" + } + ], + "internalType": "struct UniswapTokenData", + "name": "token1", + "type": "tuple" + }, + { + "internalType": "string", + "name": "rewardTokenSymbol", + "type": "string" + }, + { + "internalType": "uint8", + "name": "rewardTokenDecimals", + "type": "uint8" + } + ], + "internalType": "struct ExtensiveDistributionParameters[]", + "name": "", + "type": "tuple[]" + }, + { + "internalType": "uint256", + "name": "lastIndexDistribution", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "uniV3Pool", + "type": "address" + }, + { + "internalType": "uint32", + "name": "epochStart", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "epochEnd", + "type": "uint32" + } + ], + "name": "getPoolDistributionsBetweenEpochs", + "outputs": [ + { + "components": [ + { + "components": [ + { + "internalType": "bytes32", + "name": "rewardId", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "uniV3Pool", + "type": "address" + }, + { + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address[]", + "name": "positionWrappers", + "type": "address[]" + }, + { + "internalType": "uint32[]", + "name": "wrapperTypes", + "type": "uint32[]" + }, + { + "internalType": "uint32", + "name": "propToken0", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propToken1", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propFees", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "epochStart", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "numEpoch", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "isOutOfRangeIncentivized", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "boostedReward", + "type": "uint32" + }, + { + "internalType": "address", + "name": "boostingAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "additionalData", + "type": "bytes" + } + ], + "internalType": "struct DistributionParameters", + "name": "base", + "type": "tuple" + }, + { + "internalType": "uint24", + "name": "poolFee", + "type": "uint24" + }, + { + "components": [ + { + "internalType": "address", + "name": "add", + "type": "address" + }, + { + "internalType": "uint8", + "name": "decimals", + "type": "uint8" + }, + { + "internalType": "string", + "name": "symbol", + "type": "string" + }, + { + "internalType": "uint256", + "name": "poolBalance", + "type": "uint256" + } + ], + "internalType": "struct UniswapTokenData", + "name": "token0", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "address", + "name": "add", + "type": "address" + }, + { + "internalType": "uint8", + "name": "decimals", + "type": "uint8" + }, + { + "internalType": "string", + "name": "symbol", + "type": "string" + }, + { + "internalType": "uint256", + "name": "poolBalance", + "type": "uint256" + } + ], + "internalType": "struct UniswapTokenData", + "name": "token1", + "type": "tuple" + }, + { + "internalType": "string", + "name": "rewardTokenSymbol", + "type": "string" + }, + { + "internalType": "uint8", + "name": "rewardTokenDecimals", + "type": "uint8" + } + ], + "internalType": "struct ExtensiveDistributionParameters[]", + "name": "searchDistributions", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "uniV3Pool", + "type": "address" + }, + { + "internalType": "uint32", + "name": "epoch", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "skip", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "first", + "type": "uint32" + } + ], + "name": "getPoolDistributionsForEpoch", + "outputs": [ + { + "components": [ + { + "components": [ + { + "internalType": "bytes32", + "name": "rewardId", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "uniV3Pool", + "type": "address" + }, + { + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address[]", + "name": "positionWrappers", + "type": "address[]" + }, + { + "internalType": "uint32[]", + "name": "wrapperTypes", + "type": "uint32[]" + }, + { + "internalType": "uint32", + "name": "propToken0", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propToken1", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propFees", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "epochStart", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "numEpoch", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "isOutOfRangeIncentivized", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "boostedReward", + "type": "uint32" + }, + { + "internalType": "address", + "name": "boostingAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "additionalData", + "type": "bytes" + } + ], + "internalType": "struct DistributionParameters", + "name": "base", + "type": "tuple" + }, + { + "internalType": "uint24", + "name": "poolFee", + "type": "uint24" + }, + { + "components": [ + { + "internalType": "address", + "name": "add", + "type": "address" + }, + { + "internalType": "uint8", + "name": "decimals", + "type": "uint8" + }, + { + "internalType": "string", + "name": "symbol", + "type": "string" + }, + { + "internalType": "uint256", + "name": "poolBalance", + "type": "uint256" + } + ], + "internalType": "struct UniswapTokenData", + "name": "token0", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "address", + "name": "add", + "type": "address" + }, + { + "internalType": "uint8", + "name": "decimals", + "type": "uint8" + }, + { + "internalType": "string", + "name": "symbol", + "type": "string" + }, + { + "internalType": "uint256", + "name": "poolBalance", + "type": "uint256" + } + ], + "internalType": "struct UniswapTokenData", + "name": "token1", + "type": "tuple" + }, + { + "internalType": "string", + "name": "rewardTokenSymbol", + "type": "string" + }, + { + "internalType": "uint8", + "name": "rewardTokenDecimals", + "type": "uint8" + } + ], + "internalType": "struct ExtensiveDistributionParameters[]", + "name": "", + "type": "tuple[]" + }, + { + "internalType": "uint256", + "name": "lastIndexDistribution", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "uniV3Pool", + "type": "address" + }, + { + "internalType": "uint32", + "name": "epoch", + "type": "uint32" + } + ], + "name": "getPoolDistributionsForEpoch", + "outputs": [ + { + "components": [ + { + "components": [ + { + "internalType": "bytes32", + "name": "rewardId", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "uniV3Pool", + "type": "address" + }, + { + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address[]", + "name": "positionWrappers", + "type": "address[]" + }, + { + "internalType": "uint32[]", + "name": "wrapperTypes", + "type": "uint32[]" + }, + { + "internalType": "uint32", + "name": "propToken0", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propToken1", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propFees", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "epochStart", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "numEpoch", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "isOutOfRangeIncentivized", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "boostedReward", + "type": "uint32" + }, + { + "internalType": "address", + "name": "boostingAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "additionalData", + "type": "bytes" + } + ], + "internalType": "struct DistributionParameters", + "name": "base", + "type": "tuple" + }, + { + "internalType": "uint24", + "name": "poolFee", + "type": "uint24" + }, + { + "components": [ + { + "internalType": "address", + "name": "add", + "type": "address" + }, + { + "internalType": "uint8", + "name": "decimals", + "type": "uint8" + }, + { + "internalType": "string", + "name": "symbol", + "type": "string" + }, + { + "internalType": "uint256", + "name": "poolBalance", + "type": "uint256" + } + ], + "internalType": "struct UniswapTokenData", + "name": "token0", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "address", + "name": "add", + "type": "address" + }, + { + "internalType": "uint8", + "name": "decimals", + "type": "uint8" + }, + { + "internalType": "string", + "name": "symbol", + "type": "string" + }, + { + "internalType": "uint256", + "name": "poolBalance", + "type": "uint256" + } + ], + "internalType": "struct UniswapTokenData", + "name": "token1", + "type": "tuple" + }, + { + "internalType": "string", + "name": "rewardTokenSymbol", + "type": "string" + }, + { + "internalType": "uint8", + "name": "rewardTokenDecimals", + "type": "uint8" + } + ], + "internalType": "struct ExtensiveDistributionParameters[]", + "name": "searchDistributions", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getValidRewardTokens", + "outputs": [ + { + "components": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "minimumAmountPerEpoch", + "type": "uint256" + } + ], + "internalType": "struct RewardTokenAmounts[]", + "name": "", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract ICore", + "name": "_core", + "type": "address" + }, + { + "internalType": "address", + "name": "_distributor", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_fees", + "type": "uint256" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "isWhitelistedToken", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "message", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "messageHash", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "nonces", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "proxiableUUID", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IERC20[]", + "name": "tokens", + "type": "address[]" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + } + ], + "name": "recoverFees", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "rewardTokenMinAmounts", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "rewardTokens", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_feeRecipient", + "type": "address" + } + ], + "name": "setFeeRecipient", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_fees", + "type": "uint256" + } + ], + "name": "setFees", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "_message", + "type": "string" + } + ], + "name": "setMessage", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_distributor", + "type": "address" + } + ], + "name": "setNewDistributor", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "tokens", + "type": "address[]" + }, + { + "internalType": "uint256[]", + "name": "amounts", + "type": "uint256[]" + } + ], + "name": "setRewardTokenMinAmounts", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "internalType": "uint256", + "name": "userFeeRebate", + "type": "uint256" + } + ], + "name": "setUserFeeRebate", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "signature", + "type": "bytes" + } + ], + "name": "sign", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "bytes32", + "name": "rewardId", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "uniV3Pool", + "type": "address" + }, + { + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address[]", + "name": "positionWrappers", + "type": "address[]" + }, + { + "internalType": "uint32[]", + "name": "wrapperTypes", + "type": "uint32[]" + }, + { + "internalType": "uint32", + "name": "propToken0", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propToken1", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propFees", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "epochStart", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "numEpoch", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "isOutOfRangeIncentivized", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "boostedReward", + "type": "uint32" + }, + { + "internalType": "address", + "name": "boostingAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "additionalData", + "type": "bytes" + } + ], + "internalType": "struct DistributionParameters", + "name": "distribution", + "type": "tuple" + }, + { + "internalType": "bytes", + "name": "signature", + "type": "bytes" + } + ], + "name": "signAndCreateDistribution", + "outputs": [ + { + "internalType": "uint256", + "name": "distributionAmount", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "user", + "type": "address" + } + ], + "name": "toggleSigningWhitelist", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + } + ], + "name": "toggleTokenWhitelist", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "bytes32", + "name": "rewardId", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "uniV3Pool", + "type": "address" + }, + { + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address[]", + "name": "positionWrappers", + "type": "address[]" + }, + { + "internalType": "uint32[]", + "name": "wrapperTypes", + "type": "uint32[]" + }, + { + "internalType": "uint32", + "name": "propToken0", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propToken1", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propFees", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "epochStart", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "numEpoch", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "isOutOfRangeIncentivized", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "boostedReward", + "type": "uint32" + }, + { + "internalType": "address", + "name": "boostingAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "additionalData", + "type": "bytes" + } + ], + "internalType": "struct DistributionParameters", + "name": "distribution", + "type": "tuple" + } + ], + "name": "tryGetExtensiveDistributionParameters", + "outputs": [ + { + "internalType": "bool", + "name": "success", + "type": "bool" + }, + { + "components": [ + { + "components": [ + { + "internalType": "bytes32", + "name": "rewardId", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "uniV3Pool", + "type": "address" + }, + { + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address[]", + "name": "positionWrappers", + "type": "address[]" + }, + { + "internalType": "uint32[]", + "name": "wrapperTypes", + "type": "uint32[]" + }, + { + "internalType": "uint32", + "name": "propToken0", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propToken1", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propFees", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "epochStart", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "numEpoch", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "isOutOfRangeIncentivized", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "boostedReward", + "type": "uint32" + }, + { + "internalType": "address", + "name": "boostingAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "additionalData", + "type": "bytes" + } + ], + "internalType": "struct DistributionParameters", + "name": "base", + "type": "tuple" + }, + { + "internalType": "uint24", + "name": "poolFee", + "type": "uint24" + }, + { + "components": [ + { + "internalType": "address", + "name": "add", + "type": "address" + }, + { + "internalType": "uint8", + "name": "decimals", + "type": "uint8" + }, + { + "internalType": "string", + "name": "symbol", + "type": "string" + }, + { + "internalType": "uint256", + "name": "poolBalance", + "type": "uint256" + } + ], + "internalType": "struct UniswapTokenData", + "name": "token0", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "address", + "name": "add", + "type": "address" + }, + { + "internalType": "uint8", + "name": "decimals", + "type": "uint8" + }, + { + "internalType": "string", + "name": "symbol", + "type": "string" + }, + { + "internalType": "uint256", + "name": "poolBalance", + "type": "uint256" + } + ], + "internalType": "struct UniswapTokenData", + "name": "token1", + "type": "tuple" + }, + { + "internalType": "string", + "name": "rewardTokenSymbol", + "type": "string" + }, + { + "internalType": "uint8", + "name": "rewardTokenDecimals", + "type": "uint8" + } + ], + "internalType": "struct ExtensiveDistributionParameters", + "name": "extensiveParams", + "type": "tuple" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "upgradeTo", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "upgradeToAndCall", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "userSignatureWhitelist", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "userSignatures", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "transactionHash": "0x4bdf0313927ccca138595fc9e4cf9da4b4b4167207550902d75a8758a0a84980", + "receipt": { + "to": null, + "from": "0x9f76a95AA7535bb0893cf88A146396e00ed21A12", + "contractAddress": "0x7Db28175B63f154587BbB1Cae62D39Ea80A23383", + "transactionIndex": 45, + "gasUsed": "167477892", + "logsBloom": "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", + "blockHash": "0x174a31d74f33d57e429e5e431d4f6c97f142a61e4515f243315a53a7439c8b42", + "transactionHash": "0x4bdf0313927ccca138595fc9e4cf9da4b4b4167207550902d75a8758a0a84980", + "logs": [ + { + "transactionIndex": 45, + "blockNumber": 3365866, + "transactionHash": "0x4bdf0313927ccca138595fc9e4cf9da4b4b4167207550902d75a8758a0a84980", + "address": "0x7Db28175B63f154587BbB1Cae62D39Ea80A23383", + "topics": [ + "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000000001", + "logIndex": 0, + "blockHash": "0x174a31d74f33d57e429e5e431d4f6c97f142a61e4515f243315a53a7439c8b42" + }, + { + "transactionIndex": 45, + "blockNumber": 3365866, + "transactionHash": "0x4bdf0313927ccca138595fc9e4cf9da4b4b4167207550902d75a8758a0a84980", + "address": "0x7Db28175B63f154587BbB1Cae62D39Ea80A23383", + "topics": [ + "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000000001", + "logIndex": 1, + "blockHash": "0x174a31d74f33d57e429e5e431d4f6c97f142a61e4515f243315a53a7439c8b42" + } + ], + "blockNumber": 3365866, + "cumulativeGasUsed": "0", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 1, + "solcInputHash": "69984a2380fa2fad0c3afbbb08b5652b", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"InvalidLengths\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidParam\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidReward\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidSignature\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotGovernorOrGuardian\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotSigned\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ZeroAddress\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"previousAdmin\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"AdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"beacon\",\"type\":\"address\"}],\"name\":\"BeaconUpgraded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_distributor\",\"type\":\"address\"}],\"name\":\"DistributorUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"userFeeRebate\",\"type\":\"uint256\"}],\"name\":\"FeeRebateUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_feeRecipient\",\"type\":\"address\"}],\"name\":\"FeeRecipientUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_fees\",\"type\":\"uint256\"}],\"name\":\"FeesSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"_messageHash\",\"type\":\"bytes32\"}],\"name\":\"MessageUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"rewardId\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"uniV3Pool\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"rewardToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"positionWrappers\",\"type\":\"address[]\"},{\"internalType\":\"uint32[]\",\"name\":\"wrapperTypes\",\"type\":\"uint32[]\"},{\"internalType\":\"uint32\",\"name\":\"propToken0\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propToken1\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propFees\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"epochStart\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"numEpoch\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"isOutOfRangeIncentivized\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"boostedReward\",\"type\":\"uint32\"},{\"internalType\":\"address\",\"name\":\"boostingAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"additionalData\",\"type\":\"bytes\"}],\"indexed\":false,\"internalType\":\"struct DistributionParameters\",\"name\":\"distribution\",\"type\":\"tuple\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"NewDistribution\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"RewardTokenMinimumAmountUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"toggleStatus\",\"type\":\"uint256\"}],\"name\":\"TokenWhitelistToggled\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"implementation\",\"type\":\"address\"}],\"name\":\"Upgraded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"messageHash\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"}],\"name\":\"UserSigned\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"toggleStatus\",\"type\":\"uint256\"}],\"name\":\"UserSigningWhitelistToggled\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"BASE_9\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"EPOCH_DURATION\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"core\",\"outputs\":[{\"internalType\":\"contract ICore\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"rewardId\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"uniV3Pool\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"rewardToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"positionWrappers\",\"type\":\"address[]\"},{\"internalType\":\"uint32[]\",\"name\":\"wrapperTypes\",\"type\":\"uint32[]\"},{\"internalType\":\"uint32\",\"name\":\"propToken0\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propToken1\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propFees\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"epochStart\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"numEpoch\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"isOutOfRangeIncentivized\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"boostedReward\",\"type\":\"uint32\"},{\"internalType\":\"address\",\"name\":\"boostingAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"additionalData\",\"type\":\"bytes\"}],\"internalType\":\"struct DistributionParameters\",\"name\":\"distribution\",\"type\":\"tuple\"}],\"name\":\"createDistribution\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"distributionAmount\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"rewardId\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"uniV3Pool\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"rewardToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"positionWrappers\",\"type\":\"address[]\"},{\"internalType\":\"uint32[]\",\"name\":\"wrapperTypes\",\"type\":\"uint32[]\"},{\"internalType\":\"uint32\",\"name\":\"propToken0\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propToken1\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propFees\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"epochStart\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"numEpoch\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"isOutOfRangeIncentivized\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"boostedReward\",\"type\":\"uint32\"},{\"internalType\":\"address\",\"name\":\"boostingAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"additionalData\",\"type\":\"bytes\"}],\"internalType\":\"struct DistributionParameters[]\",\"name\":\"distributions\",\"type\":\"tuple[]\"}],\"name\":\"createDistributions\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"\",\"type\":\"uint256[]\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"distributionList\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"rewardId\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"uniV3Pool\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"rewardToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"uint32\",\"name\":\"propToken0\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propToken1\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propFees\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"epochStart\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"numEpoch\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"isOutOfRangeIncentivized\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"boostedReward\",\"type\":\"uint32\"},{\"internalType\":\"address\",\"name\":\"boostingAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"additionalData\",\"type\":\"bytes\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"distributor\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"feeRebate\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"feeRecipient\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"fees\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getActiveDistributions\",\"outputs\":[{\"components\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"rewardId\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"uniV3Pool\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"rewardToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"positionWrappers\",\"type\":\"address[]\"},{\"internalType\":\"uint32[]\",\"name\":\"wrapperTypes\",\"type\":\"uint32[]\"},{\"internalType\":\"uint32\",\"name\":\"propToken0\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propToken1\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propFees\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"epochStart\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"numEpoch\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"isOutOfRangeIncentivized\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"boostedReward\",\"type\":\"uint32\"},{\"internalType\":\"address\",\"name\":\"boostingAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"additionalData\",\"type\":\"bytes\"}],\"internalType\":\"struct DistributionParameters\",\"name\":\"base\",\"type\":\"tuple\"},{\"internalType\":\"uint24\",\"name\":\"poolFee\",\"type\":\"uint24\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"add\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"decimals\",\"type\":\"uint8\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"poolBalance\",\"type\":\"uint256\"}],\"internalType\":\"struct UniswapTokenData\",\"name\":\"token0\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"add\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"decimals\",\"type\":\"uint8\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"poolBalance\",\"type\":\"uint256\"}],\"internalType\":\"struct UniswapTokenData\",\"name\":\"token1\",\"type\":\"tuple\"},{\"internalType\":\"string\",\"name\":\"rewardTokenSymbol\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"rewardTokenDecimals\",\"type\":\"uint8\"}],\"internalType\":\"struct ExtensiveDistributionParameters[]\",\"name\":\"searchDistributions\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"skip\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"first\",\"type\":\"uint32\"}],\"name\":\"getActiveDistributions\",\"outputs\":[{\"components\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"rewardId\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"uniV3Pool\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"rewardToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"positionWrappers\",\"type\":\"address[]\"},{\"internalType\":\"uint32[]\",\"name\":\"wrapperTypes\",\"type\":\"uint32[]\"},{\"internalType\":\"uint32\",\"name\":\"propToken0\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propToken1\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propFees\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"epochStart\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"numEpoch\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"isOutOfRangeIncentivized\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"boostedReward\",\"type\":\"uint32\"},{\"internalType\":\"address\",\"name\":\"boostingAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"additionalData\",\"type\":\"bytes\"}],\"internalType\":\"struct DistributionParameters\",\"name\":\"base\",\"type\":\"tuple\"},{\"internalType\":\"uint24\",\"name\":\"poolFee\",\"type\":\"uint24\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"add\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"decimals\",\"type\":\"uint8\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"poolBalance\",\"type\":\"uint256\"}],\"internalType\":\"struct UniswapTokenData\",\"name\":\"token0\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"add\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"decimals\",\"type\":\"uint8\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"poolBalance\",\"type\":\"uint256\"}],\"internalType\":\"struct UniswapTokenData\",\"name\":\"token1\",\"type\":\"tuple\"},{\"internalType\":\"string\",\"name\":\"rewardTokenSymbol\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"rewardTokenDecimals\",\"type\":\"uint8\"}],\"internalType\":\"struct ExtensiveDistributionParameters[]\",\"name\":\"searchDistributions\",\"type\":\"tuple[]\"},{\"internalType\":\"uint256\",\"name\":\"lastIndexDistribution\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"uniV3Pool\",\"type\":\"address\"}],\"name\":\"getActivePoolDistributions\",\"outputs\":[{\"components\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"rewardId\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"uniV3Pool\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"rewardToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"positionWrappers\",\"type\":\"address[]\"},{\"internalType\":\"uint32[]\",\"name\":\"wrapperTypes\",\"type\":\"uint32[]\"},{\"internalType\":\"uint32\",\"name\":\"propToken0\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propToken1\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propFees\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"epochStart\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"numEpoch\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"isOutOfRangeIncentivized\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"boostedReward\",\"type\":\"uint32\"},{\"internalType\":\"address\",\"name\":\"boostingAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"additionalData\",\"type\":\"bytes\"}],\"internalType\":\"struct DistributionParameters\",\"name\":\"base\",\"type\":\"tuple\"},{\"internalType\":\"uint24\",\"name\":\"poolFee\",\"type\":\"uint24\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"add\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"decimals\",\"type\":\"uint8\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"poolBalance\",\"type\":\"uint256\"}],\"internalType\":\"struct UniswapTokenData\",\"name\":\"token0\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"add\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"decimals\",\"type\":\"uint8\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"poolBalance\",\"type\":\"uint256\"}],\"internalType\":\"struct UniswapTokenData\",\"name\":\"token1\",\"type\":\"tuple\"},{\"internalType\":\"string\",\"name\":\"rewardTokenSymbol\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"rewardTokenDecimals\",\"type\":\"uint8\"}],\"internalType\":\"struct ExtensiveDistributionParameters[]\",\"name\":\"searchDistributions\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"uniV3Pool\",\"type\":\"address\"},{\"internalType\":\"uint32\",\"name\":\"skip\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"first\",\"type\":\"uint32\"}],\"name\":\"getActivePoolDistributions\",\"outputs\":[{\"components\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"rewardId\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"uniV3Pool\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"rewardToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"positionWrappers\",\"type\":\"address[]\"},{\"internalType\":\"uint32[]\",\"name\":\"wrapperTypes\",\"type\":\"uint32[]\"},{\"internalType\":\"uint32\",\"name\":\"propToken0\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propToken1\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propFees\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"epochStart\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"numEpoch\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"isOutOfRangeIncentivized\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"boostedReward\",\"type\":\"uint32\"},{\"internalType\":\"address\",\"name\":\"boostingAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"additionalData\",\"type\":\"bytes\"}],\"internalType\":\"struct DistributionParameters\",\"name\":\"base\",\"type\":\"tuple\"},{\"internalType\":\"uint24\",\"name\":\"poolFee\",\"type\":\"uint24\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"add\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"decimals\",\"type\":\"uint8\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"poolBalance\",\"type\":\"uint256\"}],\"internalType\":\"struct UniswapTokenData\",\"name\":\"token0\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"add\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"decimals\",\"type\":\"uint8\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"poolBalance\",\"type\":\"uint256\"}],\"internalType\":\"struct UniswapTokenData\",\"name\":\"token1\",\"type\":\"tuple\"},{\"internalType\":\"string\",\"name\":\"rewardTokenSymbol\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"rewardTokenDecimals\",\"type\":\"uint8\"}],\"internalType\":\"struct ExtensiveDistributionParameters[]\",\"name\":\"\",\"type\":\"tuple[]\"},{\"internalType\":\"uint256\",\"name\":\"lastIndexDistribution\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getAllDistributions\",\"outputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"rewardId\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"uniV3Pool\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"rewardToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"positionWrappers\",\"type\":\"address[]\"},{\"internalType\":\"uint32[]\",\"name\":\"wrapperTypes\",\"type\":\"uint32[]\"},{\"internalType\":\"uint32\",\"name\":\"propToken0\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propToken1\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propFees\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"epochStart\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"numEpoch\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"isOutOfRangeIncentivized\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"boostedReward\",\"type\":\"uint32\"},{\"internalType\":\"address\",\"name\":\"boostingAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"additionalData\",\"type\":\"bytes\"}],\"internalType\":\"struct DistributionParameters[]\",\"name\":\"\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"epochStart\",\"type\":\"uint32\"}],\"name\":\"getDistributionsAfterEpoch\",\"outputs\":[{\"components\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"rewardId\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"uniV3Pool\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"rewardToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"positionWrappers\",\"type\":\"address[]\"},{\"internalType\":\"uint32[]\",\"name\":\"wrapperTypes\",\"type\":\"uint32[]\"},{\"internalType\":\"uint32\",\"name\":\"propToken0\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propToken1\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propFees\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"epochStart\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"numEpoch\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"isOutOfRangeIncentivized\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"boostedReward\",\"type\":\"uint32\"},{\"internalType\":\"address\",\"name\":\"boostingAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"additionalData\",\"type\":\"bytes\"}],\"internalType\":\"struct DistributionParameters\",\"name\":\"base\",\"type\":\"tuple\"},{\"internalType\":\"uint24\",\"name\":\"poolFee\",\"type\":\"uint24\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"add\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"decimals\",\"type\":\"uint8\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"poolBalance\",\"type\":\"uint256\"}],\"internalType\":\"struct UniswapTokenData\",\"name\":\"token0\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"add\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"decimals\",\"type\":\"uint8\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"poolBalance\",\"type\":\"uint256\"}],\"internalType\":\"struct UniswapTokenData\",\"name\":\"token1\",\"type\":\"tuple\"},{\"internalType\":\"string\",\"name\":\"rewardTokenSymbol\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"rewardTokenDecimals\",\"type\":\"uint8\"}],\"internalType\":\"struct ExtensiveDistributionParameters[]\",\"name\":\"searchDistributions\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"epochStart\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"skip\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"first\",\"type\":\"uint32\"}],\"name\":\"getDistributionsAfterEpoch\",\"outputs\":[{\"components\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"rewardId\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"uniV3Pool\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"rewardToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"positionWrappers\",\"type\":\"address[]\"},{\"internalType\":\"uint32[]\",\"name\":\"wrapperTypes\",\"type\":\"uint32[]\"},{\"internalType\":\"uint32\",\"name\":\"propToken0\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propToken1\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propFees\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"epochStart\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"numEpoch\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"isOutOfRangeIncentivized\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"boostedReward\",\"type\":\"uint32\"},{\"internalType\":\"address\",\"name\":\"boostingAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"additionalData\",\"type\":\"bytes\"}],\"internalType\":\"struct DistributionParameters\",\"name\":\"base\",\"type\":\"tuple\"},{\"internalType\":\"uint24\",\"name\":\"poolFee\",\"type\":\"uint24\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"add\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"decimals\",\"type\":\"uint8\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"poolBalance\",\"type\":\"uint256\"}],\"internalType\":\"struct UniswapTokenData\",\"name\":\"token0\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"add\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"decimals\",\"type\":\"uint8\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"poolBalance\",\"type\":\"uint256\"}],\"internalType\":\"struct UniswapTokenData\",\"name\":\"token1\",\"type\":\"tuple\"},{\"internalType\":\"string\",\"name\":\"rewardTokenSymbol\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"rewardTokenDecimals\",\"type\":\"uint8\"}],\"internalType\":\"struct ExtensiveDistributionParameters[]\",\"name\":\"\",\"type\":\"tuple[]\"},{\"internalType\":\"uint256\",\"name\":\"lastIndexDistribution\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"epochStart\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"epochEnd\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"skip\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"first\",\"type\":\"uint32\"}],\"name\":\"getDistributionsBetweenEpochs\",\"outputs\":[{\"components\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"rewardId\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"uniV3Pool\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"rewardToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"positionWrappers\",\"type\":\"address[]\"},{\"internalType\":\"uint32[]\",\"name\":\"wrapperTypes\",\"type\":\"uint32[]\"},{\"internalType\":\"uint32\",\"name\":\"propToken0\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propToken1\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propFees\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"epochStart\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"numEpoch\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"isOutOfRangeIncentivized\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"boostedReward\",\"type\":\"uint32\"},{\"internalType\":\"address\",\"name\":\"boostingAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"additionalData\",\"type\":\"bytes\"}],\"internalType\":\"struct DistributionParameters\",\"name\":\"base\",\"type\":\"tuple\"},{\"internalType\":\"uint24\",\"name\":\"poolFee\",\"type\":\"uint24\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"add\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"decimals\",\"type\":\"uint8\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"poolBalance\",\"type\":\"uint256\"}],\"internalType\":\"struct UniswapTokenData\",\"name\":\"token0\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"add\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"decimals\",\"type\":\"uint8\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"poolBalance\",\"type\":\"uint256\"}],\"internalType\":\"struct UniswapTokenData\",\"name\":\"token1\",\"type\":\"tuple\"},{\"internalType\":\"string\",\"name\":\"rewardTokenSymbol\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"rewardTokenDecimals\",\"type\":\"uint8\"}],\"internalType\":\"struct ExtensiveDistributionParameters[]\",\"name\":\"\",\"type\":\"tuple[]\"},{\"internalType\":\"uint256\",\"name\":\"lastIndexDistribution\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"epochStart\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"epochEnd\",\"type\":\"uint32\"}],\"name\":\"getDistributionsBetweenEpochs\",\"outputs\":[{\"components\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"rewardId\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"uniV3Pool\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"rewardToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"positionWrappers\",\"type\":\"address[]\"},{\"internalType\":\"uint32[]\",\"name\":\"wrapperTypes\",\"type\":\"uint32[]\"},{\"internalType\":\"uint32\",\"name\":\"propToken0\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propToken1\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propFees\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"epochStart\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"numEpoch\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"isOutOfRangeIncentivized\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"boostedReward\",\"type\":\"uint32\"},{\"internalType\":\"address\",\"name\":\"boostingAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"additionalData\",\"type\":\"bytes\"}],\"internalType\":\"struct DistributionParameters\",\"name\":\"base\",\"type\":\"tuple\"},{\"internalType\":\"uint24\",\"name\":\"poolFee\",\"type\":\"uint24\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"add\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"decimals\",\"type\":\"uint8\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"poolBalance\",\"type\":\"uint256\"}],\"internalType\":\"struct UniswapTokenData\",\"name\":\"token0\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"add\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"decimals\",\"type\":\"uint8\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"poolBalance\",\"type\":\"uint256\"}],\"internalType\":\"struct UniswapTokenData\",\"name\":\"token1\",\"type\":\"tuple\"},{\"internalType\":\"string\",\"name\":\"rewardTokenSymbol\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"rewardTokenDecimals\",\"type\":\"uint8\"}],\"internalType\":\"struct ExtensiveDistributionParameters[]\",\"name\":\"searchDistributions\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"epoch\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"skip\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"first\",\"type\":\"uint32\"}],\"name\":\"getDistributionsForEpoch\",\"outputs\":[{\"components\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"rewardId\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"uniV3Pool\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"rewardToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"positionWrappers\",\"type\":\"address[]\"},{\"internalType\":\"uint32[]\",\"name\":\"wrapperTypes\",\"type\":\"uint32[]\"},{\"internalType\":\"uint32\",\"name\":\"propToken0\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propToken1\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propFees\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"epochStart\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"numEpoch\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"isOutOfRangeIncentivized\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"boostedReward\",\"type\":\"uint32\"},{\"internalType\":\"address\",\"name\":\"boostingAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"additionalData\",\"type\":\"bytes\"}],\"internalType\":\"struct DistributionParameters\",\"name\":\"base\",\"type\":\"tuple\"},{\"internalType\":\"uint24\",\"name\":\"poolFee\",\"type\":\"uint24\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"add\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"decimals\",\"type\":\"uint8\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"poolBalance\",\"type\":\"uint256\"}],\"internalType\":\"struct UniswapTokenData\",\"name\":\"token0\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"add\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"decimals\",\"type\":\"uint8\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"poolBalance\",\"type\":\"uint256\"}],\"internalType\":\"struct UniswapTokenData\",\"name\":\"token1\",\"type\":\"tuple\"},{\"internalType\":\"string\",\"name\":\"rewardTokenSymbol\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"rewardTokenDecimals\",\"type\":\"uint8\"}],\"internalType\":\"struct ExtensiveDistributionParameters[]\",\"name\":\"\",\"type\":\"tuple[]\"},{\"internalType\":\"uint256\",\"name\":\"lastIndexDistribution\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"epoch\",\"type\":\"uint32\"}],\"name\":\"getDistributionsForEpoch\",\"outputs\":[{\"components\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"rewardId\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"uniV3Pool\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"rewardToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"positionWrappers\",\"type\":\"address[]\"},{\"internalType\":\"uint32[]\",\"name\":\"wrapperTypes\",\"type\":\"uint32[]\"},{\"internalType\":\"uint32\",\"name\":\"propToken0\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propToken1\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propFees\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"epochStart\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"numEpoch\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"isOutOfRangeIncentivized\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"boostedReward\",\"type\":\"uint32\"},{\"internalType\":\"address\",\"name\":\"boostingAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"additionalData\",\"type\":\"bytes\"}],\"internalType\":\"struct DistributionParameters\",\"name\":\"base\",\"type\":\"tuple\"},{\"internalType\":\"uint24\",\"name\":\"poolFee\",\"type\":\"uint24\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"add\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"decimals\",\"type\":\"uint8\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"poolBalance\",\"type\":\"uint256\"}],\"internalType\":\"struct UniswapTokenData\",\"name\":\"token0\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"add\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"decimals\",\"type\":\"uint8\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"poolBalance\",\"type\":\"uint256\"}],\"internalType\":\"struct UniswapTokenData\",\"name\":\"token1\",\"type\":\"tuple\"},{\"internalType\":\"string\",\"name\":\"rewardTokenSymbol\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"rewardTokenDecimals\",\"type\":\"uint8\"}],\"internalType\":\"struct ExtensiveDistributionParameters[]\",\"name\":\"searchDistributions\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"rewardId\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"uniV3Pool\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"rewardToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"positionWrappers\",\"type\":\"address[]\"},{\"internalType\":\"uint32[]\",\"name\":\"wrapperTypes\",\"type\":\"uint32[]\"},{\"internalType\":\"uint32\",\"name\":\"propToken0\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propToken1\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propFees\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"epochStart\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"numEpoch\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"isOutOfRangeIncentivized\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"boostedReward\",\"type\":\"uint32\"},{\"internalType\":\"address\",\"name\":\"boostingAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"additionalData\",\"type\":\"bytes\"}],\"internalType\":\"struct DistributionParameters\",\"name\":\"distribution\",\"type\":\"tuple\"}],\"name\":\"getExtensiveDistributionParameters\",\"outputs\":[{\"components\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"rewardId\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"uniV3Pool\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"rewardToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"positionWrappers\",\"type\":\"address[]\"},{\"internalType\":\"uint32[]\",\"name\":\"wrapperTypes\",\"type\":\"uint32[]\"},{\"internalType\":\"uint32\",\"name\":\"propToken0\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propToken1\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propFees\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"epochStart\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"numEpoch\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"isOutOfRangeIncentivized\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"boostedReward\",\"type\":\"uint32\"},{\"internalType\":\"address\",\"name\":\"boostingAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"additionalData\",\"type\":\"bytes\"}],\"internalType\":\"struct DistributionParameters\",\"name\":\"base\",\"type\":\"tuple\"},{\"internalType\":\"uint24\",\"name\":\"poolFee\",\"type\":\"uint24\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"add\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"decimals\",\"type\":\"uint8\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"poolBalance\",\"type\":\"uint256\"}],\"internalType\":\"struct UniswapTokenData\",\"name\":\"token0\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"add\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"decimals\",\"type\":\"uint8\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"poolBalance\",\"type\":\"uint256\"}],\"internalType\":\"struct UniswapTokenData\",\"name\":\"token1\",\"type\":\"tuple\"},{\"internalType\":\"string\",\"name\":\"rewardTokenSymbol\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"rewardTokenDecimals\",\"type\":\"uint8\"}],\"internalType\":\"struct ExtensiveDistributionParameters\",\"name\":\"extensiveParams\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"uniV3Pool\",\"type\":\"address\"},{\"internalType\":\"uint32\",\"name\":\"epochStart\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"skip\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"first\",\"type\":\"uint32\"}],\"name\":\"getPoolDistributionsAfterEpoch\",\"outputs\":[{\"components\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"rewardId\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"uniV3Pool\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"rewardToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"positionWrappers\",\"type\":\"address[]\"},{\"internalType\":\"uint32[]\",\"name\":\"wrapperTypes\",\"type\":\"uint32[]\"},{\"internalType\":\"uint32\",\"name\":\"propToken0\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propToken1\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propFees\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"epochStart\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"numEpoch\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"isOutOfRangeIncentivized\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"boostedReward\",\"type\":\"uint32\"},{\"internalType\":\"address\",\"name\":\"boostingAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"additionalData\",\"type\":\"bytes\"}],\"internalType\":\"struct DistributionParameters\",\"name\":\"base\",\"type\":\"tuple\"},{\"internalType\":\"uint24\",\"name\":\"poolFee\",\"type\":\"uint24\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"add\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"decimals\",\"type\":\"uint8\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"poolBalance\",\"type\":\"uint256\"}],\"internalType\":\"struct UniswapTokenData\",\"name\":\"token0\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"add\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"decimals\",\"type\":\"uint8\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"poolBalance\",\"type\":\"uint256\"}],\"internalType\":\"struct UniswapTokenData\",\"name\":\"token1\",\"type\":\"tuple\"},{\"internalType\":\"string\",\"name\":\"rewardTokenSymbol\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"rewardTokenDecimals\",\"type\":\"uint8\"}],\"internalType\":\"struct ExtensiveDistributionParameters[]\",\"name\":\"\",\"type\":\"tuple[]\"},{\"internalType\":\"uint256\",\"name\":\"lastIndexDistribution\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"uniV3Pool\",\"type\":\"address\"},{\"internalType\":\"uint32\",\"name\":\"epochStart\",\"type\":\"uint32\"}],\"name\":\"getPoolDistributionsAfterEpoch\",\"outputs\":[{\"components\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"rewardId\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"uniV3Pool\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"rewardToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"positionWrappers\",\"type\":\"address[]\"},{\"internalType\":\"uint32[]\",\"name\":\"wrapperTypes\",\"type\":\"uint32[]\"},{\"internalType\":\"uint32\",\"name\":\"propToken0\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propToken1\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propFees\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"epochStart\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"numEpoch\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"isOutOfRangeIncentivized\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"boostedReward\",\"type\":\"uint32\"},{\"internalType\":\"address\",\"name\":\"boostingAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"additionalData\",\"type\":\"bytes\"}],\"internalType\":\"struct DistributionParameters\",\"name\":\"base\",\"type\":\"tuple\"},{\"internalType\":\"uint24\",\"name\":\"poolFee\",\"type\":\"uint24\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"add\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"decimals\",\"type\":\"uint8\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"poolBalance\",\"type\":\"uint256\"}],\"internalType\":\"struct UniswapTokenData\",\"name\":\"token0\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"add\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"decimals\",\"type\":\"uint8\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"poolBalance\",\"type\":\"uint256\"}],\"internalType\":\"struct UniswapTokenData\",\"name\":\"token1\",\"type\":\"tuple\"},{\"internalType\":\"string\",\"name\":\"rewardTokenSymbol\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"rewardTokenDecimals\",\"type\":\"uint8\"}],\"internalType\":\"struct ExtensiveDistributionParameters[]\",\"name\":\"searchDistributions\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"uniV3Pool\",\"type\":\"address\"},{\"internalType\":\"uint32\",\"name\":\"epochStart\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"epochEnd\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"skip\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"first\",\"type\":\"uint32\"}],\"name\":\"getPoolDistributionsBetweenEpochs\",\"outputs\":[{\"components\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"rewardId\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"uniV3Pool\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"rewardToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"positionWrappers\",\"type\":\"address[]\"},{\"internalType\":\"uint32[]\",\"name\":\"wrapperTypes\",\"type\":\"uint32[]\"},{\"internalType\":\"uint32\",\"name\":\"propToken0\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propToken1\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propFees\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"epochStart\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"numEpoch\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"isOutOfRangeIncentivized\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"boostedReward\",\"type\":\"uint32\"},{\"internalType\":\"address\",\"name\":\"boostingAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"additionalData\",\"type\":\"bytes\"}],\"internalType\":\"struct DistributionParameters\",\"name\":\"base\",\"type\":\"tuple\"},{\"internalType\":\"uint24\",\"name\":\"poolFee\",\"type\":\"uint24\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"add\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"decimals\",\"type\":\"uint8\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"poolBalance\",\"type\":\"uint256\"}],\"internalType\":\"struct UniswapTokenData\",\"name\":\"token0\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"add\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"decimals\",\"type\":\"uint8\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"poolBalance\",\"type\":\"uint256\"}],\"internalType\":\"struct UniswapTokenData\",\"name\":\"token1\",\"type\":\"tuple\"},{\"internalType\":\"string\",\"name\":\"rewardTokenSymbol\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"rewardTokenDecimals\",\"type\":\"uint8\"}],\"internalType\":\"struct ExtensiveDistributionParameters[]\",\"name\":\"\",\"type\":\"tuple[]\"},{\"internalType\":\"uint256\",\"name\":\"lastIndexDistribution\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"uniV3Pool\",\"type\":\"address\"},{\"internalType\":\"uint32\",\"name\":\"epochStart\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"epochEnd\",\"type\":\"uint32\"}],\"name\":\"getPoolDistributionsBetweenEpochs\",\"outputs\":[{\"components\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"rewardId\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"uniV3Pool\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"rewardToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"positionWrappers\",\"type\":\"address[]\"},{\"internalType\":\"uint32[]\",\"name\":\"wrapperTypes\",\"type\":\"uint32[]\"},{\"internalType\":\"uint32\",\"name\":\"propToken0\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propToken1\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propFees\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"epochStart\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"numEpoch\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"isOutOfRangeIncentivized\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"boostedReward\",\"type\":\"uint32\"},{\"internalType\":\"address\",\"name\":\"boostingAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"additionalData\",\"type\":\"bytes\"}],\"internalType\":\"struct DistributionParameters\",\"name\":\"base\",\"type\":\"tuple\"},{\"internalType\":\"uint24\",\"name\":\"poolFee\",\"type\":\"uint24\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"add\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"decimals\",\"type\":\"uint8\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"poolBalance\",\"type\":\"uint256\"}],\"internalType\":\"struct UniswapTokenData\",\"name\":\"token0\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"add\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"decimals\",\"type\":\"uint8\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"poolBalance\",\"type\":\"uint256\"}],\"internalType\":\"struct UniswapTokenData\",\"name\":\"token1\",\"type\":\"tuple\"},{\"internalType\":\"string\",\"name\":\"rewardTokenSymbol\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"rewardTokenDecimals\",\"type\":\"uint8\"}],\"internalType\":\"struct ExtensiveDistributionParameters[]\",\"name\":\"searchDistributions\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"uniV3Pool\",\"type\":\"address\"},{\"internalType\":\"uint32\",\"name\":\"epoch\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"skip\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"first\",\"type\":\"uint32\"}],\"name\":\"getPoolDistributionsForEpoch\",\"outputs\":[{\"components\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"rewardId\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"uniV3Pool\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"rewardToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"positionWrappers\",\"type\":\"address[]\"},{\"internalType\":\"uint32[]\",\"name\":\"wrapperTypes\",\"type\":\"uint32[]\"},{\"internalType\":\"uint32\",\"name\":\"propToken0\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propToken1\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propFees\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"epochStart\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"numEpoch\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"isOutOfRangeIncentivized\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"boostedReward\",\"type\":\"uint32\"},{\"internalType\":\"address\",\"name\":\"boostingAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"additionalData\",\"type\":\"bytes\"}],\"internalType\":\"struct DistributionParameters\",\"name\":\"base\",\"type\":\"tuple\"},{\"internalType\":\"uint24\",\"name\":\"poolFee\",\"type\":\"uint24\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"add\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"decimals\",\"type\":\"uint8\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"poolBalance\",\"type\":\"uint256\"}],\"internalType\":\"struct UniswapTokenData\",\"name\":\"token0\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"add\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"decimals\",\"type\":\"uint8\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"poolBalance\",\"type\":\"uint256\"}],\"internalType\":\"struct UniswapTokenData\",\"name\":\"token1\",\"type\":\"tuple\"},{\"internalType\":\"string\",\"name\":\"rewardTokenSymbol\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"rewardTokenDecimals\",\"type\":\"uint8\"}],\"internalType\":\"struct ExtensiveDistributionParameters[]\",\"name\":\"\",\"type\":\"tuple[]\"},{\"internalType\":\"uint256\",\"name\":\"lastIndexDistribution\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"uniV3Pool\",\"type\":\"address\"},{\"internalType\":\"uint32\",\"name\":\"epoch\",\"type\":\"uint32\"}],\"name\":\"getPoolDistributionsForEpoch\",\"outputs\":[{\"components\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"rewardId\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"uniV3Pool\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"rewardToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"positionWrappers\",\"type\":\"address[]\"},{\"internalType\":\"uint32[]\",\"name\":\"wrapperTypes\",\"type\":\"uint32[]\"},{\"internalType\":\"uint32\",\"name\":\"propToken0\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propToken1\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propFees\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"epochStart\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"numEpoch\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"isOutOfRangeIncentivized\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"boostedReward\",\"type\":\"uint32\"},{\"internalType\":\"address\",\"name\":\"boostingAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"additionalData\",\"type\":\"bytes\"}],\"internalType\":\"struct DistributionParameters\",\"name\":\"base\",\"type\":\"tuple\"},{\"internalType\":\"uint24\",\"name\":\"poolFee\",\"type\":\"uint24\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"add\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"decimals\",\"type\":\"uint8\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"poolBalance\",\"type\":\"uint256\"}],\"internalType\":\"struct UniswapTokenData\",\"name\":\"token0\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"add\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"decimals\",\"type\":\"uint8\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"poolBalance\",\"type\":\"uint256\"}],\"internalType\":\"struct UniswapTokenData\",\"name\":\"token1\",\"type\":\"tuple\"},{\"internalType\":\"string\",\"name\":\"rewardTokenSymbol\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"rewardTokenDecimals\",\"type\":\"uint8\"}],\"internalType\":\"struct ExtensiveDistributionParameters[]\",\"name\":\"searchDistributions\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getValidRewardTokens\",\"outputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"minimumAmountPerEpoch\",\"type\":\"uint256\"}],\"internalType\":\"struct RewardTokenAmounts[]\",\"name\":\"\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract ICore\",\"name\":\"_core\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_distributor\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_fees\",\"type\":\"uint256\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"isWhitelistedToken\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"message\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"messageHash\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"nonces\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"proxiableUUID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract IERC20[]\",\"name\":\"tokens\",\"type\":\"address[]\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"}],\"name\":\"recoverFees\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"rewardTokenMinAmounts\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"rewardTokens\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_feeRecipient\",\"type\":\"address\"}],\"name\":\"setFeeRecipient\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_fees\",\"type\":\"uint256\"}],\"name\":\"setFees\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_message\",\"type\":\"string\"}],\"name\":\"setMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_distributor\",\"type\":\"address\"}],\"name\":\"setNewDistributor\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"tokens\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"}],\"name\":\"setRewardTokenMinAmounts\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"userFeeRebate\",\"type\":\"uint256\"}],\"name\":\"setUserFeeRebate\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"signature\",\"type\":\"bytes\"}],\"name\":\"sign\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"rewardId\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"uniV3Pool\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"rewardToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"positionWrappers\",\"type\":\"address[]\"},{\"internalType\":\"uint32[]\",\"name\":\"wrapperTypes\",\"type\":\"uint32[]\"},{\"internalType\":\"uint32\",\"name\":\"propToken0\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propToken1\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propFees\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"epochStart\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"numEpoch\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"isOutOfRangeIncentivized\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"boostedReward\",\"type\":\"uint32\"},{\"internalType\":\"address\",\"name\":\"boostingAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"additionalData\",\"type\":\"bytes\"}],\"internalType\":\"struct DistributionParameters\",\"name\":\"distribution\",\"type\":\"tuple\"},{\"internalType\":\"bytes\",\"name\":\"signature\",\"type\":\"bytes\"}],\"name\":\"signAndCreateDistribution\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"distributionAmount\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"}],\"name\":\"toggleSigningWhitelist\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"}],\"name\":\"toggleTokenWhitelist\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"rewardId\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"uniV3Pool\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"rewardToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"positionWrappers\",\"type\":\"address[]\"},{\"internalType\":\"uint32[]\",\"name\":\"wrapperTypes\",\"type\":\"uint32[]\"},{\"internalType\":\"uint32\",\"name\":\"propToken0\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propToken1\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propFees\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"epochStart\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"numEpoch\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"isOutOfRangeIncentivized\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"boostedReward\",\"type\":\"uint32\"},{\"internalType\":\"address\",\"name\":\"boostingAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"additionalData\",\"type\":\"bytes\"}],\"internalType\":\"struct DistributionParameters\",\"name\":\"distribution\",\"type\":\"tuple\"}],\"name\":\"tryGetExtensiveDistributionParameters\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"success\",\"type\":\"bool\"},{\"components\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"rewardId\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"uniV3Pool\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"rewardToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"positionWrappers\",\"type\":\"address[]\"},{\"internalType\":\"uint32[]\",\"name\":\"wrapperTypes\",\"type\":\"uint32[]\"},{\"internalType\":\"uint32\",\"name\":\"propToken0\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propToken1\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propFees\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"epochStart\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"numEpoch\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"isOutOfRangeIncentivized\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"boostedReward\",\"type\":\"uint32\"},{\"internalType\":\"address\",\"name\":\"boostingAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"additionalData\",\"type\":\"bytes\"}],\"internalType\":\"struct DistributionParameters\",\"name\":\"base\",\"type\":\"tuple\"},{\"internalType\":\"uint24\",\"name\":\"poolFee\",\"type\":\"uint24\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"add\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"decimals\",\"type\":\"uint8\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"poolBalance\",\"type\":\"uint256\"}],\"internalType\":\"struct UniswapTokenData\",\"name\":\"token0\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"add\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"decimals\",\"type\":\"uint8\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"poolBalance\",\"type\":\"uint256\"}],\"internalType\":\"struct UniswapTokenData\",\"name\":\"token1\",\"type\":\"tuple\"},{\"internalType\":\"string\",\"name\":\"rewardTokenSymbol\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"rewardTokenDecimals\",\"type\":\"uint8\"}],\"internalType\":\"struct ExtensiveDistributionParameters\",\"name\":\"extensiveParams\",\"type\":\"tuple\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"}],\"name\":\"upgradeTo\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"upgradeToAndCall\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"userSignatureWhitelist\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"userSignatures\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"author\":\"Angle Labs, Inc.\",\"details\":\"This contract is mostly a helper for APIs built on top of MerklPeople depositing rewards must have signed a `message` with the conditions for using the product\",\"kind\":\"dev\",\"methods\":{\"createDistribution((bytes32,address,address,uint256,address[],uint32[],uint32,uint32,uint32,uint32,uint32,uint32,uint32,address,bytes))\":{\"details\":\"If the address specified as a UniV3 pool is not effectively a pool, it will not be handled by the distribution script and rewards may be lostReward tokens sent as part of distributions must have been whitelisted before and amounts sent should be bigger than a minimum amount specific to each tokenThe `positionWrappers` specified in the `distribution` struct need to be supported by the script List of supported `positionWrappers` can be found in the docs.If the pool incentivized contains one whitelisted token, then no fees are taken on the rewardsThis function reverts if the sender has not signed the message `messageHash` once through one of the functions enabling to sign\",\"returns\":{\"distributionAmount\":\"How many reward tokens are actually taken into consideration in the contract\"}},\"createDistributions((bytes32,address,address,uint256,address[],uint32[],uint32,uint32,uint32,uint32,uint32,uint32,uint32,address,bytes)[])\":{\"returns\":{\"_0\":\"List of all the distribution amounts actually deposited for each `distribution` in the `distributions` list\"}},\"getActiveDistributions(uint32,uint32)\":{\"params\":{\"first\":\"Limit the length of the returned array to `first`\",\"skip\":\"Disregard distibutions with a global index lower than `skip`\"},\"returns\":{\"lastIndexDistribution\":\"Index of the last distribution assessed in the list of all distributions For pagniation purpose, in case of out of gas, you can call back the same function but with `skip` set to `lastIndexDistribution`\",\"searchDistributions\":\"Eligible distributions\"}},\"getActivePoolDistributions(address,uint32,uint32)\":{\"params\":{\"first\":\"Limit the length of the returned array to `first`\",\"skip\":\"Disregard distibutions with a global index lower than `skip`\"},\"returns\":{\"_0\":\"searchDistributions Eligible distributions\",\"lastIndexDistribution\":\"Index of the last distribution assessed in the list of all distributions For pagniation purpose, in case of out of gas, you can call back the same function but with `skip` set to `lastIndexDistribution`\"}},\"getDistributionsAfterEpoch(uint32,uint32,uint32)\":{\"params\":{\"first\":\"Limit the length of the returned array to `first`\",\"skip\":\"Disregard distibutions with a global index lower than `skip`\"},\"returns\":{\"_0\":\"searchDistributions Eligible distributions\",\"lastIndexDistribution\":\"Index of the last distribution assessed in the list of all distributions For pagniation purpose, in case of out of gas, you can call back the same function but with `skip` set to `lastIndexDistribution`\"}},\"getDistributionsBetweenEpochs(uint32,uint32)\":{\"details\":\"If a distribution starts during `epochEnd`, it is not be returned by this functionConversely, if a distribution starts after `epochStart` and ends before `epochEnd`, it is returned by this function\"},\"getDistributionsBetweenEpochs(uint32,uint32,uint32,uint32)\":{\"params\":{\"first\":\"Limit the length of the returned array to `first`\",\"skip\":\"Disregard distibutions with a global index lower than `skip`\"},\"returns\":{\"_0\":\"searchDistributions Eligible distributions\",\"lastIndexDistribution\":\"Index of the last distribution assessed in the list of all distributions For pagniation purpose, in case of out of gas, you can call back the same function but with `skip` set to `lastIndexDistribution`\"}},\"getDistributionsForEpoch(uint32,uint32,uint32)\":{\"params\":{\"first\":\"Limit the length of the returned array to `first`\",\"skip\":\"Disregard distibutions with a global index lower than `skip`\"},\"returns\":{\"_0\":\"searchDistributions Eligible distributions\",\"lastIndexDistribution\":\"Index of the last distribution assessed in the list of all distributions For pagniation purpose, in case of out of gas, you can call back the same function but with `skip` set to `lastIndexDistribution`\"}},\"getPoolDistributionsAfterEpoch(address,uint32,uint32,uint32)\":{\"params\":{\"first\":\"Limit the length of the returned array to `first`\",\"skip\":\"Disregard distibutions with a global index lower than `skip`\"},\"returns\":{\"_0\":\"searchDistributions Eligible distributions\",\"lastIndexDistribution\":\"Index of the last distribution assessed in the list of all distributions For pagniation purpose, in case of out of gas, you can call back the same function but with `skip` set to `lastIndexDistribution`\"}},\"getPoolDistributionsBetweenEpochs(address,uint32,uint32,uint32,uint32)\":{\"params\":{\"first\":\"Limit the length of the returned array to `first`\",\"skip\":\"Disregard distibutions with a global index lower than `skip`\"},\"returns\":{\"_0\":\"searchDistributions Eligible distributions\",\"lastIndexDistribution\":\"Index of the last distribution assessed in the list of all distributions For pagniation purpose, in case of out of gas, you can call back the same function but with `skip` set to `lastIndexDistribution`\"}},\"getPoolDistributionsForEpoch(address,uint32,uint32,uint32)\":{\"params\":{\"first\":\"Limit the length of the returned array to `first`\",\"skip\":\"Disregard distibutions with a global index lower than `skip`\"},\"returns\":{\"_0\":\"searchDistributions Eligible distributions\",\"lastIndexDistribution\":\"Index of the last distribution assessed in the list of all distributions For pagniation purpose, in case of out of gas, you can call back the same function but with `skip` set to `lastIndexDistribution`\"}},\"proxiableUUID()\":{\"details\":\"Implementation of the ERC1822 {proxiableUUID} function. This returns the storage slot used by the implementation. It is used to validate the implementation's compatibility when performing an upgrade. IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this function revert if invoked through a proxy. This is guaranteed by the `notDelegated` modifier.\"},\"sign(bytes)\":{\"details\":\"If you signed the message once, and the message has not been modified, then you do not need to sign again\"},\"upgradeTo(address)\":{\"details\":\"Upgrade the implementation of the proxy to `newImplementation`. Calls {_authorizeUpgrade}. Emits an {Upgraded} event.\"},\"upgradeToAndCall(address,bytes)\":{\"details\":\"Upgrade the implementation of the proxy to `newImplementation`, and subsequently execute the function call encoded in `data`. Calls {_authorizeUpgrade}. Emits an {Upgraded} event.\"}},\"stateVariables\":{\"distributionList\":{\"details\":\"An attacker could try to populate this list. It shouldn't be an issue as only view functions iterate on it\"},\"rewardTokenMinAmounts\":{\"details\":\"If `rewardTokenMinAmounts[token] == 0`, then `token` cannot be used as a reward\"}},\"title\":\"DistributionCreator\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"BASE_9()\":{\"notice\":\"Base for fee computation\"},\"EPOCH_DURATION()\":{\"notice\":\"Epoch duration\"},\"core()\":{\"notice\":\"`Core` contract handling access control\"},\"createDistribution((bytes32,address,address,uint256,address[],uint32[],uint32,uint32,uint32,uint32,uint32,uint32,uint32,address,bytes))\":{\"notice\":\"Creates a `distribution` to incentivize a given pool for a specific period of time\"},\"createDistributions((bytes32,address,address,uint256,address[],uint32[],uint32,uint32,uint32,uint32,uint32,uint32,uint32,address,bytes)[])\":{\"notice\":\"Same as the function above but for multiple distributions at once\"},\"distributionList(uint256)\":{\"notice\":\"List of all rewards ever distributed or to be distributed in the contract\"},\"distributor()\":{\"notice\":\"User contract for distributing rewards\"},\"feeRebate(address)\":{\"notice\":\"Maps an address to its fee rebate\"},\"feeRecipient()\":{\"notice\":\"Address to which fees are forwarded\"},\"fees()\":{\"notice\":\"Value (in base 10**9) of the fees taken when creating a distribution for a pool which do not have a whitelisted token in it\"},\"getActiveDistributions()\":{\"notice\":\"Returns the list of all currently active distributions on pools of supported AMMs (like Uniswap V3)\"},\"getActiveDistributions(uint32,uint32)\":{\"notice\":\"Similar to `getActiveDistributions()` with additional parameters to prevent out of gas error\"},\"getActivePoolDistributions(address)\":{\"notice\":\"Returns the list of all currently active distributions for a specific UniswapV3 pool\"},\"getActivePoolDistributions(address,uint32,uint32)\":{\"notice\":\"Similar to `getActivePoolDistributions(address uniV3Pool)` with additional parameters to prevent out of gas error\"},\"getAllDistributions()\":{\"notice\":\"Returns the list of all distributions ever made or to be done in the future\"},\"getDistributionsAfterEpoch(uint32)\":{\"notice\":\"Returns the list of all distributions that were or will be live after `epochStart` (included)\"},\"getDistributionsAfterEpoch(uint32,uint32,uint32)\":{\"notice\":\"Similar to `getDistributionsAfterEpoch(uint256 epochStart)` with additional parameters to prevent out of gas error\"},\"getDistributionsBetweenEpochs(uint32,uint32)\":{\"notice\":\"Gets the distributions that were or will be live at some point between `epochStart` (included) and `epochEnd` (excluded)\"},\"getDistributionsBetweenEpochs(uint32,uint32,uint32,uint32)\":{\"notice\":\"Similar to `getDistributionsBetweenEpochs(uint256 epochStart, uint256 epochEnd)` with additional parameters to prevent out of gas error\"},\"getDistributionsForEpoch(uint32)\":{\"notice\":\"Returns the list of all the distributions that were or that are going to be live at a specific epoch\"},\"getDistributionsForEpoch(uint32,uint32,uint32)\":{\"notice\":\"Similar to `getDistributionsForEpoch(uint256 epoch)` with additional parameters to prevent out of gas error\"},\"getExtensiveDistributionParameters((bytes32,address,address,uint256,address[],uint32[],uint32,uint32,uint32,uint32,uint32,uint32,uint32,address,bytes))\":{\"notice\":\"Fetches extra data about the parameters in a distribution\"},\"getPoolDistributionsAfterEpoch(address,uint32)\":{\"notice\":\"Returns the list of all distributions that were or will be live after `epochStart` (included) for a specific pool\"},\"getPoolDistributionsAfterEpoch(address,uint32,uint32,uint32)\":{\"notice\":\"Similar to `getPoolDistributionsAfterEpoch(address uniV3Pool,uint32 epochStart)` with additional parameters to prevent out of gas error\"},\"getPoolDistributionsBetweenEpochs(address,uint32,uint32)\":{\"notice\":\"Returns the list of all distributions that were or will be live at some point between `epochStart` (included) and `epochEnd` (excluded) for a specific pool\"},\"getPoolDistributionsBetweenEpochs(address,uint32,uint32,uint32,uint32)\":{\"notice\":\"Similar to `getPoolDistributionsBetweenEpochs(address uniV3Pool,uint32 epochStart, uint32 epochEnd)` with additional parameters to prevent out of gas error\"},\"getPoolDistributionsForEpoch(address,uint32)\":{\"notice\":\"Returns the list of all the distributions that were or that are going to be live at a specific epoch and for a specific pool\"},\"getPoolDistributionsForEpoch(address,uint32,uint32,uint32)\":{\"notice\":\"Similar to `getPoolDistributionsForEpoch(address uniV3Pool,uint32 epoch)` with additional parameters to prevent out of gas error\"},\"getValidRewardTokens()\":{\"notice\":\"Returns the list of all the reward tokens supported as well as their minimum amounts\"},\"isWhitelistedToken(address)\":{\"notice\":\"Maps a token to whether it is whitelisted or not. No fees are to be paid for incentives given on pools with whitelisted tokens\"},\"message()\":{\"notice\":\"Message that needs to be acknowledged by users creating a distribution\"},\"messageHash()\":{\"notice\":\"Hash of the message that needs to be signed\"},\"nonces(address)\":{\"notice\":\"Maps an address to its nonce for creating a distribution\"},\"recoverFees(address[],address)\":{\"notice\":\"Recovers fees accrued on the contract for a list of `tokens`\"},\"rewardTokenMinAmounts(address)\":{\"notice\":\"Maps a token to the minimum amount that must be sent per epoch for a distribution to be valid\"},\"rewardTokens(uint256)\":{\"notice\":\"List of all reward tokens that have at some point been accepted\"},\"setFeeRecipient(address)\":{\"notice\":\"Sets a new address to receive fees\"},\"setFees(uint256)\":{\"notice\":\"Sets the fees on deposit\"},\"setMessage(string)\":{\"notice\":\"Sets the message that needs to be signed by users before posting rewards\"},\"setNewDistributor(address)\":{\"notice\":\"Sets a new `distributor` to which rewards should be distributed\"},\"setRewardTokenMinAmounts(address[],uint256[])\":{\"notice\":\"Sets the minimum amounts per distribution epoch for different reward tokens\"},\"setUserFeeRebate(address,uint256)\":{\"notice\":\"Sets fee rebates for a given user\"},\"sign(bytes)\":{\"notice\":\"Checks whether the `msg.sender`'s `signature` is compatible with the message to sign and stores the signature\"},\"signAndCreateDistribution((bytes32,address,address,uint256,address[],uint32[],uint32,uint32,uint32,uint32,uint32,uint32,uint32,address,bytes),bytes)\":{\"notice\":\"Combines signing the message and creating a distribution\"},\"toggleSigningWhitelist(address)\":{\"notice\":\"Toggles the whitelist status for `user` when it comes to signing messages before depositing rewards.\"},\"toggleTokenWhitelist(address)\":{\"notice\":\"Toggles the fee whitelist for `token`\"},\"tryGetExtensiveDistributionParameters((bytes32,address,address,uint256,address[],uint32[],uint32,uint32,uint32,uint32,uint32,uint32,uint32,address,bytes))\":{\"notice\":\"Tries to fetch extra data about the parameters in a distribution\"},\"userSignatureWhitelist(address)\":{\"notice\":\"Maps a user to whether it is whitelisted for not signing\"},\"userSignatures(address)\":{\"notice\":\"Maps an address to the last valid hash signed\"}},\"notice\":\"Manages the distribution of rewards across different pools with concentrated liquidity (like on Uniswap V3)\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/DistributionCreator.sol\":\"DistributionCreator\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":100},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts-upgradeable/interfaces/draft-IERC1822Upgradeable.sol\":{\"keccak256\":\"0x77c89f893e403efc6929ba842b7ccf6534d4ffe03afe31670b4a528c0ad78c0f\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://496bd9b3df2455d571018c09f0c6badd29713fdeb907c6aa09d8d28cb603f053\",\"dweb:/ipfs/QmXdJDyYs6WMwMh21dez2BYPxhSUaUYFMDtVNcn2cgFR79\"]},\"@openzeppelin/contracts-upgradeable/proxy/ERC1967/ERC1967UpgradeUpgradeable.sol\":{\"keccak256\":\"0x315887e846f1e5f8d8fa535a229d318bb9290aaa69485117f1ee8a9a6b3be823\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://29dda00da6d269685b555e710e4abf1c3eb6d00c15b888a7880a2f8dd3c4fdc2\",\"dweb:/ipfs/QmSqcjtdECygtT1Gy7uEo42x8542srpgGEeKKHfcnQqXgn\"]},\"@openzeppelin/contracts-upgradeable/proxy/beacon/IBeaconUpgradeable.sol\":{\"keccak256\":\"0x24b86ac8c005b8c654fbf6ac34a5a4f61580d7273541e83e013e89d66fbf0908\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://4dbfe1a3b3b3fb64294ce41fd2ad362e7b7012208117864f42c1a67620a6d5c1\",\"dweb:/ipfs/QmVMU5tWt7zBQMmf5cpMX8UMHV86T3kFeTxBTBjFqVWfoJ\"]},\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\":{\"keccak256\":\"0x037c334add4b033ad3493038c25be1682d78c00992e1acb0e2795caff3925271\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://8a313cf42389440e2706837c91370323b85971c06afd6d056d21e2bc86459618\",\"dweb:/ipfs/QmT8XUrUvQ9aZaPKrqgRU2JVGWnaxBcUYJA7Q7K5KcLBSZ\"]},\"@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol\":{\"keccak256\":\"0x7967d130887c4b40666cd88f8744691d4527039a1b2a38aa0de41481ef646778\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://40e60cbf0e2efede4d9c169e66336a64615af7b719a896ef1f37ae8cd4614ec1\",\"dweb:/ipfs/QmYNiwY22ifhfa8yK6mLCEKfj39caYUHLqe2VBtzDnvdsV\"]},\"@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol\":{\"keccak256\":\"0x2b3005a0064cfc558bdf64b2bae94b565f4574a536aadd61c13838d4f2157790\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://622c3eb87563e71585c9f538d1a196fe2d154dcc5b8f335e8770a8acc95e1f3a\",\"dweb:/ipfs/QmSnDqJJLzv3mirjGB1vrk5X7hegFdS7BKpscpxyqj7sWu\"]},\"@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol\":{\"keccak256\":\"0x2edcb41c121abc510932e8d83ff8b82cf9cdde35e7c297622f5c29ef0af25183\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://72460c66cd1c3b1c11b863e0d8df0a1c56f37743019e468dc312c754f43e3b06\",\"dweb:/ipfs/QmPExYKiNb9PUsgktQBupPaM33kzDHxaYoVeJdLhv8s879\"]},\"@openzeppelin/contracts-upgradeable/utils/StorageSlotUpgradeable.sol\":{\"keccak256\":\"0x09864aea84f01e39313375b5610c73a3c1c68abbdc51e5ccdd25ff977fdadf9a\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://aedb48081190fa828d243529ce25c708202c7d4ccfe99f0e4ecd6bc0cfcd03f3\",\"dweb:/ipfs/QmWyiDQHPZA56iqsAwTmiJoxvNeRQLUVr4gTfzpdpXivpo\"]},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"keccak256\":\"0x9750c6b834f7b43000631af5cc30001c5f547b3ceb3635488f140f60e897ea6b\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://5a7d5b1ef5d8d5889ad2ed89d8619c09383b80b72ab226e0fe7bde1636481e34\",\"dweb:/ipfs/QmebXWgtEfumQGBdVeM6c71McLixYXQP5Bk6kKXuoY4Bmr\"]},\"@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol\":{\"keccak256\":\"0x8de418a5503946cabe331f35fe242d3201a73f67f77aaeb7110acb1f30423aca\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://5a376d3dda2cb70536c0a45c208b29b34ac560c4cb4f513a42079f96ba47d2dd\",\"dweb:/ipfs/QmZQg6gn1sUpM8wHzwNvSnihumUCAhxD119MpXeKp8B9s8\"]},\"@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol\":{\"keccak256\":\"0xf41ca991f30855bf80ffd11e9347856a517b977f0a6c2d52e6421a99b7840329\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://b2717fd2bdac99daa960a6de500754ea1b932093c946388c381da48658234b95\",\"dweb:/ipfs/QmP6QVMn6UeA3ByahyJbYQr5M6coHKBKsf3ySZSfbyA8R7\"]},\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\":{\"keccak256\":\"0x9b72f93be69ca894d8492c244259615c4a742afc8d63720dbc8bb81087d9b238\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://f5a7b96e511be78d5cdf635c784e6ab8cdd38625bb8cafb8a80914a1c89cf0f6\",\"dweb:/ipfs/QmVzTCwJxQAkjRQHboT5QrvsVJGWQHgfEjeTbvyxoKBrds\"]},\"@openzeppelin/contracts/utils/Address.sol\":{\"keccak256\":\"0xf96f969e24029d43d0df89e59d365f277021dac62b48e1c1e3ebe0acdd7f1ca1\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://ec772b45a624be516f1c81970caa8a2e144301e9d0921cbc1a2789fef39a1269\",\"dweb:/ipfs/QmNyjwxCrGhQMyzLD93oUobJXVe9ceJvRvfXwbEtuxPiEj\"]},\"@openzeppelin/contracts/utils/Strings.sol\":{\"keccak256\":\"0xa4d1d62251f8574deb032a35fc948386a9b4de74b812d4f545a1ac120486b48a\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://8c969013129ba9e651a20735ef659fef6d8a1139ea3607bd4b26ddea2d645634\",\"dweb:/ipfs/QmVhVa6LGuzAcB8qgDtVHRkucn4ihj5UZr8xBLcJkP6ucb\"]},\"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\":{\"keccak256\":\"0xda898fa084aa1ddfdb346e6a40459e00a59d87071cce7c315a46d648dd71d0ba\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://ce501a941f4aa1555c04dabb5e07992503bb6a9b32ff8f7cdcefdb4a742210cb\",\"dweb:/ipfs/QmeScPrUpdrGYs9BytV3Z5ZWJcBXtuAgCW4BLHua4xFUxx\"]},\"@openzeppelin/contracts/utils/math/Math.sol\":{\"keccak256\":\"0xa1e8e83cd0087785df04ac79fb395d9f3684caeaf973d9e2c71caef723a3a5d6\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://33bbf48cc069be677705037ba7520c22b1b622c23b33e1a71495f2d36549d40b\",\"dweb:/ipfs/Qmct36zWXv3j7LZB83uwbg7TXwnZSN1fqHNDZ93GG98bGz\"]},\"contracts/DistributionCreator.sol\":{\"keccak256\":\"0x6206a0425bde62264e0e250a94e72ff6145f79ce0eeb6cd33cb279536a40d336\",\"license\":\"BUSL-1.1\",\"urls\":[\"bzz-raw://7f8f4f7ce914408ce1aa8332bfae69a9f5f3a9f7e5eec1e2941a11f2a093891d\",\"dweb:/ipfs/QmUEPRnwZs3sVqt9tZnreR4ucHwSpWQY7f8qoEjUfX4hK6\"]},\"contracts/interfaces/ICore.sol\":{\"keccak256\":\"0x11e92b745193d16934aaeb873c0388041dce2ef3e359a9c3315b668b05903100\",\"license\":\"GPL-3.0\",\"urls\":[\"bzz-raw://2958b2c0b9b0365a3ddf0d39c3623c4b41cf9d1797d4aeee3bfd02ad255692d9\",\"dweb:/ipfs/QmUkyhLEfW3YfVKcnZ3CxBQj33EdBKsx5rijkezNmGVALL\"]},\"contracts/interfaces/external/uniswap/IUniswapV3Pool.sol\":{\"keccak256\":\"0x7035bcab3bfd00a984c1bedd1f78a6cd358a423a60f40666837b740dd2f73fe1\",\"license\":\"GPL-3.0\",\"urls\":[\"bzz-raw://3bbeeb4bd1317b6f1f1600e8b34960d41e91175c0008fb54eb5d15bef66b5b4f\",\"dweb:/ipfs/QmWtDrwF9WDMWbZCGTrXnk4yqynE9Pa1Zg3Ari1h4bbH5W\"]},\"contracts/struct/DistributionParameters.sol\":{\"keccak256\":\"0x9016781bc2054ab54b6efa88c63b029e916d32c747eb68797a0d2e1e87c32a17\",\"license\":\"BUSL-1.1\",\"urls\":[\"bzz-raw://284bd75af1c924723af7b2a21f5dc464477502b3fcde86e0077c6e9ace0a9007\",\"dweb:/ipfs/QmdCwWGQRhwkB8WjUG26TAtb5oqWmrBztqfVATZ4t8C75e\"]},\"contracts/struct/ExtensiveDistributionParameters.sol\":{\"keccak256\":\"0xeef63ebff3bb084f84a40268b06ab2788a161e5da92e0fdaac01658cc017939a\",\"license\":\"BUSL-1.1\",\"urls\":[\"bzz-raw://5872b78b62038a41f3e26384ed3e5d81941410177f16cd61fc752d6cb9889c82\",\"dweb:/ipfs/QmaACJ2SNNUtwFer3EqyG3nVSvD7rDZjjnJfp2FpwJ48oV\"]},\"contracts/struct/RewardTokenAmounts.sol\":{\"keccak256\":\"0x76b12fb56b989673bcead693bc7d925f21b8ab3b9c5e900fe8e8b42d85286f1d\",\"license\":\"BUSL-1.1\",\"urls\":[\"bzz-raw://f1f2c214dba600b041f9cb380350caa391213beada03b549b3e95c0ac3cb17ca\",\"dweb:/ipfs/QmR3deQ7bd1Ys3YQpF7DVkduNVMv3naKnkALepNaxqD1ih\"]},\"contracts/utils/Errors.sol\":{\"keccak256\":\"0x7cd16f5988dee579532a71ff4afd8668c75add546e7e4724c1aaadd888355139\",\"license\":\"GPL-3.0\",\"urls\":[\"bzz-raw://b3cbf955071047ef422c3d4107e3dc0dc2459e3de14d434c069b502cae4c578c\",\"dweb:/ipfs/QmcutpxLceyCRUg8E3krJnn1oKdbp71RpQb63onPT3Akym\"]},\"contracts/utils/UUPSHelper.sol\":{\"keccak256\":\"0xb8011db6d148c8a111678c8074343c82114b923806aee0f60c48ed05f8bd6c40\",\"license\":\"GPL-3.0\",\"urls\":[\"bzz-raw://50c3ecca8c5e46c57a3abc32bb4e74c5983f83722842018715ced14b68528efd\",\"dweb:/ipfs/QmYBTwe1sCieZ3nBLUc3zq1x78rBB9rRDVo9LSDnMTySdv\"]}},\"version\":1}", + "bytecode": "0x60a0604052306080523480156200001557600080fd5b50600054610100900460ff1615808015620000375750600054600160ff909116105b8062000067575062000054306200022060201b620025051760201c565b15801562000067575060005460ff166001145b620000bf5760405162461bcd60e51b815260206004820152602e6024820152600080516020620059fb83398151915260448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084015b60405180910390fd5b6000805460ff191660011790558015620000e3576000805461ff0019166101001790555b801562000119576000805461ff00191690556040516001815260008051602062005a1b8339815191529060200160405180910390a15b50600054610100900460ff16158080156200013b5750600054600160ff909116105b806200016b575062000158306200022060201b620025051760201c565b1580156200016b575060005460ff166001145b620001bf5760405162461bcd60e51b815260206004820152602e6024820152600080516020620059fb83398151915260448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401620000b6565b6000805460ff191660011790558015620001e3576000805461ff0019166101001790555b801562000219576000805461ff00191690556040516001815260008051602062005a1b8339815191529060200160405180910390a15b506200022f565b6001600160a01b03163b151590565b608051615794620002676000396000818161121501528181611255015281816114da0152818161151a015261159601526157946000f3fe6080604052600436106102ca5760003560e01c80637bb7bed11161017b578063b9d81abc116100d7578063e1394f7d11610085578063e1394f7d14610922578063e21f37ce14610942578063e74b981b14610964578063f2f4eb2614610984578063f6e6bb62146109a4578063fb1d2329146109c4578063feba1ed2146109e457600080fd5b8063b9d81abc1461080e578063ba5c3a9d1461082e578063bfe1092814610867578063c14007a014610887578063c53e7dab146108b5578063d0ff94b2146108d5578063d7fa5625146108f557600080fd5b80639af1d35a116101345780639af1d35a14610720578063a218404014610736578063a2686e2314610756578063a70b9f0c14610776578063aa529617146107a1578063ab37f486146107c1578063ae23bf28146107ee57600080fd5b80637bb7bed1146106445780637ecebe00146106645780638a4bd4b21461069157806392ccb581146106b157806395d3d5d8146106d157806396b3ce54146106f357600080fd5b80633d18678e1161022a57806358beb884116101e357806358beb8841461055d5780636c1550b11461057d5780636cca84bd146105aa578063734e7fb9146105ca578063752e8749146105ea57806376cd7cbc146106025780637b74691e1461062257600080fd5b80633d18678e146104a857806346904840146104c85780634d5aedbf146104f55780634f1ef2861461051557806352d1902d14610528578063586db1f51461053d57600080fd5b806317418a221161028757806317418a22146103c25780631794bb3c146103d75780632acd7ec4146103f7578063304440171461043257806334f150b7146104485780633659cfe614610468578063368b87721461048857600080fd5b80630241d8f9146102cf57806303d2944c146102f15780630db38252146103115780630f44380d146103475780631136b89514610374578063141df503146103a2575b600080fd5b3480156102db57600080fd5b506102ef6102ea366004613f96565b610a11565b005b3480156102fd57600080fd5b506102ef61030c366004613fc2565b610af8565b34801561031d57600080fd5b5061033161032c36600461436e565b610bf7565b60405161033e919061466d565b60405180910390f35b34801561035357600080fd5b50610367610362366004614680565b610e2e565b60405161033e91906146f2565b34801561038057600080fd5b5061039461038f366004614705565b610e56565b60405161033e929190614750565b3480156103ae57600080fd5b506102ef6103bd3660046147b6565b610e8c565b3480156103ce57600080fd5b50610367611003565b3480156103e357600080fd5b506102ef6103f2366004614801565b611030565b34801561040357600080fd5b50610424610412366004613fc2565b60a36020526000908152604090205481565b60405190815260200161033e565b34801561043e57600080fd5b50610424609c5481565b34801561045457600080fd5b50610394610463366004614842565b6111dc565b34801561047457600080fd5b506102ef610483366004613fc2565b61120b565b34801561049457600080fd5b506102ef6104a336600461487b565b6112d3565b3480156104b457600080fd5b506102ef6104c33660046148c3565b6113b8565b3480156104d457600080fd5b506099546104e8906001600160a01b031681565b60405161033e91906148dc565b34801561050157600080fd5b506103946105103660046148f0565b6114a5565b6102ef61052336600461494c565b6114d0565b34801561053457600080fd5b50610424611589565b34801561054957600080fd5b5061039461055836600461499b565b611637565b34801561056957600080fd5b506104246105783660046149fd565b611659565b34801561058957600080fd5b5061059d610598366004614a65565b611678565b60405161033e9190614b15565b3480156105b657600080fd5b506102ef6105c5366004613fc2565b6117a1565b3480156105d657600080fd5b506103676105e5366004614842565b6118a4565b3480156105f657600080fd5b50610424633b9aca0081565b34801561060e57600080fd5b506102ef61061d366004614b59565b6118c5565b34801561062e57600080fd5b506106376118cf565b60405161033e9190614b9a565b34801561065057600080fd5b506104e861065f3660046148c3565b611b52565b34801561067057600080fd5b5061042461067f366004613fc2565b60a06020526000908152604090205481565b34801561069d57600080fd5b506103676106ac366004613fc2565b611b7c565b3480156106bd57600080fd5b506103946106cc366004614bfc565b611b9c565b3480156106dd57600080fd5b506106e6611bbd565b60405161033e9190614c1c565b3480156106ff57600080fd5b5061042461070e366004613fc2565b60a16020526000908152604090205481565b34801561072c57600080fd5b50610424609a5481565b34801561074257600080fd5b506102ef610751366004614c67565b611cde565b34801561076257600080fd5b506102ef610771366004613fc2565b611f30565b34801561078257600080fd5b5061078c610e1081565b60405163ffffffff909116815260200161033e565b3480156107ad57600080fd5b506103946107bc3660046148f0565b612033565b3480156107cd57600080fd5b506104246107dc366004613fc2565b609f6020526000908152604090205481565b3480156107fa57600080fd5b50610367610809366004614cd2565b612062565b34801561081a57600080fd5b5061042461082936600461436e565b61208b565b34801561083a57600080fd5b5061084e6108493660046148c3565b61211c565b60405161033e9d9c9b9a99989796959493929190614cf0565b34801561087357600080fd5b506098546104e8906001600160a01b031681565b34801561089357600080fd5b506108a76108a236600461436e565b612249565b60405161033e929190614d9c565b3480156108c157600080fd5b506103946108d0366004614db7565b612323565b3480156108e157600080fd5b506103676108f0366004614cd2565b612342565b34801561090157600080fd5b50610424610910366004613fc2565b60a26020526000908152604090205481565b34801561092e57600080fd5b5061036761093d366004614680565b612351565b34801561094e57600080fd5b50610957612372565b60405161033e9190614e28565b34801561097057600080fd5b506102ef61097f366004613fc2565b612400565b34801561099057600080fd5b506097546104e8906001600160a01b031681565b3480156109b057600080fd5b506103946109bf366004614705565b6124d8565b3480156109d057600080fd5b506103676109df366004614bfc565b6124f6565b3480156109f057600080fd5b506104246109ff366004613fc2565b609e6020526000908152604090205481565b60975460405163521d4de960e01b81526001600160a01b039091169063521d4de990610a419033906004016148dc565b602060405180830381865afa158015610a5e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a829190614e4b565b610a9f57604051632678482f60e21b815260040160405180910390fd5b6001600160a01b0382166000818152609e602052604090819020839055517fab1d37d0b21937f334fc4164d147abbfdbfd7ef37ab9ea0ae73f2a58ffb7f1cc90610aec9084815260200190565b60405180910390a25050565b60975460405163521d4de960e01b81526001600160a01b039091169063521d4de990610b289033906004016148dc565b602060405180830381865afa158015610b45573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b699190614e4b565b610b8657604051632678482f60e21b815260040160405180910390fd5b6001600160a01b038116610bad57604051633494a40d60e21b815260040160405180910390fd5b609880546001600160a01b0319166001600160a01b0383169081179091556040517fc0ebb188f905d128bcd7e4282dd1f9cf24cd331b69071002e488349aca6a867b90600090a250565b610bff613d6c565b81816000018190525081602001516001600160a01b031663ddca3f436040518163ffffffff1660e01b8152600401602060405180830381865afa925050508015610c66575060408051601f3d908101601f19168201909252610c6391810190614e79565b60015b610c765760006020820152610c81565b62ffffff1660208201525b610cf482602001516001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa158015610cc6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cea9190614e9f565b8360200151612514565b8160400181905250610d4182602001516001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa158015610cc6573d6000803e3d6000fd5b816060018190525081604001516001600160a01b03166395d89b416040518163ffffffff1660e01b8152600401600060405180830381865afa158015610d8b573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610db39190810190614f01565b816080018190525081604001516001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015610dfd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e219190614f46565b60ff1660a0820152919050565b6060610e4f6000610e3e8461267c565b63ffffffff600063ffffffff612695565b5092915050565b6060600080610e648661267c565b9050610e7f600082610e78610e1082614f77565b8888612695565b9250925050935093915050565b60975460405163521d4de960e01b81526001600160a01b039091169063521d4de990610ebc9033906004016148dc565b602060405180830381865afa158015610ed9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610efd9190614e4b565b610f1a57604051632678482f60e21b815260040160405180910390fd5b8160005b81811015610ffc57610ff483868684818110610f3c57610f3c614f94565b9050602002016020810190610f519190613fc2565b6001600160a01b03166370a08231306040518263ffffffff1660e01b8152600401610f7c91906148dc565b602060405180830381865afa158015610f99573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fbd9190614faa565b878785818110610fcf57610fcf614f94565b9050602002016020810190610fe49190613fc2565b6001600160a01b03169190612a9c565b600101610f1e565b5050505050565b606060006110104261267c565b9050610e4f600082611024610e1082614f77565b600063ffffffff612695565b600054610100900460ff16158080156110505750600054600160ff909116105b80611071575061105f30612505565b158015611071575060005460ff166001145b6110d95760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084015b60405180910390fd5b6000805460ff1916600117905580156110fc576000805461ff0019166101001790555b6001600160a01b038416158061111957506001600160a01b038316155b156111375760405163d92e233d60e01b815260040160405180910390fd5b633b9aca00821061115b57604051633494a40d60e21b815260040160405180910390fd5b609880546001600160a01b038086166001600160a01b0319928316179092556097805492871692909116919091179055609a82905580156111d6576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50505050565b60606000806111ea4261267c565b90506111fe600082610e78610e1082614f77565b92509250505b9250929050565b6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001630036112535760405162461bcd60e51b81526004016110d090614fc3565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316611285612b04565b6001600160a01b0316146112ab5760405162461bcd60e51b81526004016110d09061500f565b6112b481612b20565b604080516000808252602082019092526112d091839190612bc3565b50565b60975460405163521d4de960e01b81526001600160a01b039091169063521d4de9906113039033906004016148dc565b602060405180830381865afa158015611320573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113449190614e4b565b61136157604051632678482f60e21b815260040160405180910390fd5b609b61136d82826150db565b50600061137982612d2e565b609c8190556040518181529091507fde3dc3335dea4d1a1060ef6cefcfcc109eb0a1e78ce151818d3f17a01e1f8a059060200160405180910390a15050565b60975460405163521d4de960e01b81526001600160a01b039091169063521d4de9906113e89033906004016148dc565b602060405180830381865afa158015611405573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114299190614e4b565b61144657604051632678482f60e21b815260040160405180910390fd5b633b9aca00811061146a57604051633494a40d60e21b815260040160405180910390fd5b609a8190556040518181527f3346af6da1932164d501f2ec28f8c5d686db5828a36b77f2da4332d89184fe7b9060200160405180910390a150565b606060006114c2866114b68761267c565b63ffffffff8787612695565b915091505b94509492505050565b6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001630036115185760405162461bcd60e51b81526004016110d090614fc3565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031661154a612b04565b6001600160a01b0316146115705760405162461bcd60e51b81526004016110d09061500f565b61157982612b20565b61158582826001612bc3565b5050565b6000306001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146116245760405162461bcd60e51b815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c6044820152771b1959081d1a1c9bdd59da0819195b1959d85d1958d85b1b60421b60648201526084016110d0565b5060008051602061571883398151915290565b606060006114c260006116498861267c565b6116528861267c565b8787612695565b60006116658383612d69565b61166e84612e25565b90505b9392505050565b33600090815260a260205260409020546060901580156116a95750609c5433600090815260a1602052604090205414155b80156116c2575032600090815260a26020526040902054155b80156116df5750609c5432600090815260a1602052604090205414155b156116fd576040516314e52a5b60e31b815260040160405180910390fd5b81516000816001600160401b0381111561171957611719613fdf565b604051908082528060200260200182016040528015611742578160200160208202803683370190505b50905060005b828110156117975761177285828151811061176557611765614f94565b6020026020010151612e25565b82828151811061178457611784614f94565b6020908102919091010152600101611748565b509150505b919050565b60975460405163521d4de960e01b81526001600160a01b039091169063521d4de9906117d19033906004016148dc565b602060405180830381865afa1580156117ee573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118129190614e4b565b61182f57604051632678482f60e21b815260040160405180910390fd5b6001600160a01b0381166000908152609f602052604081205461185390600161519a565b6001600160a01b0383166000818152609f60205260409081902083905551919250907fc6cd32b1acffa550abf886a9b443ff3ce485bfdb05e35ef5b26e745739a1eac190610aec9084815260200190565b60606118bd60006118b48561267c565b6110248561267c565b509392505050565b6115858282612d69565b6060609d805480602002602001604051908101604052809291908181526020016000905b82821015611b49576000848152602090819020604080516101e081018252600986029092018054835260018101546001600160a01b039081168486015260028201541683830152600381015460608401526004810180548351818702810187019094528084529394919360808601939283018282801561199c57602002820191906000526020600020905b81546001600160a01b0316815260019091019060200180831161197e575b5050505050815260200160058201805480602002602001604051908101604052809291908181526020018280548015611a2057602002820191906000526020600020906000905b82829054906101000a900463ffffffff1663ffffffff16815260200190600401906020826003010492830192600103820291508084116119e35790505b5050509183525050600682015463ffffffff8082166020840152600160201b820481166040840152600160401b820481166060840152600160601b820481166080840152600160801b8204811660a0840152600160a01b8204811660c0840152600160c01b9091041660e082015260078201546001600160a01b031661010082015260088201805461012090920191611ab89061505b565b80601f0160208091040260200160405190810160405280929190818152602001828054611ae49061505b565b8015611b315780601f10611b0657610100808354040283529160200191611b31565b820191906000526020600020905b815481529060010190602001808311611b1457829003601f168201915b505050505081525050815260200190600101906118f3565b50505050905090565b60a48181548110611b6257600080fd5b6000918252602090912001546001600160a01b0316905081565b60606000611b894261267c565b90506117978382611024610e1082614f77565b6060600080611baa4261267c565b9050610e7f8682610e78610e1082614f77565b60a45460609060009081816001600160401b03811115611bdf57611bdf613fdf565b604051908082528060200260200182016040528015611c2457816020015b6040805180820190915260008082526020820152815260200190600190039081611bfd5790505b50905060005b828163ffffffff161015611cd457600060a48263ffffffff1681548110611c5357611c53614f94565b60009182526020808320909101546001600160a01b031680835260a39091526040909120549091508015611cca576040518060400160405280836001600160a01b0316815260200182815250848781518110611cb157611cb1614f94565b6020908102919091010152611cc76001876151ad565b95505b5050600101611c2a565b5091825250919050565b60975460405163521d4de960e01b81526001600160a01b039091169063521d4de990611d0e9033906004016148dc565b602060405180830381865afa158015611d2b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d4f9190614e4b565b611d6c57604051632678482f60e21b815260040160405180910390fd5b82818114611d8d57604051631df89e8b60e01b815260040160405180910390fd5b60005b81811015611f28576000848483818110611dac57611dac614f94565b905060200201359050600081118015611e07575060a36000888885818110611dd657611dd6614f94565b9050602002016020810190611deb9190613fc2565b6001600160a01b03168152602081019190915260400160002054155b15611e685760a4878784818110611e2057611e20614f94565b9050602002016020810190611e359190613fc2565b81546001810183556000928352602090922090910180546001600160a01b0319166001600160a01b039092169190911790555b8060a36000898986818110611e7f57611e7f614f94565b9050602002016020810190611e949190613fc2565b6001600160a01b03168152602081019190915260400160002055868683818110611ec057611ec0614f94565b9050602002016020810190611ed59190613fc2565b6001600160a01b03167f3a5e6418e38cae10bf66eaf3e68c4e9c6b14df195e24fec169ab3a5b123c96e582604051611f0f91815260200190565b60405180910390a250611f21816151c0565b9050611d90565b505050505050565b60975460405163521d4de960e01b81526001600160a01b039091169063521d4de990611f609033906004016148dc565b602060405180830381865afa158015611f7d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fa19190614e4b565b611fbe57604051632678482f60e21b815260040160405180910390fd5b6001600160a01b038116600090815260a26020526040812054611fe290600161519a565b6001600160a01b038316600081815260a260205260409081902083905551919250907f9c759941da0b7ce56c059c1497218796e62035024afb77a00ff49a980a62078f90610aec9084815260200190565b60606000806120418661267c565b90506120548782610e78610e1082614f77565b925092505094509492505050565b6060600061206f8361267c565b90506120828482611024610e1082614f77565b50949350505050565b33600090815260a260205260408120541580156120b95750609c5433600090815260a1602052604090205414155b80156120d2575032600090815260a26020526040902054155b80156120ef5750609c5432600090815260a1602052604090205414155b1561210d576040516314e52a5b60e31b815260040160405180910390fd5b61211682612e25565b92915050565b609d818154811061212c57600080fd5b600091825260209091206009909102018054600182015460028301546003840154600685015460078601546008870180549698506001600160a01b039586169794861696939563ffffffff80851696600160201b8604821696600160401b8704831696600160601b8104841696600160801b8204851696600160a01b8304861696600160c01b90930490951694911692916121c69061505b565b80601f01602080910402602001604051908101604052809291908181526020018280546121f29061505b565b801561223f5780601f106122145761010080835404028352916020019161223f565b820191906000526020600020905b81548152906001019060200180831161222257829003601f168201915b505050505090508d565b6000612253613d6c565b600080306001600160a01b0316630db3825260e01b8660405160240161227991906151d9565b60408051601f198184030181529181526020820180516001600160e01b03166001600160e01b03199094169390931790925290516122b791906151ec565b600060405180830381855af49150503d80600081146122f2576040519150601f19603f3d011682016040523d82523d6000602084013e6122f7565b606091505b5091509150819350831561231c578080602001905181019061231991906155a3565b92505b5050915091565b60606000612334876116498861267c565b915091509550959350505050565b60606118bd83610e3e8461267c565b6060600061235e8361267c565b9050611797600082611024610e1082614f77565b609b805461237f9061505b565b80601f01602080910402602001604051908101604052809291908181526020018280546123ab9061505b565b80156123f85780601f106123cd576101008083540402835291602001916123f8565b820191906000526020600020905b8154815290600101906020018083116123db57829003601f168201915b505050505081565b60975460405163521d4de960e01b81526001600160a01b039091169063521d4de9906124309033906004016148dc565b602060405180830381865afa15801561244d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124719190614e4b565b61248e57604051632678482f60e21b815260040160405180910390fd5b609980546001600160a01b0319166001600160a01b0383169081179091556040517f7a7b5a0a132f9e0581eb8527f66eae9ee89c2a3e79d4ac7e41a1f1f4d48a7fc290600090a250565b606060006124ea60006114b68761267c565b91509150935093915050565b6060612082846118b48561267c565b6001600160a01b03163b151590565b61251c613e22565b6001600160a01b0383168082526040805163313ce56760e01b8152905163313ce567916004808201926020929091908290030181865afa158015612564573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125889190614f46565b60ff166020820152604080516395d89b4160e01b815290516001600160a01b038516916395d89b419160048083019260009291908290030181865afa1580156125d5573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526125fd9190810190614f01565b604080830191909152516370a0823160e01b81526001600160a01b038416906370a08231906126309085906004016148dc565b602060405180830381865afa15801561264d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126719190614faa565b606082015292915050565b6000610e1061268b81846155ed565b6121169190615610565b609d5460609060009081908163ffffffff861682106126ba578563ffffffff166126bc565b815b90506000816001600160401b038111156126d8576126d8613fdf565b60405190808252806020026020018201604052801561271157816020015b6126fe613d6c565b8152602001906001900390816126f65790505b509050875b838163ffffffff161015612a82576000609d8263ffffffff168154811061273f5761273f614f94565b6000918252602091829020604080516101e08101825260099093029091018054835260018101546001600160a01b03908116848601526002820154168383015260038101546060840152600481018054835181870281018701909452808452939491936080860193928301828280156127e157602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116127c3575b505050505081526020016005820180548060200260200160405190810160405280929190818152602001828054801561286557602002820191906000526020600020906000905b82829054906101000a900463ffffffff1663ffffffff16815260200190600401906020826003010492830192600103820291508084116128285790505b5050509183525050600682015463ffffffff8082166020840152600160201b820481166040840152600160401b820481166060840152600160601b820481166080840152600160801b8204811660a0840152600160a01b8204811660c0840152600160c01b9091041660e082015260078201546001600160a01b0316610100820152600882018054610120909201916128fd9061505b565b80601f01602080910402602001604051908101604052809291908181526020018280546129299061505b565b80156129765780601f1061294b57610100808354040283529160200191612976565b820191906000526020600020905b81548152906001019060200180831161295957829003601f168201915b505050505081525050905061298c818d8d613465565b80156129be57506001600160a01b038d1615806129be57508c6001600160a01b031681602001516001600160a01b0316145b15612a695760405163060a003d60e51b81526000908190309063c14007a0906129eb9086906004016151d9565b600060405180830381865afa158015612a08573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052612a309190810190615638565b915091508115612a665780858981518110612a4d57612a4d614f94565b6020908102919091010152612a636001896151ad565b97505b50505b816001019150838603612a7c5750612a82565b50612716565b9381529a63ffffffff909316995091975050505050505050565b6040516001600160a01b038316602482015260448101829052612aff90849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526134bb565b505050565b600080516020615718833981519152546001600160a01b031690565b6097546001600160a01b03168015801590612ba5575060405163521d4de960e01b81526001600160a01b0382169063521d4de990612b629033906004016148dc565b602060405180830381865afa158015612b7f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612ba39190614e4b565b155b1561158557604051632678482f60e21b815260040160405180910390fd5b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff1615612bf657612aff8361358d565b826001600160a01b03166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa925050508015612c50575060408051601f3d908101601f19168201909252612c4d91810190614faa565b60015b612cb35760405162461bcd60e51b815260206004820152602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201526d6f6e206973206e6f74205555505360901b60648201526084016110d0565b6000805160206157188339815191528114612d225760405162461bcd60e51b815260206004820152602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f786044820152681a58589b195555525160ba1b60648201526084016110d0565b50612aff838383613627565b6000612d3a825161364c565b82604051602001612d4c92919061567b565b604051602081830303815290604052805190602001209050919050565b609c54604080516020601f85018190048102820181019092528381523391612dad91849187908790819084018382808284376000920191909152506136de92505050565b6001600160a01b031614612dd457604051638baa579f60e01b815260040160405180910390fd5b33600081815260a1602052604090819020839055517fc48bbd4f009ad78a336beb65bf44688651e9aa52ac98d9054f0fce0573fefbc390612e189084815260200190565b60405180910390a2505050565b6000612e2f6136fa565b6000612e3f83610120015161267c565b6040808501516001600160a01b0316600090815260a3602052205463ffffffff821661012086015290915042612e77610e1084614f77565b63ffffffff161080612e92575061014084015163ffffffff16155b80612ec857508360e001518460c00151856101000151612eb29190614f77565b612ebc9190614f77565b63ffffffff1661271014155b80612ef757506101a08401516001600160a01b031615801590612ef7575061271084610180015163ffffffff16105b80612f0c57508360a001515184608001515114155b80612f15575080155b80612f3957508084610140015163ffffffff168560600151612f3791906156d6565b105b15612f57576040516314414f4160e11b815260040160405180910390fd5b6060840151336000908152609e6020526040902054909350633b9aca00811080156130035750609f600086602001516001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa158015612fc3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612fe79190614e9f565b6001600160a01b03168152602081019190915260400160002054155b80156130905750609f600086602001516001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa158015613050573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906130749190614e9f565b6001600160a01b03168152602081019190915260400160002054155b15613134576000633b9aca006130a6838261519a565b609a546130b391906156ea565b6130bd91906156d6565b90506000633b9aca006130d0838261519a565b6130da90886156ea565b6130e491906156d6565b6099549091506001600160a01b031680156130ff5780613101565b305b90506131283382613112858b61519a565b60408c01516001600160a01b0316929190613753565b50606087018190529450505b6098546040860151613155916001600160a01b039182169133911687613753565b33600090815260a060205260409020546131708160016151ad565b33600081815260a0602090815260409182902093909355516131b19284910160609290921b6bffffffffffffffffffffffff19168252601482015260340190565b60408051808303601f1901815291815281516020928301208852609d805460018101825560009190915288517fd26e832454299e9fabb89e0e5fffdc046d4e14431bc1bf607ffb2e8a1ddecf7b6009909202918201908155898401517fd26e832454299e9fabb89e0e5fffdc046d4e14431bc1bf607ffb2e8a1ddecf7c830180546001600160a01b03199081166001600160a01b0393841617909155938b01517fd26e832454299e9fabb89e0e5fffdc046d4e14431bc1bf607ffb2e8a1ddecf7d8401805490951691161790925560608901517fd26e832454299e9fabb89e0e5fffdc046d4e14431bc1bf607ffb2e8a1ddecf7e820155608089015180518a946132df937fd26e832454299e9fabb89e0e5fffdc046d4e14431bc1bf607ffb2e8a1ddecf7f01920190613e56565b5060a082015180516132fb916005840191602090910190613ebb565b5060c082015160068201805460e08501516101008601516101208701516101408801516101608901516101808a015163ffffffff98891667ffffffffffffffff1990971696909617600160201b958916959095029490941767ffffffffffffffff60401b1916600160401b9388169390930263ffffffff60601b191692909217600160601b918716919091021767ffffffffffffffff60801b1916600160801b9186169190910263ffffffff60a01b191617600160a01b918516919091021763ffffffff60c01b1916600160c01b93909116929092029190911790556101a08201516007820180546001600160a01b0319166001600160a01b039092169190911790556101c0820151600882019061341390826150db565b505050336001600160a01b03167f5280c74029ecceb35e4fecf34adee487fd5a9a3d6c8e70b7374a1c133370e83a8760405161344f91906151d9565b60405180910390a25050505061179c6001606555565b60008084610120015163ffffffff1690508363ffffffff16610e108661014001516134909190615610565b6134a09063ffffffff16836151ad565b1180156134b257508263ffffffff1681105b95945050505050565b6000613510826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661378b9092919063ffffffff16565b805190915015612aff578080602001905181019061352e9190614e4b565b612aff5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016110d0565b61359681612505565b6135f85760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b60648201526084016110d0565b60008051602061571883398151915280546001600160a01b0319166001600160a01b0392909216919091179055565b6136308361379a565b60008251118061363d5750805b15612aff576111d683836137da565b60606000613659836138c3565b60010190506000816001600160401b0381111561367857613678613fdf565b6040519080825280601f01601f1916602001820160405280156136a2576020820181803683370190505b5090508181016020015b600019016f181899199a1a9b1b9c1cb0b131b232b360811b600a86061a8153600a85049450846136ac57509392505050565b60008060006136ed858561399b565b915091506118bd816139dd565b60026065540361374c5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016110d0565b6002606555565b6040516001600160a01b03808516602483015283166044820152606481018290526111d69085906323b872dd60e01b90608401612ac8565b606061166e8484600085613b22565b6137a38161358d565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b60606137e583612505565b6138405760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b60648201526084016110d0565b600080846001600160a01b03168460405161385b91906151ec565b600060405180830381855af49150503d8060008114613896576040519150601f19603f3d011682016040523d82523d6000602084013e61389b565b606091505b50915091506134b2828260405180606001604052806027815260200161573860279139613bff565b60008072184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b83106139025772184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b830492506040015b6d04ee2d6d415b85acef8100000000831061392e576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc10000831061394c57662386f26fc10000830492506010015b6305f5e1008310613964576305f5e100830492506008015b612710831061397857612710830492506004015b6064831061398a576064830492506002015b600a83106121165760010192915050565b60008082516041036139d15760208301516040840151606085015160001a6139c587828585613c18565b94509450505050611204565b50600090506002611204565b60008160048111156139f1576139f1615701565b036139f95750565b6001816004811115613a0d57613a0d615701565b03613a555760405162461bcd60e51b815260206004820152601860248201527745434453413a20696e76616c6964207369676e617475726560401b60448201526064016110d0565b6002816004811115613a6957613a69615701565b03613ab65760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e6774680060448201526064016110d0565b6003816004811115613aca57613aca615701565b036112d05760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b60648201526084016110d0565b606082471015613b835760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016110d0565b600080866001600160a01b03168587604051613b9f91906151ec565b60006040518083038185875af1925050503d8060008114613bdc576040519150601f19603f3d011682016040523d82523d6000602084013e613be1565b606091505b5091509150613bf287838387613ccf565b925050505b949350505050565b60608315613c0e575081611671565b6116718383613d42565b6000806fa2a8918ca85bafe22016d0b997e4df60600160ff1b03831115613c4557506000905060036114c7565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015613c99573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116613cc2576000600192509250506114c7565b9660009650945050505050565b60608315613d3c578251600003613d3557613ce985612505565b613d355760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016110d0565b5081613bf7565b613bf783835b815115613d525781518083602001fd5b8060405162461bcd60e51b81526004016110d09190614e28565b604080516102a081018252600060c0820181815260e083018290526101008301829052610120830182905260606101408401819052610160840181905261018084018390526101a084018390526101c084018390526101e08401839052610200840183905261022084018390526102408401839052610260840183905261028084015282526020820152908101613e01613e22565b8152602001613e0e613e22565b815260606020820152600060409091015290565b604051806080016040528060006001600160a01b03168152602001600060ff16815260200160608152602001600081525090565b828054828255906000526020600020908101928215613eab579160200282015b82811115613eab57825182546001600160a01b0319166001600160a01b03909116178255602090920191600190910190613e76565b50613eb7929150613f61565b5090565b82805482825590600052602060002090600701600890048101928215613eab5791602002820160005b83821115613f2857835183826101000a81548163ffffffff021916908363ffffffff1602179055509260200192600401602081600301049283019260010302613ee4565b8015613f585782816101000a81549063ffffffff0219169055600401602081600301049283019260010302613f28565b5050613eb79291505b5b80821115613eb75760008155600101613f62565b6001600160a01b03811681146112d057600080fd5b803561179c81613f76565b60008060408385031215613fa957600080fd5b8235613fb481613f76565b946020939093013593505050565b600060208284031215613fd457600080fd5b813561167181613f76565b634e487b7160e01b600052604160045260246000fd5b6040516101e081016001600160401b038111828210171561401857614018613fdf565b60405290565b60405160c081016001600160401b038111828210171561401857614018613fdf565b604051601f8201601f191681016001600160401b038111828210171561406857614068613fdf565b604052919050565b60006001600160401b0382111561408957614089613fdf565b5060051b60200190565b600082601f8301126140a457600080fd5b813560206140b96140b483614070565b614040565b82815260059290921b840181019181810190868411156140d857600080fd5b8286015b848110156140fc5780356140ef81613f76565b83529183019183016140dc565b509695505050505050565b63ffffffff811681146112d057600080fd5b803561179c81614107565b600082601f83011261413557600080fd5b813560206141456140b483614070565b82815260059290921b8401810191818101908684111561416457600080fd5b8286015b848110156140fc57803561417b81614107565b8352918301918301614168565b60006001600160401b038211156141a1576141a1613fdf565b50601f01601f191660200190565b60006141bd6140b484614188565b90508281528383830111156141d157600080fd5b828260208301376000602084830101529392505050565b600082601f8301126141f957600080fd5b611671838335602085016141af565b60006101e0828403121561421b57600080fd5b614223613ff5565b90508135815261423560208301613f8b565b602082015261424660408301613f8b565b60408201526060820135606082015260808201356001600160401b038082111561426f57600080fd5b61427b85838601614093565b608084015260a084013591508082111561429457600080fd5b6142a085838601614124565b60a08401526142b160c08501614119565b60c08401526142c260e08501614119565b60e084015261010091506142d7828501614119565b8284015261012091506142eb828501614119565b8284015261014091506142ff828501614119565b828401526101609150614313828501614119565b828401526101809150614327828501614119565b828401526101a0915061433b828501613f8b565b828401526101c09150818401358181111561435557600080fd5b614361868287016141e8565b8385015250505092915050565b60006020828403121561438057600080fd5b81356001600160401b0381111561439657600080fd5b613bf784828501614208565b600081518084526020808501945080840160005b838110156143db5781516001600160a01b0316875295820195908201906001016143b6565b509495945050505050565b600081518084526020808501945080840160005b838110156143db57815163ffffffff16875295820195908201906001016143fa565b60005b8381101561443757818101518382015260200161441f565b50506000910152565b6000815180845261445881602086016020860161441c565b601f01601f19169290920160200192915050565b60006101e082518452602083015161448f60208601826001600160a01b03169052565b5060408301516144aa60408601826001600160a01b03169052565b506060830151606085015260808301518160808601526144cc828601826143a2565b91505060a083015184820360a08601526144e682826143e6565b91505060c083015161450060c086018263ffffffff169052565b5060e083015161451860e086018263ffffffff169052565b506101008381015163ffffffff9081169186019190915261012080850151821690860152610140808501518216908601526101608085015182169086015261018080850151909116908501526101a0808401516001600160a01b0316908501526101c080840151858303828701526145908382614440565b9695505050505050565b60018060a01b03815116825260ff602082015116602083015260006040820151608060408501526145ce6080850182614440565b606093840151949093019390935250919050565b6000815160c084526145f760c085018261446c565b905062ffffff60208401511660208501526040830151848203604086015261461f828261459a565b91505060608301518482036060860152614639828261459a565b915050608083015184820360808601526146538282614440565b91505060ff60a08401511660a08501528091505092915050565b60208152600061167160208301846145e2565b60006020828403121561469257600080fd5b813561167181614107565b600081518084526020808501808196508360051b8101915082860160005b858110156146e55782840389526146d38483516145e2565b988501989350908401906001016146bb565b5091979650505050505050565b602081526000611671602083018461469d565b60008060006060848603121561471a57600080fd5b833561472581614107565b9250602084013561473581614107565b9150604084013561474581614107565b809150509250925092565b604081526000614763604083018561469d565b90508260208301529392505050565b60008083601f84011261478457600080fd5b5081356001600160401b0381111561479b57600080fd5b6020830191508360208260051b850101111561120457600080fd5b6000806000604084860312156147cb57600080fd5b83356001600160401b038111156147e157600080fd5b6147ed86828701614772565b909450925050602084013561474581613f76565b60008060006060848603121561481657600080fd5b833561482181613f76565b9250602084013561483181613f76565b929592945050506040919091013590565b6000806040838503121561485557600080fd5b823561486081614107565b9150602083013561487081614107565b809150509250929050565b60006020828403121561488d57600080fd5b81356001600160401b038111156148a357600080fd5b8201601f810184136148b457600080fd5b613bf7848235602084016141af565b6000602082840312156148d557600080fd5b5035919050565b6001600160a01b0391909116815260200190565b6000806000806080858703121561490657600080fd5b843561491181613f76565b9350602085013561492181614107565b9250604085013561493181614107565b9150606085013561494181614107565b939692955090935050565b6000806040838503121561495f57600080fd5b823561496a81613f76565b915060208301356001600160401b0381111561498557600080fd5b614991858286016141e8565b9150509250929050565b600080600080608085870312156149b157600080fd5b843561491181614107565b60008083601f8401126149ce57600080fd5b5081356001600160401b038111156149e557600080fd5b60208301915083602082850101111561120457600080fd5b600080600060408486031215614a1257600080fd5b83356001600160401b0380821115614a2957600080fd5b614a3587838801614208565b94506020860135915080821115614a4b57600080fd5b50614a58868287016149bc565b9497909650939450505050565b60006020808385031215614a7857600080fd5b82356001600160401b0380821115614a8f57600080fd5b818501915085601f830112614aa357600080fd5b8135614ab16140b482614070565b81815260059190911b83018401908481019088831115614ad057600080fd5b8585015b83811015614b0857803585811115614aec5760008081fd5b614afa8b89838a0101614208565b845250918601918601614ad4565b5098975050505050505050565b6020808252825182820181905260009190848201906040850190845b81811015614b4d57835183529284019291840191600101614b31565b50909695505050505050565b60008060208385031215614b6c57600080fd5b82356001600160401b03811115614b8257600080fd5b614b8e858286016149bc565b90969095509350505050565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b82811015614bef57603f19888603018452614bdd85835161446c565b94509285019290850190600101614bc1565b5092979650505050505050565b600080600060608486031215614c1157600080fd5b833561472581613f76565b602080825282518282018190526000919060409081850190868401855b828110156146e557815180516001600160a01b03168552860151868501529284019290850190600101614c39565b60008060008060408587031215614c7d57600080fd5b84356001600160401b0380821115614c9457600080fd5b614ca088838901614772565b90965094506020870135915080821115614cb957600080fd5b50614cc687828801614772565b95989497509550505050565b60008060408385031215614ce557600080fd5b823561486081613f76565b8d81526001600160a01b038d811660208301528c166040820152606081018b905263ffffffff8a8116608083015289811660a0830152881660c0820152600063ffffffff881660e083015263ffffffff871661010083015263ffffffff861661012083015263ffffffff85166101408301526001600160a01b0384166101608301526101a0610180830152614d896101a0830184614440565b9f9e505050505050505050505050505050565b821515815260406020820152600061166e60408301846145e2565b600080600080600060a08688031215614dcf57600080fd5b8535614dda81613f76565b94506020860135614dea81614107565b93506040860135614dfa81614107565b92506060860135614e0a81614107565b91506080860135614e1a81614107565b809150509295509295909350565b6020815260006116716020830184614440565b8051801515811461179c57600080fd5b600060208284031215614e5d57600080fd5b61167182614e3b565b805162ffffff8116811461179c57600080fd5b600060208284031215614e8b57600080fd5b61167182614e66565b805161179c81613f76565b600060208284031215614eb157600080fd5b815161167181613f76565b600082601f830112614ecd57600080fd5b8151614edb6140b482614188565b818152846020838601011115614ef057600080fd5b613bf782602083016020870161441c565b600060208284031215614f1357600080fd5b81516001600160401b03811115614f2957600080fd5b613bf784828501614ebc565b805160ff8116811461179c57600080fd5b600060208284031215614f5857600080fd5b61167182614f35565b634e487b7160e01b600052601160045260246000fd5b63ffffffff818116838216019080821115610e4f57610e4f614f61565b634e487b7160e01b600052603260045260246000fd5b600060208284031215614fbc57600080fd5b5051919050565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b19195b1959d85d1958d85b1b60a21b606082015260800190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b6163746976652070726f787960a01b606082015260800190565b600181811c9082168061506f57607f821691505b60208210810361508f57634e487b7160e01b600052602260045260246000fd5b50919050565b601f821115612aff57600081815260208120601f850160051c810160208610156150bc5750805b601f850160051c820191505b81811015611f28578281556001016150c8565b81516001600160401b038111156150f4576150f4613fdf565b61510881615102845461505b565b84615095565b602080601f83116001811461513d57600084156151255750858301515b600019600386901b1c1916600185901b178555611f28565b600085815260208120601f198616915b8281101561516c5788860151825594840194600190910190840161514d565b508582101561518a5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b8181038181111561211657612116614f61565b8082018082111561211657612116614f61565b6000600182016151d2576151d2614f61565b5060010190565b602081526000611671602083018461446c565b600082516151fe81846020870161441c565b9190910192915050565b600082601f83011261521957600080fd5b815160206152296140b483614070565b82815260059290921b8401810191818101908684111561524857600080fd5b8286015b848110156140fc57805161525f81613f76565b835291830191830161524c565b805161179c81614107565b600082601f83011261528857600080fd5b815160206152986140b483614070565b82815260059290921b840181019181810190868411156152b757600080fd5b8286015b848110156140fc5780516152ce81614107565b83529183019183016152bb565b60006101e082840312156152ee57600080fd5b6152f6613ff5565b90508151815261530860208301614e94565b602082015261531960408301614e94565b60408201526060820151606082015260808201516001600160401b038082111561534257600080fd5b61534e85838601615208565b608084015260a084015191508082111561536757600080fd5b61537385838601615277565b60a084015261538460c0850161526c565b60c084015261539560e0850161526c565b60e084015261010091506153aa82850161526c565b8284015261012091506153be82850161526c565b8284015261014091506153d282850161526c565b8284015261016091506153e682850161526c565b8284015261018091506153fa82850161526c565b828401526101a0915061540e828501614e94565b828401526101c09150818401518181111561542857600080fd5b61436186828701614ebc565b60006080828403121561544657600080fd5b604051608081016001600160401b03828210818311171561546957615469613fdf565b816040528293508451915061547d82613f76565b81835261548c60208601614f35565b602084015260408501519150808211156154a557600080fd5b506154b285828601614ebc565b604083015250606083015160608201525092915050565b600060c082840312156154db57600080fd5b6154e361401e565b905081516001600160401b03808211156154fc57600080fd5b615508858386016152db565b835261551660208501614e66565b6020840152604084015191508082111561552f57600080fd5b61553b85838601615434565b6040840152606084015191508082111561555457600080fd5b61556085838601615434565b6060840152608084015191508082111561557957600080fd5b5061558684828501614ebc565b60808301525061559860a08301614f35565b60a082015292915050565b6000602082840312156155b557600080fd5b81516001600160401b038111156155cb57600080fd5b613bf7848285016154c9565b634e487b7160e01b600052601260045260246000fd5b600063ffffffff80841680615604576156046155d7565b92169190910492915050565b63ffffffff81811683821602808216919082811461563057615630614f61565b505092915050565b6000806040838503121561564b57600080fd5b61565483614e3b565b915060208301516001600160401b0381111561566f57600080fd5b614991858286016154c9565b7f19457468657265756d205369676e6564204d6573736167653a0a0000000000008152600083516156b381601a85016020880161441c565b8351908301906156ca81601a84016020880161441c565b01601a01949350505050565b6000826156e5576156e56155d7565b500490565b808202811582820484141761211657612116614f61565b634e487b7160e01b600052602160045260246000fdfe360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220623545b3dab397b31826b23d976cdd61294c2b5d63977c281b5bba2b46d587ee64736f6c63430008110033496e697469616c697a61626c653a20636f6e747261637420697320616c7265617f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498", + "deployedBytecode": "0x6080604052600436106102ca5760003560e01c80637bb7bed11161017b578063b9d81abc116100d7578063e1394f7d11610085578063e1394f7d14610922578063e21f37ce14610942578063e74b981b14610964578063f2f4eb2614610984578063f6e6bb62146109a4578063fb1d2329146109c4578063feba1ed2146109e457600080fd5b8063b9d81abc1461080e578063ba5c3a9d1461082e578063bfe1092814610867578063c14007a014610887578063c53e7dab146108b5578063d0ff94b2146108d5578063d7fa5625146108f557600080fd5b80639af1d35a116101345780639af1d35a14610720578063a218404014610736578063a2686e2314610756578063a70b9f0c14610776578063aa529617146107a1578063ab37f486146107c1578063ae23bf28146107ee57600080fd5b80637bb7bed1146106445780637ecebe00146106645780638a4bd4b21461069157806392ccb581146106b157806395d3d5d8146106d157806396b3ce54146106f357600080fd5b80633d18678e1161022a57806358beb884116101e357806358beb8841461055d5780636c1550b11461057d5780636cca84bd146105aa578063734e7fb9146105ca578063752e8749146105ea57806376cd7cbc146106025780637b74691e1461062257600080fd5b80633d18678e146104a857806346904840146104c85780634d5aedbf146104f55780634f1ef2861461051557806352d1902d14610528578063586db1f51461053d57600080fd5b806317418a221161028757806317418a22146103c25780631794bb3c146103d75780632acd7ec4146103f7578063304440171461043257806334f150b7146104485780633659cfe614610468578063368b87721461048857600080fd5b80630241d8f9146102cf57806303d2944c146102f15780630db38252146103115780630f44380d146103475780631136b89514610374578063141df503146103a2575b600080fd5b3480156102db57600080fd5b506102ef6102ea366004613f96565b610a11565b005b3480156102fd57600080fd5b506102ef61030c366004613fc2565b610af8565b34801561031d57600080fd5b5061033161032c36600461436e565b610bf7565b60405161033e919061466d565b60405180910390f35b34801561035357600080fd5b50610367610362366004614680565b610e2e565b60405161033e91906146f2565b34801561038057600080fd5b5061039461038f366004614705565b610e56565b60405161033e929190614750565b3480156103ae57600080fd5b506102ef6103bd3660046147b6565b610e8c565b3480156103ce57600080fd5b50610367611003565b3480156103e357600080fd5b506102ef6103f2366004614801565b611030565b34801561040357600080fd5b50610424610412366004613fc2565b60a36020526000908152604090205481565b60405190815260200161033e565b34801561043e57600080fd5b50610424609c5481565b34801561045457600080fd5b50610394610463366004614842565b6111dc565b34801561047457600080fd5b506102ef610483366004613fc2565b61120b565b34801561049457600080fd5b506102ef6104a336600461487b565b6112d3565b3480156104b457600080fd5b506102ef6104c33660046148c3565b6113b8565b3480156104d457600080fd5b506099546104e8906001600160a01b031681565b60405161033e91906148dc565b34801561050157600080fd5b506103946105103660046148f0565b6114a5565b6102ef61052336600461494c565b6114d0565b34801561053457600080fd5b50610424611589565b34801561054957600080fd5b5061039461055836600461499b565b611637565b34801561056957600080fd5b506104246105783660046149fd565b611659565b34801561058957600080fd5b5061059d610598366004614a65565b611678565b60405161033e9190614b15565b3480156105b657600080fd5b506102ef6105c5366004613fc2565b6117a1565b3480156105d657600080fd5b506103676105e5366004614842565b6118a4565b3480156105f657600080fd5b50610424633b9aca0081565b34801561060e57600080fd5b506102ef61061d366004614b59565b6118c5565b34801561062e57600080fd5b506106376118cf565b60405161033e9190614b9a565b34801561065057600080fd5b506104e861065f3660046148c3565b611b52565b34801561067057600080fd5b5061042461067f366004613fc2565b60a06020526000908152604090205481565b34801561069d57600080fd5b506103676106ac366004613fc2565b611b7c565b3480156106bd57600080fd5b506103946106cc366004614bfc565b611b9c565b3480156106dd57600080fd5b506106e6611bbd565b60405161033e9190614c1c565b3480156106ff57600080fd5b5061042461070e366004613fc2565b60a16020526000908152604090205481565b34801561072c57600080fd5b50610424609a5481565b34801561074257600080fd5b506102ef610751366004614c67565b611cde565b34801561076257600080fd5b506102ef610771366004613fc2565b611f30565b34801561078257600080fd5b5061078c610e1081565b60405163ffffffff909116815260200161033e565b3480156107ad57600080fd5b506103946107bc3660046148f0565b612033565b3480156107cd57600080fd5b506104246107dc366004613fc2565b609f6020526000908152604090205481565b3480156107fa57600080fd5b50610367610809366004614cd2565b612062565b34801561081a57600080fd5b5061042461082936600461436e565b61208b565b34801561083a57600080fd5b5061084e6108493660046148c3565b61211c565b60405161033e9d9c9b9a99989796959493929190614cf0565b34801561087357600080fd5b506098546104e8906001600160a01b031681565b34801561089357600080fd5b506108a76108a236600461436e565b612249565b60405161033e929190614d9c565b3480156108c157600080fd5b506103946108d0366004614db7565b612323565b3480156108e157600080fd5b506103676108f0366004614cd2565b612342565b34801561090157600080fd5b50610424610910366004613fc2565b60a26020526000908152604090205481565b34801561092e57600080fd5b5061036761093d366004614680565b612351565b34801561094e57600080fd5b50610957612372565b60405161033e9190614e28565b34801561097057600080fd5b506102ef61097f366004613fc2565b612400565b34801561099057600080fd5b506097546104e8906001600160a01b031681565b3480156109b057600080fd5b506103946109bf366004614705565b6124d8565b3480156109d057600080fd5b506103676109df366004614bfc565b6124f6565b3480156109f057600080fd5b506104246109ff366004613fc2565b609e6020526000908152604090205481565b60975460405163521d4de960e01b81526001600160a01b039091169063521d4de990610a419033906004016148dc565b602060405180830381865afa158015610a5e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a829190614e4b565b610a9f57604051632678482f60e21b815260040160405180910390fd5b6001600160a01b0382166000818152609e602052604090819020839055517fab1d37d0b21937f334fc4164d147abbfdbfd7ef37ab9ea0ae73f2a58ffb7f1cc90610aec9084815260200190565b60405180910390a25050565b60975460405163521d4de960e01b81526001600160a01b039091169063521d4de990610b289033906004016148dc565b602060405180830381865afa158015610b45573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b699190614e4b565b610b8657604051632678482f60e21b815260040160405180910390fd5b6001600160a01b038116610bad57604051633494a40d60e21b815260040160405180910390fd5b609880546001600160a01b0319166001600160a01b0383169081179091556040517fc0ebb188f905d128bcd7e4282dd1f9cf24cd331b69071002e488349aca6a867b90600090a250565b610bff613d6c565b81816000018190525081602001516001600160a01b031663ddca3f436040518163ffffffff1660e01b8152600401602060405180830381865afa925050508015610c66575060408051601f3d908101601f19168201909252610c6391810190614e79565b60015b610c765760006020820152610c81565b62ffffff1660208201525b610cf482602001516001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa158015610cc6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cea9190614e9f565b8360200151612514565b8160400181905250610d4182602001516001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa158015610cc6573d6000803e3d6000fd5b816060018190525081604001516001600160a01b03166395d89b416040518163ffffffff1660e01b8152600401600060405180830381865afa158015610d8b573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610db39190810190614f01565b816080018190525081604001516001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015610dfd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e219190614f46565b60ff1660a0820152919050565b6060610e4f6000610e3e8461267c565b63ffffffff600063ffffffff612695565b5092915050565b6060600080610e648661267c565b9050610e7f600082610e78610e1082614f77565b8888612695565b9250925050935093915050565b60975460405163521d4de960e01b81526001600160a01b039091169063521d4de990610ebc9033906004016148dc565b602060405180830381865afa158015610ed9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610efd9190614e4b565b610f1a57604051632678482f60e21b815260040160405180910390fd5b8160005b81811015610ffc57610ff483868684818110610f3c57610f3c614f94565b9050602002016020810190610f519190613fc2565b6001600160a01b03166370a08231306040518263ffffffff1660e01b8152600401610f7c91906148dc565b602060405180830381865afa158015610f99573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fbd9190614faa565b878785818110610fcf57610fcf614f94565b9050602002016020810190610fe49190613fc2565b6001600160a01b03169190612a9c565b600101610f1e565b5050505050565b606060006110104261267c565b9050610e4f600082611024610e1082614f77565b600063ffffffff612695565b600054610100900460ff16158080156110505750600054600160ff909116105b80611071575061105f30612505565b158015611071575060005460ff166001145b6110d95760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084015b60405180910390fd5b6000805460ff1916600117905580156110fc576000805461ff0019166101001790555b6001600160a01b038416158061111957506001600160a01b038316155b156111375760405163d92e233d60e01b815260040160405180910390fd5b633b9aca00821061115b57604051633494a40d60e21b815260040160405180910390fd5b609880546001600160a01b038086166001600160a01b0319928316179092556097805492871692909116919091179055609a82905580156111d6576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50505050565b60606000806111ea4261267c565b90506111fe600082610e78610e1082614f77565b92509250505b9250929050565b6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001630036112535760405162461bcd60e51b81526004016110d090614fc3565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316611285612b04565b6001600160a01b0316146112ab5760405162461bcd60e51b81526004016110d09061500f565b6112b481612b20565b604080516000808252602082019092526112d091839190612bc3565b50565b60975460405163521d4de960e01b81526001600160a01b039091169063521d4de9906113039033906004016148dc565b602060405180830381865afa158015611320573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113449190614e4b565b61136157604051632678482f60e21b815260040160405180910390fd5b609b61136d82826150db565b50600061137982612d2e565b609c8190556040518181529091507fde3dc3335dea4d1a1060ef6cefcfcc109eb0a1e78ce151818d3f17a01e1f8a059060200160405180910390a15050565b60975460405163521d4de960e01b81526001600160a01b039091169063521d4de9906113e89033906004016148dc565b602060405180830381865afa158015611405573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114299190614e4b565b61144657604051632678482f60e21b815260040160405180910390fd5b633b9aca00811061146a57604051633494a40d60e21b815260040160405180910390fd5b609a8190556040518181527f3346af6da1932164d501f2ec28f8c5d686db5828a36b77f2da4332d89184fe7b9060200160405180910390a150565b606060006114c2866114b68761267c565b63ffffffff8787612695565b915091505b94509492505050565b6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001630036115185760405162461bcd60e51b81526004016110d090614fc3565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031661154a612b04565b6001600160a01b0316146115705760405162461bcd60e51b81526004016110d09061500f565b61157982612b20565b61158582826001612bc3565b5050565b6000306001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146116245760405162461bcd60e51b815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c6044820152771b1959081d1a1c9bdd59da0819195b1959d85d1958d85b1b60421b60648201526084016110d0565b5060008051602061571883398151915290565b606060006114c260006116498861267c565b6116528861267c565b8787612695565b60006116658383612d69565b61166e84612e25565b90505b9392505050565b33600090815260a260205260409020546060901580156116a95750609c5433600090815260a1602052604090205414155b80156116c2575032600090815260a26020526040902054155b80156116df5750609c5432600090815260a1602052604090205414155b156116fd576040516314e52a5b60e31b815260040160405180910390fd5b81516000816001600160401b0381111561171957611719613fdf565b604051908082528060200260200182016040528015611742578160200160208202803683370190505b50905060005b828110156117975761177285828151811061176557611765614f94565b6020026020010151612e25565b82828151811061178457611784614f94565b6020908102919091010152600101611748565b509150505b919050565b60975460405163521d4de960e01b81526001600160a01b039091169063521d4de9906117d19033906004016148dc565b602060405180830381865afa1580156117ee573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118129190614e4b565b61182f57604051632678482f60e21b815260040160405180910390fd5b6001600160a01b0381166000908152609f602052604081205461185390600161519a565b6001600160a01b0383166000818152609f60205260409081902083905551919250907fc6cd32b1acffa550abf886a9b443ff3ce485bfdb05e35ef5b26e745739a1eac190610aec9084815260200190565b60606118bd60006118b48561267c565b6110248561267c565b509392505050565b6115858282612d69565b6060609d805480602002602001604051908101604052809291908181526020016000905b82821015611b49576000848152602090819020604080516101e081018252600986029092018054835260018101546001600160a01b039081168486015260028201541683830152600381015460608401526004810180548351818702810187019094528084529394919360808601939283018282801561199c57602002820191906000526020600020905b81546001600160a01b0316815260019091019060200180831161197e575b5050505050815260200160058201805480602002602001604051908101604052809291908181526020018280548015611a2057602002820191906000526020600020906000905b82829054906101000a900463ffffffff1663ffffffff16815260200190600401906020826003010492830192600103820291508084116119e35790505b5050509183525050600682015463ffffffff8082166020840152600160201b820481166040840152600160401b820481166060840152600160601b820481166080840152600160801b8204811660a0840152600160a01b8204811660c0840152600160c01b9091041660e082015260078201546001600160a01b031661010082015260088201805461012090920191611ab89061505b565b80601f0160208091040260200160405190810160405280929190818152602001828054611ae49061505b565b8015611b315780601f10611b0657610100808354040283529160200191611b31565b820191906000526020600020905b815481529060010190602001808311611b1457829003601f168201915b505050505081525050815260200190600101906118f3565b50505050905090565b60a48181548110611b6257600080fd5b6000918252602090912001546001600160a01b0316905081565b60606000611b894261267c565b90506117978382611024610e1082614f77565b6060600080611baa4261267c565b9050610e7f8682610e78610e1082614f77565b60a45460609060009081816001600160401b03811115611bdf57611bdf613fdf565b604051908082528060200260200182016040528015611c2457816020015b6040805180820190915260008082526020820152815260200190600190039081611bfd5790505b50905060005b828163ffffffff161015611cd457600060a48263ffffffff1681548110611c5357611c53614f94565b60009182526020808320909101546001600160a01b031680835260a39091526040909120549091508015611cca576040518060400160405280836001600160a01b0316815260200182815250848781518110611cb157611cb1614f94565b6020908102919091010152611cc76001876151ad565b95505b5050600101611c2a565b5091825250919050565b60975460405163521d4de960e01b81526001600160a01b039091169063521d4de990611d0e9033906004016148dc565b602060405180830381865afa158015611d2b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d4f9190614e4b565b611d6c57604051632678482f60e21b815260040160405180910390fd5b82818114611d8d57604051631df89e8b60e01b815260040160405180910390fd5b60005b81811015611f28576000848483818110611dac57611dac614f94565b905060200201359050600081118015611e07575060a36000888885818110611dd657611dd6614f94565b9050602002016020810190611deb9190613fc2565b6001600160a01b03168152602081019190915260400160002054155b15611e685760a4878784818110611e2057611e20614f94565b9050602002016020810190611e359190613fc2565b81546001810183556000928352602090922090910180546001600160a01b0319166001600160a01b039092169190911790555b8060a36000898986818110611e7f57611e7f614f94565b9050602002016020810190611e949190613fc2565b6001600160a01b03168152602081019190915260400160002055868683818110611ec057611ec0614f94565b9050602002016020810190611ed59190613fc2565b6001600160a01b03167f3a5e6418e38cae10bf66eaf3e68c4e9c6b14df195e24fec169ab3a5b123c96e582604051611f0f91815260200190565b60405180910390a250611f21816151c0565b9050611d90565b505050505050565b60975460405163521d4de960e01b81526001600160a01b039091169063521d4de990611f609033906004016148dc565b602060405180830381865afa158015611f7d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fa19190614e4b565b611fbe57604051632678482f60e21b815260040160405180910390fd5b6001600160a01b038116600090815260a26020526040812054611fe290600161519a565b6001600160a01b038316600081815260a260205260409081902083905551919250907f9c759941da0b7ce56c059c1497218796e62035024afb77a00ff49a980a62078f90610aec9084815260200190565b60606000806120418661267c565b90506120548782610e78610e1082614f77565b925092505094509492505050565b6060600061206f8361267c565b90506120828482611024610e1082614f77565b50949350505050565b33600090815260a260205260408120541580156120b95750609c5433600090815260a1602052604090205414155b80156120d2575032600090815260a26020526040902054155b80156120ef5750609c5432600090815260a1602052604090205414155b1561210d576040516314e52a5b60e31b815260040160405180910390fd5b61211682612e25565b92915050565b609d818154811061212c57600080fd5b600091825260209091206009909102018054600182015460028301546003840154600685015460078601546008870180549698506001600160a01b039586169794861696939563ffffffff80851696600160201b8604821696600160401b8704831696600160601b8104841696600160801b8204851696600160a01b8304861696600160c01b90930490951694911692916121c69061505b565b80601f01602080910402602001604051908101604052809291908181526020018280546121f29061505b565b801561223f5780601f106122145761010080835404028352916020019161223f565b820191906000526020600020905b81548152906001019060200180831161222257829003601f168201915b505050505090508d565b6000612253613d6c565b600080306001600160a01b0316630db3825260e01b8660405160240161227991906151d9565b60408051601f198184030181529181526020820180516001600160e01b03166001600160e01b03199094169390931790925290516122b791906151ec565b600060405180830381855af49150503d80600081146122f2576040519150601f19603f3d011682016040523d82523d6000602084013e6122f7565b606091505b5091509150819350831561231c578080602001905181019061231991906155a3565b92505b5050915091565b60606000612334876116498861267c565b915091509550959350505050565b60606118bd83610e3e8461267c565b6060600061235e8361267c565b9050611797600082611024610e1082614f77565b609b805461237f9061505b565b80601f01602080910402602001604051908101604052809291908181526020018280546123ab9061505b565b80156123f85780601f106123cd576101008083540402835291602001916123f8565b820191906000526020600020905b8154815290600101906020018083116123db57829003601f168201915b505050505081565b60975460405163521d4de960e01b81526001600160a01b039091169063521d4de9906124309033906004016148dc565b602060405180830381865afa15801561244d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124719190614e4b565b61248e57604051632678482f60e21b815260040160405180910390fd5b609980546001600160a01b0319166001600160a01b0383169081179091556040517f7a7b5a0a132f9e0581eb8527f66eae9ee89c2a3e79d4ac7e41a1f1f4d48a7fc290600090a250565b606060006124ea60006114b68761267c565b91509150935093915050565b6060612082846118b48561267c565b6001600160a01b03163b151590565b61251c613e22565b6001600160a01b0383168082526040805163313ce56760e01b8152905163313ce567916004808201926020929091908290030181865afa158015612564573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125889190614f46565b60ff166020820152604080516395d89b4160e01b815290516001600160a01b038516916395d89b419160048083019260009291908290030181865afa1580156125d5573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526125fd9190810190614f01565b604080830191909152516370a0823160e01b81526001600160a01b038416906370a08231906126309085906004016148dc565b602060405180830381865afa15801561264d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126719190614faa565b606082015292915050565b6000610e1061268b81846155ed565b6121169190615610565b609d5460609060009081908163ffffffff861682106126ba578563ffffffff166126bc565b815b90506000816001600160401b038111156126d8576126d8613fdf565b60405190808252806020026020018201604052801561271157816020015b6126fe613d6c565b8152602001906001900390816126f65790505b509050875b838163ffffffff161015612a82576000609d8263ffffffff168154811061273f5761273f614f94565b6000918252602091829020604080516101e08101825260099093029091018054835260018101546001600160a01b03908116848601526002820154168383015260038101546060840152600481018054835181870281018701909452808452939491936080860193928301828280156127e157602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116127c3575b505050505081526020016005820180548060200260200160405190810160405280929190818152602001828054801561286557602002820191906000526020600020906000905b82829054906101000a900463ffffffff1663ffffffff16815260200190600401906020826003010492830192600103820291508084116128285790505b5050509183525050600682015463ffffffff8082166020840152600160201b820481166040840152600160401b820481166060840152600160601b820481166080840152600160801b8204811660a0840152600160a01b8204811660c0840152600160c01b9091041660e082015260078201546001600160a01b0316610100820152600882018054610120909201916128fd9061505b565b80601f01602080910402602001604051908101604052809291908181526020018280546129299061505b565b80156129765780601f1061294b57610100808354040283529160200191612976565b820191906000526020600020905b81548152906001019060200180831161295957829003601f168201915b505050505081525050905061298c818d8d613465565b80156129be57506001600160a01b038d1615806129be57508c6001600160a01b031681602001516001600160a01b0316145b15612a695760405163060a003d60e51b81526000908190309063c14007a0906129eb9086906004016151d9565b600060405180830381865afa158015612a08573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052612a309190810190615638565b915091508115612a665780858981518110612a4d57612a4d614f94565b6020908102919091010152612a636001896151ad565b97505b50505b816001019150838603612a7c5750612a82565b50612716565b9381529a63ffffffff909316995091975050505050505050565b6040516001600160a01b038316602482015260448101829052612aff90849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526134bb565b505050565b600080516020615718833981519152546001600160a01b031690565b6097546001600160a01b03168015801590612ba5575060405163521d4de960e01b81526001600160a01b0382169063521d4de990612b629033906004016148dc565b602060405180830381865afa158015612b7f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612ba39190614e4b565b155b1561158557604051632678482f60e21b815260040160405180910390fd5b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff1615612bf657612aff8361358d565b826001600160a01b03166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa925050508015612c50575060408051601f3d908101601f19168201909252612c4d91810190614faa565b60015b612cb35760405162461bcd60e51b815260206004820152602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201526d6f6e206973206e6f74205555505360901b60648201526084016110d0565b6000805160206157188339815191528114612d225760405162461bcd60e51b815260206004820152602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f786044820152681a58589b195555525160ba1b60648201526084016110d0565b50612aff838383613627565b6000612d3a825161364c565b82604051602001612d4c92919061567b565b604051602081830303815290604052805190602001209050919050565b609c54604080516020601f85018190048102820181019092528381523391612dad91849187908790819084018382808284376000920191909152506136de92505050565b6001600160a01b031614612dd457604051638baa579f60e01b815260040160405180910390fd5b33600081815260a1602052604090819020839055517fc48bbd4f009ad78a336beb65bf44688651e9aa52ac98d9054f0fce0573fefbc390612e189084815260200190565b60405180910390a2505050565b6000612e2f6136fa565b6000612e3f83610120015161267c565b6040808501516001600160a01b0316600090815260a3602052205463ffffffff821661012086015290915042612e77610e1084614f77565b63ffffffff161080612e92575061014084015163ffffffff16155b80612ec857508360e001518460c00151856101000151612eb29190614f77565b612ebc9190614f77565b63ffffffff1661271014155b80612ef757506101a08401516001600160a01b031615801590612ef7575061271084610180015163ffffffff16105b80612f0c57508360a001515184608001515114155b80612f15575080155b80612f3957508084610140015163ffffffff168560600151612f3791906156d6565b105b15612f57576040516314414f4160e11b815260040160405180910390fd5b6060840151336000908152609e6020526040902054909350633b9aca00811080156130035750609f600086602001516001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa158015612fc3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612fe79190614e9f565b6001600160a01b03168152602081019190915260400160002054155b80156130905750609f600086602001516001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa158015613050573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906130749190614e9f565b6001600160a01b03168152602081019190915260400160002054155b15613134576000633b9aca006130a6838261519a565b609a546130b391906156ea565b6130bd91906156d6565b90506000633b9aca006130d0838261519a565b6130da90886156ea565b6130e491906156d6565b6099549091506001600160a01b031680156130ff5780613101565b305b90506131283382613112858b61519a565b60408c01516001600160a01b0316929190613753565b50606087018190529450505b6098546040860151613155916001600160a01b039182169133911687613753565b33600090815260a060205260409020546131708160016151ad565b33600081815260a0602090815260409182902093909355516131b19284910160609290921b6bffffffffffffffffffffffff19168252601482015260340190565b60408051808303601f1901815291815281516020928301208852609d805460018101825560009190915288517fd26e832454299e9fabb89e0e5fffdc046d4e14431bc1bf607ffb2e8a1ddecf7b6009909202918201908155898401517fd26e832454299e9fabb89e0e5fffdc046d4e14431bc1bf607ffb2e8a1ddecf7c830180546001600160a01b03199081166001600160a01b0393841617909155938b01517fd26e832454299e9fabb89e0e5fffdc046d4e14431bc1bf607ffb2e8a1ddecf7d8401805490951691161790925560608901517fd26e832454299e9fabb89e0e5fffdc046d4e14431bc1bf607ffb2e8a1ddecf7e820155608089015180518a946132df937fd26e832454299e9fabb89e0e5fffdc046d4e14431bc1bf607ffb2e8a1ddecf7f01920190613e56565b5060a082015180516132fb916005840191602090910190613ebb565b5060c082015160068201805460e08501516101008601516101208701516101408801516101608901516101808a015163ffffffff98891667ffffffffffffffff1990971696909617600160201b958916959095029490941767ffffffffffffffff60401b1916600160401b9388169390930263ffffffff60601b191692909217600160601b918716919091021767ffffffffffffffff60801b1916600160801b9186169190910263ffffffff60a01b191617600160a01b918516919091021763ffffffff60c01b1916600160c01b93909116929092029190911790556101a08201516007820180546001600160a01b0319166001600160a01b039092169190911790556101c0820151600882019061341390826150db565b505050336001600160a01b03167f5280c74029ecceb35e4fecf34adee487fd5a9a3d6c8e70b7374a1c133370e83a8760405161344f91906151d9565b60405180910390a25050505061179c6001606555565b60008084610120015163ffffffff1690508363ffffffff16610e108661014001516134909190615610565b6134a09063ffffffff16836151ad565b1180156134b257508263ffffffff1681105b95945050505050565b6000613510826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661378b9092919063ffffffff16565b805190915015612aff578080602001905181019061352e9190614e4b565b612aff5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016110d0565b61359681612505565b6135f85760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b60648201526084016110d0565b60008051602061571883398151915280546001600160a01b0319166001600160a01b0392909216919091179055565b6136308361379a565b60008251118061363d5750805b15612aff576111d683836137da565b60606000613659836138c3565b60010190506000816001600160401b0381111561367857613678613fdf565b6040519080825280601f01601f1916602001820160405280156136a2576020820181803683370190505b5090508181016020015b600019016f181899199a1a9b1b9c1cb0b131b232b360811b600a86061a8153600a85049450846136ac57509392505050565b60008060006136ed858561399b565b915091506118bd816139dd565b60026065540361374c5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016110d0565b6002606555565b6040516001600160a01b03808516602483015283166044820152606481018290526111d69085906323b872dd60e01b90608401612ac8565b606061166e8484600085613b22565b6137a38161358d565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b60606137e583612505565b6138405760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b60648201526084016110d0565b600080846001600160a01b03168460405161385b91906151ec565b600060405180830381855af49150503d8060008114613896576040519150601f19603f3d011682016040523d82523d6000602084013e61389b565b606091505b50915091506134b2828260405180606001604052806027815260200161573860279139613bff565b60008072184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b83106139025772184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b830492506040015b6d04ee2d6d415b85acef8100000000831061392e576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc10000831061394c57662386f26fc10000830492506010015b6305f5e1008310613964576305f5e100830492506008015b612710831061397857612710830492506004015b6064831061398a576064830492506002015b600a83106121165760010192915050565b60008082516041036139d15760208301516040840151606085015160001a6139c587828585613c18565b94509450505050611204565b50600090506002611204565b60008160048111156139f1576139f1615701565b036139f95750565b6001816004811115613a0d57613a0d615701565b03613a555760405162461bcd60e51b815260206004820152601860248201527745434453413a20696e76616c6964207369676e617475726560401b60448201526064016110d0565b6002816004811115613a6957613a69615701565b03613ab65760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e6774680060448201526064016110d0565b6003816004811115613aca57613aca615701565b036112d05760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b60648201526084016110d0565b606082471015613b835760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016110d0565b600080866001600160a01b03168587604051613b9f91906151ec565b60006040518083038185875af1925050503d8060008114613bdc576040519150601f19603f3d011682016040523d82523d6000602084013e613be1565b606091505b5091509150613bf287838387613ccf565b925050505b949350505050565b60608315613c0e575081611671565b6116718383613d42565b6000806fa2a8918ca85bafe22016d0b997e4df60600160ff1b03831115613c4557506000905060036114c7565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015613c99573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116613cc2576000600192509250506114c7565b9660009650945050505050565b60608315613d3c578251600003613d3557613ce985612505565b613d355760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016110d0565b5081613bf7565b613bf783835b815115613d525781518083602001fd5b8060405162461bcd60e51b81526004016110d09190614e28565b604080516102a081018252600060c0820181815260e083018290526101008301829052610120830182905260606101408401819052610160840181905261018084018390526101a084018390526101c084018390526101e08401839052610200840183905261022084018390526102408401839052610260840183905261028084015282526020820152908101613e01613e22565b8152602001613e0e613e22565b815260606020820152600060409091015290565b604051806080016040528060006001600160a01b03168152602001600060ff16815260200160608152602001600081525090565b828054828255906000526020600020908101928215613eab579160200282015b82811115613eab57825182546001600160a01b0319166001600160a01b03909116178255602090920191600190910190613e76565b50613eb7929150613f61565b5090565b82805482825590600052602060002090600701600890048101928215613eab5791602002820160005b83821115613f2857835183826101000a81548163ffffffff021916908363ffffffff1602179055509260200192600401602081600301049283019260010302613ee4565b8015613f585782816101000a81549063ffffffff0219169055600401602081600301049283019260010302613f28565b5050613eb79291505b5b80821115613eb75760008155600101613f62565b6001600160a01b03811681146112d057600080fd5b803561179c81613f76565b60008060408385031215613fa957600080fd5b8235613fb481613f76565b946020939093013593505050565b600060208284031215613fd457600080fd5b813561167181613f76565b634e487b7160e01b600052604160045260246000fd5b6040516101e081016001600160401b038111828210171561401857614018613fdf565b60405290565b60405160c081016001600160401b038111828210171561401857614018613fdf565b604051601f8201601f191681016001600160401b038111828210171561406857614068613fdf565b604052919050565b60006001600160401b0382111561408957614089613fdf565b5060051b60200190565b600082601f8301126140a457600080fd5b813560206140b96140b483614070565b614040565b82815260059290921b840181019181810190868411156140d857600080fd5b8286015b848110156140fc5780356140ef81613f76565b83529183019183016140dc565b509695505050505050565b63ffffffff811681146112d057600080fd5b803561179c81614107565b600082601f83011261413557600080fd5b813560206141456140b483614070565b82815260059290921b8401810191818101908684111561416457600080fd5b8286015b848110156140fc57803561417b81614107565b8352918301918301614168565b60006001600160401b038211156141a1576141a1613fdf565b50601f01601f191660200190565b60006141bd6140b484614188565b90508281528383830111156141d157600080fd5b828260208301376000602084830101529392505050565b600082601f8301126141f957600080fd5b611671838335602085016141af565b60006101e0828403121561421b57600080fd5b614223613ff5565b90508135815261423560208301613f8b565b602082015261424660408301613f8b565b60408201526060820135606082015260808201356001600160401b038082111561426f57600080fd5b61427b85838601614093565b608084015260a084013591508082111561429457600080fd5b6142a085838601614124565b60a08401526142b160c08501614119565b60c08401526142c260e08501614119565b60e084015261010091506142d7828501614119565b8284015261012091506142eb828501614119565b8284015261014091506142ff828501614119565b828401526101609150614313828501614119565b828401526101809150614327828501614119565b828401526101a0915061433b828501613f8b565b828401526101c09150818401358181111561435557600080fd5b614361868287016141e8565b8385015250505092915050565b60006020828403121561438057600080fd5b81356001600160401b0381111561439657600080fd5b613bf784828501614208565b600081518084526020808501945080840160005b838110156143db5781516001600160a01b0316875295820195908201906001016143b6565b509495945050505050565b600081518084526020808501945080840160005b838110156143db57815163ffffffff16875295820195908201906001016143fa565b60005b8381101561443757818101518382015260200161441f565b50506000910152565b6000815180845261445881602086016020860161441c565b601f01601f19169290920160200192915050565b60006101e082518452602083015161448f60208601826001600160a01b03169052565b5060408301516144aa60408601826001600160a01b03169052565b506060830151606085015260808301518160808601526144cc828601826143a2565b91505060a083015184820360a08601526144e682826143e6565b91505060c083015161450060c086018263ffffffff169052565b5060e083015161451860e086018263ffffffff169052565b506101008381015163ffffffff9081169186019190915261012080850151821690860152610140808501518216908601526101608085015182169086015261018080850151909116908501526101a0808401516001600160a01b0316908501526101c080840151858303828701526145908382614440565b9695505050505050565b60018060a01b03815116825260ff602082015116602083015260006040820151608060408501526145ce6080850182614440565b606093840151949093019390935250919050565b6000815160c084526145f760c085018261446c565b905062ffffff60208401511660208501526040830151848203604086015261461f828261459a565b91505060608301518482036060860152614639828261459a565b915050608083015184820360808601526146538282614440565b91505060ff60a08401511660a08501528091505092915050565b60208152600061167160208301846145e2565b60006020828403121561469257600080fd5b813561167181614107565b600081518084526020808501808196508360051b8101915082860160005b858110156146e55782840389526146d38483516145e2565b988501989350908401906001016146bb565b5091979650505050505050565b602081526000611671602083018461469d565b60008060006060848603121561471a57600080fd5b833561472581614107565b9250602084013561473581614107565b9150604084013561474581614107565b809150509250925092565b604081526000614763604083018561469d565b90508260208301529392505050565b60008083601f84011261478457600080fd5b5081356001600160401b0381111561479b57600080fd5b6020830191508360208260051b850101111561120457600080fd5b6000806000604084860312156147cb57600080fd5b83356001600160401b038111156147e157600080fd5b6147ed86828701614772565b909450925050602084013561474581613f76565b60008060006060848603121561481657600080fd5b833561482181613f76565b9250602084013561483181613f76565b929592945050506040919091013590565b6000806040838503121561485557600080fd5b823561486081614107565b9150602083013561487081614107565b809150509250929050565b60006020828403121561488d57600080fd5b81356001600160401b038111156148a357600080fd5b8201601f810184136148b457600080fd5b613bf7848235602084016141af565b6000602082840312156148d557600080fd5b5035919050565b6001600160a01b0391909116815260200190565b6000806000806080858703121561490657600080fd5b843561491181613f76565b9350602085013561492181614107565b9250604085013561493181614107565b9150606085013561494181614107565b939692955090935050565b6000806040838503121561495f57600080fd5b823561496a81613f76565b915060208301356001600160401b0381111561498557600080fd5b614991858286016141e8565b9150509250929050565b600080600080608085870312156149b157600080fd5b843561491181614107565b60008083601f8401126149ce57600080fd5b5081356001600160401b038111156149e557600080fd5b60208301915083602082850101111561120457600080fd5b600080600060408486031215614a1257600080fd5b83356001600160401b0380821115614a2957600080fd5b614a3587838801614208565b94506020860135915080821115614a4b57600080fd5b50614a58868287016149bc565b9497909650939450505050565b60006020808385031215614a7857600080fd5b82356001600160401b0380821115614a8f57600080fd5b818501915085601f830112614aa357600080fd5b8135614ab16140b482614070565b81815260059190911b83018401908481019088831115614ad057600080fd5b8585015b83811015614b0857803585811115614aec5760008081fd5b614afa8b89838a0101614208565b845250918601918601614ad4565b5098975050505050505050565b6020808252825182820181905260009190848201906040850190845b81811015614b4d57835183529284019291840191600101614b31565b50909695505050505050565b60008060208385031215614b6c57600080fd5b82356001600160401b03811115614b8257600080fd5b614b8e858286016149bc565b90969095509350505050565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b82811015614bef57603f19888603018452614bdd85835161446c565b94509285019290850190600101614bc1565b5092979650505050505050565b600080600060608486031215614c1157600080fd5b833561472581613f76565b602080825282518282018190526000919060409081850190868401855b828110156146e557815180516001600160a01b03168552860151868501529284019290850190600101614c39565b60008060008060408587031215614c7d57600080fd5b84356001600160401b0380821115614c9457600080fd5b614ca088838901614772565b90965094506020870135915080821115614cb957600080fd5b50614cc687828801614772565b95989497509550505050565b60008060408385031215614ce557600080fd5b823561486081613f76565b8d81526001600160a01b038d811660208301528c166040820152606081018b905263ffffffff8a8116608083015289811660a0830152881660c0820152600063ffffffff881660e083015263ffffffff871661010083015263ffffffff861661012083015263ffffffff85166101408301526001600160a01b0384166101608301526101a0610180830152614d896101a0830184614440565b9f9e505050505050505050505050505050565b821515815260406020820152600061166e60408301846145e2565b600080600080600060a08688031215614dcf57600080fd5b8535614dda81613f76565b94506020860135614dea81614107565b93506040860135614dfa81614107565b92506060860135614e0a81614107565b91506080860135614e1a81614107565b809150509295509295909350565b6020815260006116716020830184614440565b8051801515811461179c57600080fd5b600060208284031215614e5d57600080fd5b61167182614e3b565b805162ffffff8116811461179c57600080fd5b600060208284031215614e8b57600080fd5b61167182614e66565b805161179c81613f76565b600060208284031215614eb157600080fd5b815161167181613f76565b600082601f830112614ecd57600080fd5b8151614edb6140b482614188565b818152846020838601011115614ef057600080fd5b613bf782602083016020870161441c565b600060208284031215614f1357600080fd5b81516001600160401b03811115614f2957600080fd5b613bf784828501614ebc565b805160ff8116811461179c57600080fd5b600060208284031215614f5857600080fd5b61167182614f35565b634e487b7160e01b600052601160045260246000fd5b63ffffffff818116838216019080821115610e4f57610e4f614f61565b634e487b7160e01b600052603260045260246000fd5b600060208284031215614fbc57600080fd5b5051919050565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b19195b1959d85d1958d85b1b60a21b606082015260800190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b6163746976652070726f787960a01b606082015260800190565b600181811c9082168061506f57607f821691505b60208210810361508f57634e487b7160e01b600052602260045260246000fd5b50919050565b601f821115612aff57600081815260208120601f850160051c810160208610156150bc5750805b601f850160051c820191505b81811015611f28578281556001016150c8565b81516001600160401b038111156150f4576150f4613fdf565b61510881615102845461505b565b84615095565b602080601f83116001811461513d57600084156151255750858301515b600019600386901b1c1916600185901b178555611f28565b600085815260208120601f198616915b8281101561516c5788860151825594840194600190910190840161514d565b508582101561518a5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b8181038181111561211657612116614f61565b8082018082111561211657612116614f61565b6000600182016151d2576151d2614f61565b5060010190565b602081526000611671602083018461446c565b600082516151fe81846020870161441c565b9190910192915050565b600082601f83011261521957600080fd5b815160206152296140b483614070565b82815260059290921b8401810191818101908684111561524857600080fd5b8286015b848110156140fc57805161525f81613f76565b835291830191830161524c565b805161179c81614107565b600082601f83011261528857600080fd5b815160206152986140b483614070565b82815260059290921b840181019181810190868411156152b757600080fd5b8286015b848110156140fc5780516152ce81614107565b83529183019183016152bb565b60006101e082840312156152ee57600080fd5b6152f6613ff5565b90508151815261530860208301614e94565b602082015261531960408301614e94565b60408201526060820151606082015260808201516001600160401b038082111561534257600080fd5b61534e85838601615208565b608084015260a084015191508082111561536757600080fd5b61537385838601615277565b60a084015261538460c0850161526c565b60c084015261539560e0850161526c565b60e084015261010091506153aa82850161526c565b8284015261012091506153be82850161526c565b8284015261014091506153d282850161526c565b8284015261016091506153e682850161526c565b8284015261018091506153fa82850161526c565b828401526101a0915061540e828501614e94565b828401526101c09150818401518181111561542857600080fd5b61436186828701614ebc565b60006080828403121561544657600080fd5b604051608081016001600160401b03828210818311171561546957615469613fdf565b816040528293508451915061547d82613f76565b81835261548c60208601614f35565b602084015260408501519150808211156154a557600080fd5b506154b285828601614ebc565b604083015250606083015160608201525092915050565b600060c082840312156154db57600080fd5b6154e361401e565b905081516001600160401b03808211156154fc57600080fd5b615508858386016152db565b835261551660208501614e66565b6020840152604084015191508082111561552f57600080fd5b61553b85838601615434565b6040840152606084015191508082111561555457600080fd5b61556085838601615434565b6060840152608084015191508082111561557957600080fd5b5061558684828501614ebc565b60808301525061559860a08301614f35565b60a082015292915050565b6000602082840312156155b557600080fd5b81516001600160401b038111156155cb57600080fd5b613bf7848285016154c9565b634e487b7160e01b600052601260045260246000fd5b600063ffffffff80841680615604576156046155d7565b92169190910492915050565b63ffffffff81811683821602808216919082811461563057615630614f61565b505092915050565b6000806040838503121561564b57600080fd5b61565483614e3b565b915060208301516001600160401b0381111561566f57600080fd5b614991858286016154c9565b7f19457468657265756d205369676e6564204d6573736167653a0a0000000000008152600083516156b381601a85016020880161441c565b8351908301906156ca81601a84016020880161441c565b01601a01949350505050565b6000826156e5576156e56155d7565b500490565b808202811582820484141761211657612116614f61565b634e487b7160e01b600052602160045260246000fdfe360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220623545b3dab397b31826b23d976cdd61294c2b5d63977c281b5bba2b46d587ee64736f6c63430008110033" +} \ No newline at end of file diff --git a/deployments/filecoin/Distributor.json b/deployments/filecoin/Distributor.json new file mode 100644 index 0000000..5f0a724 --- /dev/null +++ b/deployments/filecoin/Distributor.json @@ -0,0 +1,132 @@ +{ + "address": "0x3Ef3D8bA38EBe18DB133cEc108f4D14CE00Dd9Ae", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_logic", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "stateMutability": "payable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "previousAdmin", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "AdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "beacon", + "type": "address" + } + ], + "name": "BeaconUpgraded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "stateMutability": "payable", + "type": "receive" + } + ], + "transactionHash": "0xb4a3cc3cc469b027224e862f1bd06f2faa8b7fc973e671f2f0ea14010bc8a49b", + "receipt": { + "to": null, + "from": "0x9f76a95AA7535bb0893cf88A146396e00ed21A12", + "contractAddress": "0x3Ef3D8bA38EBe18DB133cEc108f4D14CE00Dd9Ae", + "transactionIndex": 109, + "gasUsed": "59340745", + "logsBloom": "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", + "blockHash": "0xfbba955049b83619ea69e8e911e0e3287450ec5f2bce1995a95a3f6408da1bb5", + "transactionHash": "0xb4a3cc3cc469b027224e862f1bd06f2faa8b7fc973e671f2f0ea14010bc8a49b", + "logs": [ + { + "transactionIndex": 109, + "blockNumber": 3365860, + "transactionHash": "0xb4a3cc3cc469b027224e862f1bd06f2faa8b7fc973e671f2f0ea14010bc8a49b", + "address": "0x3Ef3D8bA38EBe18DB133cEc108f4D14CE00Dd9Ae", + "topics": [ + "0xbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b", + "0x000000000000000000000000918261fa5dd9c3b1358ca911792e9bdf3c5cca35" + ], + "data": "0x", + "logIndex": 0, + "blockHash": "0xfbba955049b83619ea69e8e911e0e3287450ec5f2bce1995a95a3f6408da1bb5" + } + ], + "blockNumber": 3365860, + "cumulativeGasUsed": "0", + "status": 1, + "byzantium": true + }, + "args": [ + "0x918261fa5Dd9C3b1358cA911792E9bDF3c5CCa35", + "0x" + ], + "numDeployments": 1, + "solcInputHash": "e77f17fbb4334e4df730b35bdfde2517", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_logic\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"previousAdmin\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"AdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"beacon\",\"type\":\"address\"}],\"name\":\"BeaconUpgraded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"implementation\",\"type\":\"address\"}],\"name\":\"Upgraded\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"details\":\"This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an implementation address that can be changed. This address is stored in storage in the location specified by https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the implementation behind the proxy.\",\"kind\":\"dev\",\"methods\":{\"constructor\":{\"details\":\"Initializes the upgradeable proxy with an initial implementation specified by `_logic`. If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded function call, and allows initializing the storage of the proxy like a Solidity constructor.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol\":\"ERC1967Proxy\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":100000},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/interfaces/draft-IERC1822.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\\n * proxy whose upgrades are fully controlled by the current implementation.\\n */\\ninterface IERC1822Proxiable {\\n /**\\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\\n * address.\\n *\\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\\n * function revert if invoked through a proxy.\\n */\\n function proxiableUUID() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0x1d4afe6cb24200cc4545eed814ecf5847277dfe5d613a1707aad5fceecebcfff\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/ERC1967/ERC1967Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../Proxy.sol\\\";\\nimport \\\"./ERC1967Upgrade.sol\\\";\\n\\n/**\\n * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an\\n * implementation address that can be changed. This address is stored in storage in the location specified by\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the\\n * implementation behind the proxy.\\n */\\ncontract ERC1967Proxy is Proxy, ERC1967Upgrade {\\n /**\\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.\\n *\\n * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded\\n * function call, and allows initializing the storage of the proxy like a Solidity constructor.\\n */\\n constructor(address _logic, bytes memory _data) payable {\\n _upgradeToAndCall(_logic, _data, false);\\n }\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _implementation() internal view virtual override returns (address impl) {\\n return ERC1967Upgrade._getImplementation();\\n }\\n}\\n\",\"keccak256\":\"0xa2b22da3032e50b55f95ec1d13336102d675f341167aa76db571ef7f8bb7975d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/ERC1967/ERC1967Upgrade.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (proxy/ERC1967/ERC1967Upgrade.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../beacon/IBeacon.sol\\\";\\nimport \\\"../../interfaces/draft-IERC1822.sol\\\";\\nimport \\\"../../utils/Address.sol\\\";\\nimport \\\"../../utils/StorageSlot.sol\\\";\\n\\n/**\\n * @dev This abstract contract provides getters and event emitting update functions for\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\\n *\\n * _Available since v4.1._\\n *\\n * @custom:oz-upgrades-unsafe-allow delegatecall\\n */\\nabstract contract ERC1967Upgrade {\\n // This is the keccak-256 hash of \\\"eip1967.proxy.rollback\\\" subtracted by 1\\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\\n\\n /**\\n * @dev Storage slot with the address of the current implementation.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n /**\\n * @dev Emitted when the implementation is upgraded.\\n */\\n event Upgraded(address indexed implementation);\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _getImplementation() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 implementation slot.\\n */\\n function _setImplementation(address newImplementation) private {\\n require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n }\\n\\n /**\\n * @dev Perform implementation upgrade\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeTo(address newImplementation) internal {\\n _setImplementation(newImplementation);\\n emit Upgraded(newImplementation);\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCall(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _upgradeTo(newImplementation);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(newImplementation, data);\\n }\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCallUUPS(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n // Upgrades from old implementations will perform a rollback test. This test requires the new\\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\\n // this special case will break upgrade paths from old UUPS implementation to new ones.\\n if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) {\\n _setImplementation(newImplementation);\\n } else {\\n try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {\\n require(slot == _IMPLEMENTATION_SLOT, \\\"ERC1967Upgrade: unsupported proxiableUUID\\\");\\n } catch {\\n revert(\\\"ERC1967Upgrade: new implementation is not UUPS\\\");\\n }\\n _upgradeToAndCall(newImplementation, data, forceCall);\\n }\\n }\\n\\n /**\\n * @dev Storage slot with the admin of the contract.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.admin\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n /**\\n * @dev Emitted when the admin account has changed.\\n */\\n event AdminChanged(address previousAdmin, address newAdmin);\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _getAdmin() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 admin slot.\\n */\\n function _setAdmin(address newAdmin) private {\\n require(newAdmin != address(0), \\\"ERC1967: new admin is the zero address\\\");\\n StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n */\\n function _changeAdmin(address newAdmin) internal {\\n emit AdminChanged(_getAdmin(), newAdmin);\\n _setAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\\n */\\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\\n\\n /**\\n * @dev Emitted when the beacon is upgraded.\\n */\\n event BeaconUpgraded(address indexed beacon);\\n\\n /**\\n * @dev Returns the current beacon.\\n */\\n function _getBeacon() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_BEACON_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new beacon in the EIP1967 beacon slot.\\n */\\n function _setBeacon(address newBeacon) private {\\n require(Address.isContract(newBeacon), \\\"ERC1967: new beacon is not a contract\\\");\\n require(\\n Address.isContract(IBeacon(newBeacon).implementation()),\\n \\\"ERC1967: beacon implementation is not a contract\\\"\\n );\\n StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon;\\n }\\n\\n /**\\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\\n *\\n * Emits a {BeaconUpgraded} event.\\n */\\n function _upgradeBeaconToAndCall(\\n address newBeacon,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _setBeacon(newBeacon);\\n emit BeaconUpgraded(newBeacon);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xabf3f59bc0e5423eae45e459dbe92e7052c6983628d39008590edc852a62f94a\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (proxy/Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\\n * be specified by overriding the virtual {_implementation} function.\\n *\\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\\n * different contract through the {_delegate} function.\\n *\\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\\n */\\nabstract contract Proxy {\\n /**\\n * @dev Delegates the current call to `implementation`.\\n *\\n * This function does not return to its internal call site, it will return directly to the external caller.\\n */\\n function _delegate(address implementation) internal virtual {\\n assembly {\\n // Copy msg.data. We take full control of memory in this inline assembly\\n // block because it will not return to Solidity code. We overwrite the\\n // Solidity scratch pad at memory position 0.\\n calldatacopy(0, 0, calldatasize())\\n\\n // Call the implementation.\\n // out and outsize are 0 because we don't know the size yet.\\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\\n\\n // Copy the returned data.\\n returndatacopy(0, 0, returndatasize())\\n\\n switch result\\n // delegatecall returns 0 on error.\\n case 0 {\\n revert(0, returndatasize())\\n }\\n default {\\n return(0, returndatasize())\\n }\\n }\\n }\\n\\n /**\\n * @dev This is a virtual function that should be overridden so it returns the address to which the fallback function\\n * and {_fallback} should delegate.\\n */\\n function _implementation() internal view virtual returns (address);\\n\\n /**\\n * @dev Delegates the current call to the address returned by `_implementation()`.\\n *\\n * This function does not return to its internal call site, it will return directly to the external caller.\\n */\\n function _fallback() internal virtual {\\n _beforeFallback();\\n _delegate(_implementation());\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\\n * function in the contract matches the call data.\\n */\\n fallback() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data\\n * is empty.\\n */\\n receive() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`\\n * call, or as part of the Solidity `fallback` or `receive` functions.\\n *\\n * If overridden should call `super._beforeFallback()`.\\n */\\n function _beforeFallback() internal virtual {}\\n}\\n\",\"keccak256\":\"0xc130fe33f1b2132158531a87734153293f6d07bc263ff4ac90e85da9c82c0e27\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/beacon/IBeacon.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\\n */\\ninterface IBeacon {\\n /**\\n * @dev Must return an address that can be used as a delegate call target.\\n *\\n * {BeaconProxy} will check that this address is a contract.\\n */\\n function implementation() external view returns (address);\\n}\\n\",\"keccak256\":\"0xd50a3421ac379ccb1be435fa646d66a65c986b4924f0849839f08692f39dde61\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\n *\\n * _Available since v4.8._\\n */\\n function verifyCallResultFromTarget(\\n address target,\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n if (success) {\\n if (returndata.length == 0) {\\n // only check isContract if the call was successful and the return data is empty\\n // otherwise we already know that it was a contract\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n }\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason or using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xf96f969e24029d43d0df89e59d365f277021dac62b48e1c1e3ebe0acdd7f1ca1\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/StorageSlot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/StorageSlot.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for reading and writing primitive types to specific storage slots.\\n *\\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\\n * This library helps with reading and writing to such slots without the need for inline assembly.\\n *\\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\\n *\\n * Example usage to set ERC1967 implementation slot:\\n * ```\\n * contract ERC1967 {\\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n *\\n * function _getImplementation() internal view returns (address) {\\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n * }\\n *\\n * function _setImplementation(address newImplementation) internal {\\n * require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n * }\\n * }\\n * ```\\n *\\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\\n */\\nlibrary StorageSlot {\\n struct AddressSlot {\\n address value;\\n }\\n\\n struct BooleanSlot {\\n bool value;\\n }\\n\\n struct Bytes32Slot {\\n bytes32 value;\\n }\\n\\n struct Uint256Slot {\\n uint256 value;\\n }\\n\\n /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\\n */\\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\\n */\\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\\n */\\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd5c50c54bf02740ebd122ff06832546cb5fa84486d52695a9ccfd11666e0c81d\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x60806040526040516107ad3803806107ad83398101604081905261002291610319565b61002e82826000610035565b5050610436565b61003e8361006b565b60008251118061004b5750805b156100665761006483836100ab60201b6100291760201c565b505b505050565b610074816100d7565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b60606100d08383604051806060016040528060278152602001610786602791396101a9565b9392505050565b6100ea8161022260201b6100551760201c565b6101515760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b60648201526084015b60405180910390fd5b806101887f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc60001b61023160201b6100711760201c565b80546001600160a01b0319166001600160a01b039290921691909117905550565b6060600080856001600160a01b0316856040516101c691906103e7565b600060405180830381855af49150503d8060008114610201576040519150601f19603f3d011682016040523d82523d6000602084013e610206565b606091505b50909250905061021886838387610234565b9695505050505050565b6001600160a01b03163b151590565b90565b606083156102a357825160000361029c576001600160a01b0385163b61029c5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610148565b50816102ad565b6102ad83836102b5565b949350505050565b8151156102c55781518083602001fd5b8060405162461bcd60e51b81526004016101489190610403565b634e487b7160e01b600052604160045260246000fd5b60005b838110156103105781810151838201526020016102f8565b50506000910152565b6000806040838503121561032c57600080fd5b82516001600160a01b038116811461034357600080fd5b60208401519092506001600160401b038082111561036057600080fd5b818501915085601f83011261037457600080fd5b815181811115610386576103866102df565b604051601f8201601f19908116603f011681019083821181831017156103ae576103ae6102df565b816040528281528860208487010111156103c757600080fd5b6103d88360208301602088016102f5565b80955050505050509250929050565b600082516103f98184602087016102f5565b9190910192915050565b60208152600082518060208401526104228160408501602087016102f5565b601f01601f19169190910160400192915050565b610341806104456000396000f3fe60806040523661001357610011610017565b005b6100115b610027610022610074565b6100b9565b565b606061004e83836040518060600160405280602781526020016102e5602791396100dd565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b90565b60006100b47f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5473ffffffffffffffffffffffffffffffffffffffff1690565b905090565b3660008037600080366000845af43d6000803e8080156100d8573d6000f35b3d6000fd5b60606000808573ffffffffffffffffffffffffffffffffffffffff16856040516101079190610277565b600060405180830381855af49150503d8060008114610142576040519150601f19603f3d011682016040523d82523d6000602084013e610147565b606091505b509150915061015886838387610162565b9695505050505050565b606083156101fd5782516000036101f65773ffffffffffffffffffffffffffffffffffffffff85163b6101f6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064015b60405180910390fd5b5081610207565b610207838361020f565b949350505050565b81511561021f5781518083602001fd5b806040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016101ed9190610293565b60005b8381101561026e578181015183820152602001610256565b50506000910152565b60008251610289818460208701610253565b9190910192915050565b60208152600082518060208401526102b2816040850160208701610253565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a26469706673582212208d6f628b23c1e021c9b2ae38fc6a126b22b03b9629f5dfe1de8fc7f044229aec64736f6c63430008110033416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564", + "deployedBytecode": "0x60806040523661001357610011610017565b005b6100115b610027610022610074565b6100b9565b565b606061004e83836040518060600160405280602781526020016102e5602791396100dd565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b90565b60006100b47f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5473ffffffffffffffffffffffffffffffffffffffff1690565b905090565b3660008037600080366000845af43d6000803e8080156100d8573d6000f35b3d6000fd5b60606000808573ffffffffffffffffffffffffffffffffffffffff16856040516101079190610277565b600060405180830381855af49150503d8060008114610142576040519150601f19603f3d011682016040523d82523d6000602084013e610147565b606091505b509150915061015886838387610162565b9695505050505050565b606083156101fd5782516000036101f65773ffffffffffffffffffffffffffffffffffffffff85163b6101f6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064015b60405180910390fd5b5081610207565b610207838361020f565b949350505050565b81511561021f5781518083602001fd5b806040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016101ed9190610293565b60005b8381101561026e578181015183820152602001610256565b50506000910152565b60008251610289818460208701610253565b9190910192915050565b60208152600082518060208401526102b2816040850160208701610253565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a26469706673582212208d6f628b23c1e021c9b2ae38fc6a126b22b03b9629f5dfe1de8fc7f044229aec64736f6c63430008110033", + "devdoc": { + "details": "This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an implementation address that can be changed. This address is stored in storage in the location specified by https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the implementation behind the proxy.", + "kind": "dev", + "methods": { + "constructor": { + "details": "Initializes the upgradeable proxy with an initial implementation specified by `_logic`. If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded function call, and allows initializing the storage of the proxy like a Solidity constructor." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/deployments/filecoin/Distributor_Implementation_2.json b/deployments/filecoin/Distributor_Implementation_2.json new file mode 100644 index 0000000..26854e5 --- /dev/null +++ b/deployments/filecoin/Distributor_Implementation_2.json @@ -0,0 +1,1248 @@ +{ + "address": "0x918261fa5Dd9C3b1358cA911792E9bDF3c5CCa35", + "abi": [ + { + "inputs": [], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "InvalidDispute", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidLengths", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidProof", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidUninitializedRoot", + "type": "error" + }, + { + "inputs": [], + "name": "NoDispute", + "type": "error" + }, + { + "inputs": [], + "name": "NotGovernorOrGuardian", + "type": "error" + }, + { + "inputs": [], + "name": "NotTrusted", + "type": "error" + }, + { + "inputs": [], + "name": "NotWhitelisted", + "type": "error" + }, + { + "inputs": [], + "name": "UnresolvedDispute", + "type": "error" + }, + { + "inputs": [], + "name": "ZeroAddress", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "previousAdmin", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "AdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "beacon", + "type": "address" + } + ], + "name": "BeaconUpgraded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Claimed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "_disputeAmount", + "type": "uint256" + } + ], + "name": "DisputeAmountUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint48", + "name": "_disputePeriod", + "type": "uint48" + } + ], + "name": "DisputePeriodUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "bool", + "name": "valid", + "type": "bool" + } + ], + "name": "DisputeResolved", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "_disputeToken", + "type": "address" + } + ], + "name": "DisputeTokenUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "string", + "name": "reason", + "type": "string" + } + ], + "name": "Disputed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "isEnabled", + "type": "bool" + } + ], + "name": "OperatorClaimingToggled", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "isWhitelisted", + "type": "bool" + } + ], + "name": "OperatorToggled", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Recovered", + "type": "event" + }, + { + "anonymous": false, + "inputs": [], + "name": "Revoked", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "bytes32", + "name": "merkleRoot", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "ipfsHash", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "uint48", + "name": "endOfDisputePeriod", + "type": "uint48" + } + ], + "name": "TreeUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "eoa", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "trust", + "type": "bool" + } + ], + "name": "TrustedToggled", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "canUpdateMerkleRoot", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "users", + "type": "address[]" + }, + { + "internalType": "address[]", + "name": "tokens", + "type": "address[]" + }, + { + "internalType": "uint256[]", + "name": "amounts", + "type": "uint256[]" + }, + { + "internalType": "bytes32[][]", + "name": "proofs", + "type": "bytes32[][]" + } + ], + "name": "claim", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "claimed", + "outputs": [ + { + "internalType": "uint208", + "name": "amount", + "type": "uint208" + }, + { + "internalType": "uint48", + "name": "timestamp", + "type": "uint48" + }, + { + "internalType": "bytes32", + "name": "merkleRoot", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "core", + "outputs": [ + { + "internalType": "contract ICore", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "disputeAmount", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "disputePeriod", + "outputs": [ + { + "internalType": "uint48", + "name": "", + "type": "uint48" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "disputeToken", + "outputs": [ + { + "internalType": "contract IERC20", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "reason", + "type": "string" + } + ], + "name": "disputeTree", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "disputer", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "endOfDisputePeriod", + "outputs": [ + { + "internalType": "uint48", + "name": "", + "type": "uint48" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getMerkleRoot", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract ICore", + "name": "_core", + "type": "address" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "lastTree", + "outputs": [ + { + "internalType": "bytes32", + "name": "merkleRoot", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "ipfsHash", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "onlyOperatorCanClaim", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "operators", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "proxiableUUID", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "tokenAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amountToRecover", + "type": "uint256" + } + ], + "name": "recoverERC20", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bool", + "name": "valid", + "type": "bool" + } + ], + "name": "resolveDispute", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "revokeTree", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_disputeAmount", + "type": "uint256" + } + ], + "name": "setDisputeAmount", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint48", + "name": "_disputePeriod", + "type": "uint48" + } + ], + "name": "setDisputePeriod", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IERC20", + "name": "_disputeToken", + "type": "address" + } + ], + "name": "setDisputeToken", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "user", + "type": "address" + } + ], + "name": "toggleOnlyOperatorCanClaim", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "internalType": "address", + "name": "operator", + "type": "address" + } + ], + "name": "toggleOperator", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "eoa", + "type": "address" + } + ], + "name": "toggleTrusted", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "tree", + "outputs": [ + { + "internalType": "bytes32", + "name": "merkleRoot", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "ipfsHash", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "bytes32", + "name": "merkleRoot", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "ipfsHash", + "type": "bytes32" + } + ], + "internalType": "struct MerkleTree", + "name": "_tree", + "type": "tuple" + } + ], + "name": "updateTree", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "upgradeTo", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "upgradeToAndCall", + "outputs": [], + "stateMutability": "payable", + "type": "function" + } + ], + "transactionHash": "0xee41ef123b2d0ef5eb48b02a13553cdfb1c3606fff4ddefdeeb4278e733f82de", + "receipt": { + "to": null, + "from": "0x9f76a95AA7535bb0893cf88A146396e00ed21A12", + "contractAddress": "0x918261fa5Dd9C3b1358cA911792E9bDF3c5CCa35", + "transactionIndex": 153, + "gasUsed": "121666852", + "logsBloom": "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", + "blockHash": "0x081e9fa7659be2b2194a043363df4ab8542e2e26add3903a6676b5a58cfcdf18", + "transactionHash": "0xee41ef123b2d0ef5eb48b02a13553cdfb1c3606fff4ddefdeeb4278e733f82de", + "logs": [ + { + "transactionIndex": 153, + "blockNumber": 3365852, + "transactionHash": "0xee41ef123b2d0ef5eb48b02a13553cdfb1c3606fff4ddefdeeb4278e733f82de", + "address": "0x918261fa5Dd9C3b1358cA911792E9bDF3c5CCa35", + "topics": [ + "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000000001", + "logIndex": 0, + "blockHash": "0x081e9fa7659be2b2194a043363df4ab8542e2e26add3903a6676b5a58cfcdf18" + }, + { + "transactionIndex": 153, + "blockNumber": 3365852, + "transactionHash": "0xee41ef123b2d0ef5eb48b02a13553cdfb1c3606fff4ddefdeeb4278e733f82de", + "address": "0x918261fa5Dd9C3b1358cA911792E9bDF3c5CCa35", + "topics": [ + "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000000001", + "logIndex": 1, + "blockHash": "0x081e9fa7659be2b2194a043363df4ab8542e2e26add3903a6676b5a58cfcdf18" + } + ], + "blockNumber": 3365852, + "cumulativeGasUsed": "0", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 1, + "solcInputHash": "1d17a992f70400315a977c7229541e31", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"InvalidDispute\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidLengths\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidProof\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidUninitializedRoot\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NoDispute\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotGovernorOrGuardian\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotTrusted\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotWhitelisted\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"UnresolvedDispute\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ZeroAddress\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"previousAdmin\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"AdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"beacon\",\"type\":\"address\"}],\"name\":\"BeaconUpgraded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"Claimed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_disputeAmount\",\"type\":\"uint256\"}],\"name\":\"DisputeAmountUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint48\",\"name\":\"_disputePeriod\",\"type\":\"uint48\"}],\"name\":\"DisputePeriodUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"valid\",\"type\":\"bool\"}],\"name\":\"DisputeResolved\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_disputeToken\",\"type\":\"address\"}],\"name\":\"DisputeTokenUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"string\",\"name\":\"reason\",\"type\":\"string\"}],\"name\":\"Disputed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"isEnabled\",\"type\":\"bool\"}],\"name\":\"OperatorClaimingToggled\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"isWhitelisted\",\"type\":\"bool\"}],\"name\":\"OperatorToggled\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"Recovered\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[],\"name\":\"Revoked\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"merkleRoot\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"ipfsHash\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint48\",\"name\":\"endOfDisputePeriod\",\"type\":\"uint48\"}],\"name\":\"TreeUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"eoa\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"trust\",\"type\":\"bool\"}],\"name\":\"TrustedToggled\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"implementation\",\"type\":\"address\"}],\"name\":\"Upgraded\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"canUpdateMerkleRoot\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"users\",\"type\":\"address[]\"},{\"internalType\":\"address[]\",\"name\":\"tokens\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"},{\"internalType\":\"bytes32[][]\",\"name\":\"proofs\",\"type\":\"bytes32[][]\"}],\"name\":\"claim\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"claimed\",\"outputs\":[{\"internalType\":\"uint208\",\"name\":\"amount\",\"type\":\"uint208\"},{\"internalType\":\"uint48\",\"name\":\"timestamp\",\"type\":\"uint48\"},{\"internalType\":\"bytes32\",\"name\":\"merkleRoot\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"core\",\"outputs\":[{\"internalType\":\"contract ICore\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"disputeAmount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"disputePeriod\",\"outputs\":[{\"internalType\":\"uint48\",\"name\":\"\",\"type\":\"uint48\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"disputeToken\",\"outputs\":[{\"internalType\":\"contract IERC20\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"reason\",\"type\":\"string\"}],\"name\":\"disputeTree\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"disputer\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"endOfDisputePeriod\",\"outputs\":[{\"internalType\":\"uint48\",\"name\":\"\",\"type\":\"uint48\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getMerkleRoot\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract ICore\",\"name\":\"_core\",\"type\":\"address\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"lastTree\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"merkleRoot\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"ipfsHash\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"onlyOperatorCanClaim\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"operators\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"proxiableUUID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"tokenAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amountToRecover\",\"type\":\"uint256\"}],\"name\":\"recoverERC20\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bool\",\"name\":\"valid\",\"type\":\"bool\"}],\"name\":\"resolveDispute\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"revokeTree\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_disputeAmount\",\"type\":\"uint256\"}],\"name\":\"setDisputeAmount\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint48\",\"name\":\"_disputePeriod\",\"type\":\"uint48\"}],\"name\":\"setDisputePeriod\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract IERC20\",\"name\":\"_disputeToken\",\"type\":\"address\"}],\"name\":\"setDisputeToken\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"}],\"name\":\"toggleOnlyOperatorCanClaim\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"}],\"name\":\"toggleOperator\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"eoa\",\"type\":\"address\"}],\"name\":\"toggleTrusted\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"tree\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"merkleRoot\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"ipfsHash\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"merkleRoot\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"ipfsHash\",\"type\":\"bytes32\"}],\"internalType\":\"struct MerkleTree\",\"name\":\"_tree\",\"type\":\"tuple\"}],\"name\":\"updateTree\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"}],\"name\":\"upgradeTo\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"upgradeToAndCall\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"}],\"devdoc\":{\"author\":\"Angle Labs. Inc\",\"kind\":\"dev\",\"methods\":{\"claim(address[],address[],uint256[],bytes32[][])\":{\"details\":\"Anyone may call this function for anyone else, funds go to destination regardless, it's just a question of who provides the proof and pays the gas: `msg.sender` is used only for addresses that require a trusted operator\",\"params\":{\"amounts\":\"Amount of tokens that will be sent to the corresponding users\",\"proofs\":\"Array of hashes bridging from a leaf `(hash of user | token | amount)` to the Merkle root\",\"tokens\":\"ERC20 claimed\",\"users\":\"Recipient of tokens\"}},\"disputeTree(string)\":{\"details\":\"Requires a deposit of `disputeToken` that'll be slashed if the dispute is not acceptedIt is only possible to create a dispute within `disputePeriod` after each tree update\"},\"proxiableUUID()\":{\"details\":\"Implementation of the ERC1822 {proxiableUUID} function. This returns the storage slot used by the implementation. It is used to validate the implementation's compatibility when performing an upgrade. IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this function revert if invoked through a proxy. This is guaranteed by the `notDelegated` modifier.\"},\"resolveDispute(bool)\":{\"params\":{\"valid\":\"Whether the dispute was valid\"}},\"upgradeTo(address)\":{\"details\":\"Upgrade the implementation of the proxy to `newImplementation`. Calls {_authorizeUpgrade}. Emits an {Upgraded} event.\"},\"upgradeToAndCall(address,bytes)\":{\"details\":\"Upgrade the implementation of the proxy to `newImplementation`, and subsequently execute the function call encoded in `data`. Calls {_authorizeUpgrade}. Emits an {Upgraded} event.\"}},\"stateVariables\":{\"disputer\":{\"details\":\"Used to store if there is an ongoing dispute\"}},\"title\":\"Distributor\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"canUpdateMerkleRoot(address)\":{\"notice\":\"Trusted EOAs to update the Merkle root\"},\"claim(address[],address[],uint256[],bytes32[][])\":{\"notice\":\"Claims rewards for a given set of users\"},\"claimed(address,address)\":{\"notice\":\"Mapping user -> token -> amount to track claimed amounts\"},\"core()\":{\"notice\":\"`Core` contract handling access control\"},\"disputeAmount()\":{\"notice\":\"Amount to deposit to freeze the roots update\"},\"disputePeriod()\":{\"notice\":\"Time after which a change in a tree becomes effective, in EPOCH_DURATION\"},\"disputeToken()\":{\"notice\":\"Token to deposit to freeze the roots update\"},\"disputeTree(string)\":{\"notice\":\"Freezes the Merkle tree update until the dispute is resolved\"},\"disputer()\":{\"notice\":\"Address which created the dispute\"},\"endOfDisputePeriod()\":{\"notice\":\"When the current tree will become valid\"},\"getMerkleRoot()\":{\"notice\":\"Returns the MerkleRoot that is currently live for the contract\"},\"lastTree()\":{\"notice\":\"Tree that was in place in the contract before the last `tree` update\"},\"onlyOperatorCanClaim(address)\":{\"notice\":\"Whether or not to disable permissionless claiming\"},\"operators(address,address)\":{\"notice\":\"user -> operator -> authorisation to claim\"},\"recoverERC20(address,address,uint256)\":{\"notice\":\"Recovers any ERC20 token\"},\"resolveDispute(bool)\":{\"notice\":\"Resolve the ongoing dispute, if any\"},\"revokeTree()\":{\"notice\":\"Allows the governor or the guardian of this contract to fallback to the last version of the tree immediately\"},\"setDisputeAmount(uint256)\":{\"notice\":\"Sets the amount of `disputeToken` used as a caution during disputes\"},\"setDisputePeriod(uint48)\":{\"notice\":\"Sets the dispute period after which a tree update becomes effective\"},\"setDisputeToken(address)\":{\"notice\":\"Sets the token used as a caution during disputes\"},\"toggleOnlyOperatorCanClaim(address)\":{\"notice\":\"Toggles permissioned claiming for a given user\"},\"toggleOperator(address,address)\":{\"notice\":\"Toggles whitelisting for a given user and a given operator\"},\"toggleTrusted(address)\":{\"notice\":\"Adds or removes EOAs which are trusted to update the Merkle root\"},\"tree()\":{\"notice\":\"Tree of claimable tokens through this contract\"},\"updateTree((bytes32,bytes32))\":{\"notice\":\"Updates Merkle Tree\"}},\"notice\":\"Allows LPs on AMMs with concentrated liquidity to claim the rewards that were distributed to them\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/Distributor.sol\":\"Distributor\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":100000},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts-upgradeable/interfaces/draft-IERC1822Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\\n * proxy whose upgrades are fully controlled by the current implementation.\\n */\\ninterface IERC1822ProxiableUpgradeable {\\n /**\\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\\n * address.\\n *\\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\\n * function revert if invoked through a proxy.\\n */\\n function proxiableUUID() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0x77c89f893e403efc6929ba842b7ccf6534d4ffe03afe31670b4a528c0ad78c0f\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/proxy/ERC1967/ERC1967UpgradeUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (proxy/ERC1967/ERC1967Upgrade.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../beacon/IBeaconUpgradeable.sol\\\";\\nimport \\\"../../interfaces/draft-IERC1822Upgradeable.sol\\\";\\nimport \\\"../../utils/AddressUpgradeable.sol\\\";\\nimport \\\"../../utils/StorageSlotUpgradeable.sol\\\";\\nimport \\\"../utils/Initializable.sol\\\";\\n\\n/**\\n * @dev This abstract contract provides getters and event emitting update functions for\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\\n *\\n * _Available since v4.1._\\n *\\n * @custom:oz-upgrades-unsafe-allow delegatecall\\n */\\nabstract contract ERC1967UpgradeUpgradeable is Initializable {\\n function __ERC1967Upgrade_init() internal onlyInitializing {\\n }\\n\\n function __ERC1967Upgrade_init_unchained() internal onlyInitializing {\\n }\\n // This is the keccak-256 hash of \\\"eip1967.proxy.rollback\\\" subtracted by 1\\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\\n\\n /**\\n * @dev Storage slot with the address of the current implementation.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n /**\\n * @dev Emitted when the implementation is upgraded.\\n */\\n event Upgraded(address indexed implementation);\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _getImplementation() internal view returns (address) {\\n return StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 implementation slot.\\n */\\n function _setImplementation(address newImplementation) private {\\n require(AddressUpgradeable.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n }\\n\\n /**\\n * @dev Perform implementation upgrade\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeTo(address newImplementation) internal {\\n _setImplementation(newImplementation);\\n emit Upgraded(newImplementation);\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCall(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _upgradeTo(newImplementation);\\n if (data.length > 0 || forceCall) {\\n _functionDelegateCall(newImplementation, data);\\n }\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCallUUPS(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n // Upgrades from old implementations will perform a rollback test. This test requires the new\\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\\n // this special case will break upgrade paths from old UUPS implementation to new ones.\\n if (StorageSlotUpgradeable.getBooleanSlot(_ROLLBACK_SLOT).value) {\\n _setImplementation(newImplementation);\\n } else {\\n try IERC1822ProxiableUpgradeable(newImplementation).proxiableUUID() returns (bytes32 slot) {\\n require(slot == _IMPLEMENTATION_SLOT, \\\"ERC1967Upgrade: unsupported proxiableUUID\\\");\\n } catch {\\n revert(\\\"ERC1967Upgrade: new implementation is not UUPS\\\");\\n }\\n _upgradeToAndCall(newImplementation, data, forceCall);\\n }\\n }\\n\\n /**\\n * @dev Storage slot with the admin of the contract.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.admin\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n /**\\n * @dev Emitted when the admin account has changed.\\n */\\n event AdminChanged(address previousAdmin, address newAdmin);\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _getAdmin() internal view returns (address) {\\n return StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 admin slot.\\n */\\n function _setAdmin(address newAdmin) private {\\n require(newAdmin != address(0), \\\"ERC1967: new admin is the zero address\\\");\\n StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n */\\n function _changeAdmin(address newAdmin) internal {\\n emit AdminChanged(_getAdmin(), newAdmin);\\n _setAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\\n */\\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\\n\\n /**\\n * @dev Emitted when the beacon is upgraded.\\n */\\n event BeaconUpgraded(address indexed beacon);\\n\\n /**\\n * @dev Returns the current beacon.\\n */\\n function _getBeacon() internal view returns (address) {\\n return StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new beacon in the EIP1967 beacon slot.\\n */\\n function _setBeacon(address newBeacon) private {\\n require(AddressUpgradeable.isContract(newBeacon), \\\"ERC1967: new beacon is not a contract\\\");\\n require(\\n AddressUpgradeable.isContract(IBeaconUpgradeable(newBeacon).implementation()),\\n \\\"ERC1967: beacon implementation is not a contract\\\"\\n );\\n StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value = newBeacon;\\n }\\n\\n /**\\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\\n *\\n * Emits a {BeaconUpgraded} event.\\n */\\n function _upgradeBeaconToAndCall(\\n address newBeacon,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _setBeacon(newBeacon);\\n emit BeaconUpgraded(newBeacon);\\n if (data.length > 0 || forceCall) {\\n _functionDelegateCall(IBeaconUpgradeable(newBeacon).implementation(), data);\\n }\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function _functionDelegateCall(address target, bytes memory data) private returns (bytes memory) {\\n require(AddressUpgradeable.isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n // solhint-disable-next-line avoid-low-level-calls\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return AddressUpgradeable.verifyCallResult(success, returndata, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[50] private __gap;\\n}\\n\",\"keccak256\":\"0x315887e846f1e5f8d8fa535a229d318bb9290aaa69485117f1ee8a9a6b3be823\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/proxy/beacon/IBeaconUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\\n */\\ninterface IBeaconUpgradeable {\\n /**\\n * @dev Must return an address that can be used as a delegate call target.\\n *\\n * {BeaconProxy} will check that this address is a contract.\\n */\\n function implementation() external view returns (address);\\n}\\n\",\"keccak256\":\"0x24b86ac8c005b8c654fbf6ac34a5a4f61580d7273541e83e013e89d66fbf0908\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.1) (proxy/utils/Initializable.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../../utils/AddressUpgradeable.sol\\\";\\n\\n/**\\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\\n *\\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\\n * reused. This mechanism prevents re-execution of each \\\"step\\\" but allows the creation of new initialization steps in\\n * case an upgrade adds a module that needs to be initialized.\\n *\\n * For example:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * contract MyToken is ERC20Upgradeable {\\n * function initialize() initializer public {\\n * __ERC20_init(\\\"MyToken\\\", \\\"MTK\\\");\\n * }\\n * }\\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\\n * function initializeV2() reinitializer(2) public {\\n * __ERC20Permit_init(\\\"MyToken\\\");\\n * }\\n * }\\n * ```\\n *\\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\\n *\\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\\n *\\n * [CAUTION]\\n * ====\\n * Avoid leaving a contract uninitialized.\\n *\\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * /// @custom:oz-upgrades-unsafe-allow constructor\\n * constructor() {\\n * _disableInitializers();\\n * }\\n * ```\\n * ====\\n */\\nabstract contract Initializable {\\n /**\\n * @dev Indicates that the contract has been initialized.\\n * @custom:oz-retyped-from bool\\n */\\n uint8 private _initialized;\\n\\n /**\\n * @dev Indicates that the contract is in the process of being initialized.\\n */\\n bool private _initializing;\\n\\n /**\\n * @dev Triggered when the contract has been initialized or reinitialized.\\n */\\n event Initialized(uint8 version);\\n\\n /**\\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\\n * `onlyInitializing` functions can be used to initialize parent contracts.\\n *\\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\\n * constructor.\\n *\\n * Emits an {Initialized} event.\\n */\\n modifier initializer() {\\n bool isTopLevelCall = !_initializing;\\n require(\\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\\n \\\"Initializable: contract is already initialized\\\"\\n );\\n _initialized = 1;\\n if (isTopLevelCall) {\\n _initializing = true;\\n }\\n _;\\n if (isTopLevelCall) {\\n _initializing = false;\\n emit Initialized(1);\\n }\\n }\\n\\n /**\\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\\n * used to initialize parent contracts.\\n *\\n * A reinitializer may be used after the original initialization step. This is essential to configure modules that\\n * are added through upgrades and that require initialization.\\n *\\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\\n * cannot be nested. If one is invoked in the context of another, execution will revert.\\n *\\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\\n * a contract, executing them in the right order is up to the developer or operator.\\n *\\n * WARNING: setting the version to 255 will prevent any future reinitialization.\\n *\\n * Emits an {Initialized} event.\\n */\\n modifier reinitializer(uint8 version) {\\n require(!_initializing && _initialized < version, \\\"Initializable: contract is already initialized\\\");\\n _initialized = version;\\n _initializing = true;\\n _;\\n _initializing = false;\\n emit Initialized(version);\\n }\\n\\n /**\\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\\n */\\n modifier onlyInitializing() {\\n require(_initializing, \\\"Initializable: contract is not initializing\\\");\\n _;\\n }\\n\\n /**\\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\\n * through proxies.\\n *\\n * Emits an {Initialized} event the first time it is successfully executed.\\n */\\n function _disableInitializers() internal virtual {\\n require(!_initializing, \\\"Initializable: contract is initializing\\\");\\n if (_initialized < type(uint8).max) {\\n _initialized = type(uint8).max;\\n emit Initialized(type(uint8).max);\\n }\\n }\\n\\n /**\\n * @dev Returns the highest version that has been initialized. See {reinitializer}.\\n */\\n function _getInitializedVersion() internal view returns (uint8) {\\n return _initialized;\\n }\\n\\n /**\\n * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.\\n */\\n function _isInitializing() internal view returns (bool) {\\n return _initializing;\\n }\\n}\\n\",\"keccak256\":\"0x037c334add4b033ad3493038c25be1682d78c00992e1acb0e2795caff3925271\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (proxy/utils/UUPSUpgradeable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../interfaces/draft-IERC1822Upgradeable.sol\\\";\\nimport \\\"../ERC1967/ERC1967UpgradeUpgradeable.sol\\\";\\nimport \\\"./Initializable.sol\\\";\\n\\n/**\\n * @dev An upgradeability mechanism designed for UUPS proxies. The functions included here can perform an upgrade of an\\n * {ERC1967Proxy}, when this contract is set as the implementation behind such a proxy.\\n *\\n * A security mechanism ensures that an upgrade does not turn off upgradeability accidentally, although this risk is\\n * reinstated if the upgrade retains upgradeability but removes the security mechanism, e.g. by replacing\\n * `UUPSUpgradeable` with a custom implementation of upgrades.\\n *\\n * The {_authorizeUpgrade} function must be overridden to include access restriction to the upgrade mechanism.\\n *\\n * _Available since v4.1._\\n */\\nabstract contract UUPSUpgradeable is Initializable, IERC1822ProxiableUpgradeable, ERC1967UpgradeUpgradeable {\\n function __UUPSUpgradeable_init() internal onlyInitializing {\\n }\\n\\n function __UUPSUpgradeable_init_unchained() internal onlyInitializing {\\n }\\n /// @custom:oz-upgrades-unsafe-allow state-variable-immutable state-variable-assignment\\n address private immutable __self = address(this);\\n\\n /**\\n * @dev Check that the execution is being performed through a delegatecall call and that the execution context is\\n * a proxy contract with an implementation (as defined in ERC1967) pointing to self. This should only be the case\\n * for UUPS and transparent proxies that are using the current contract as their implementation. Execution of a\\n * function through ERC1167 minimal proxies (clones) would not normally pass this test, but is not guaranteed to\\n * fail.\\n */\\n modifier onlyProxy() {\\n require(address(this) != __self, \\\"Function must be called through delegatecall\\\");\\n require(_getImplementation() == __self, \\\"Function must be called through active proxy\\\");\\n _;\\n }\\n\\n /**\\n * @dev Check that the execution is not being performed through a delegate call. This allows a function to be\\n * callable on the implementing contract but not through proxies.\\n */\\n modifier notDelegated() {\\n require(address(this) == __self, \\\"UUPSUpgradeable: must not be called through delegatecall\\\");\\n _;\\n }\\n\\n /**\\n * @dev Implementation of the ERC1822 {proxiableUUID} function. This returns the storage slot used by the\\n * implementation. It is used to validate the implementation's compatibility when performing an upgrade.\\n *\\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\\n * function revert if invoked through a proxy. This is guaranteed by the `notDelegated` modifier.\\n */\\n function proxiableUUID() external view virtual override notDelegated returns (bytes32) {\\n return _IMPLEMENTATION_SLOT;\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy to `newImplementation`.\\n *\\n * Calls {_authorizeUpgrade}.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function upgradeTo(address newImplementation) external virtual onlyProxy {\\n _authorizeUpgrade(newImplementation);\\n _upgradeToAndCallUUPS(newImplementation, new bytes(0), false);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy to `newImplementation`, and subsequently execute the function call\\n * encoded in `data`.\\n *\\n * Calls {_authorizeUpgrade}.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function upgradeToAndCall(address newImplementation, bytes memory data) external payable virtual onlyProxy {\\n _authorizeUpgrade(newImplementation);\\n _upgradeToAndCallUUPS(newImplementation, data, true);\\n }\\n\\n /**\\n * @dev Function that should revert when `msg.sender` is not authorized to upgrade the contract. Called by\\n * {upgradeTo} and {upgradeToAndCall}.\\n *\\n * Normally, this function will use an xref:access.adoc[access control] modifier such as {Ownable-onlyOwner}.\\n *\\n * ```solidity\\n * function _authorizeUpgrade(address) internal override onlyOwner {}\\n * ```\\n */\\n function _authorizeUpgrade(address newImplementation) internal virtual;\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[50] private __gap;\\n}\\n\",\"keccak256\":\"0x7967d130887c4b40666cd88f8744691d4527039a1b2a38aa0de41481ef646778\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary AddressUpgradeable {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\n *\\n * _Available since v4.8._\\n */\\n function verifyCallResultFromTarget(\\n address target,\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n if (success) {\\n if (returndata.length == 0) {\\n // only check isContract if the call was successful and the return data is empty\\n // otherwise we already know that it was a contract\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n }\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason or using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x2edcb41c121abc510932e8d83ff8b82cf9cdde35e7c297622f5c29ef0af25183\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/StorageSlotUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/StorageSlot.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for reading and writing primitive types to specific storage slots.\\n *\\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\\n * This library helps with reading and writing to such slots without the need for inline assembly.\\n *\\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\\n *\\n * Example usage to set ERC1967 implementation slot:\\n * ```\\n * contract ERC1967 {\\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n *\\n * function _getImplementation() internal view returns (address) {\\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n * }\\n *\\n * function _setImplementation(address newImplementation) internal {\\n * require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n * }\\n * }\\n * ```\\n *\\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\\n */\\nlibrary StorageSlotUpgradeable {\\n struct AddressSlot {\\n address value;\\n }\\n\\n struct BooleanSlot {\\n bool value;\\n }\\n\\n struct Bytes32Slot {\\n bytes32 value;\\n }\\n\\n struct Uint256Slot {\\n uint256 value;\\n }\\n\\n /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\\n */\\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\\n */\\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\\n */\\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0x09864aea84f01e39313375b5610c73a3c1c68abbdc51e5ccdd25ff977fdadf9a\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 amount\\n ) external returns (bool);\\n}\\n\",\"keccak256\":\"0x9750c6b834f7b43000631af5cc30001c5f547b3ceb3635488f140f60e897ea6b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\\n *\\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\\n * need to send a transaction, and thus is not required to hold Ether at all.\\n */\\ninterface IERC20Permit {\\n /**\\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\\n * given ``owner``'s signed approval.\\n *\\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\\n * ordering also apply here.\\n *\\n * Emits an {Approval} event.\\n *\\n * Requirements:\\n *\\n * - `spender` cannot be the zero address.\\n * - `deadline` must be a timestamp in the future.\\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\\n * over the EIP712-formatted function arguments.\\n * - the signature must use ``owner``'s current nonce (see {nonces}).\\n *\\n * For more information on the signature format, see the\\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\\n * section].\\n */\\n function permit(\\n address owner,\\n address spender,\\n uint256 value,\\n uint256 deadline,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) external;\\n\\n /**\\n * @dev Returns the current nonce for `owner`. This value must be\\n * included whenever a signature is generated for {permit}.\\n *\\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\\n * prevents a signature from being used multiple times.\\n */\\n function nonces(address owner) external view returns (uint256);\\n\\n /**\\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\\n */\\n // solhint-disable-next-line func-name-mixedcase\\n function DOMAIN_SEPARATOR() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0xf41ca991f30855bf80ffd11e9347856a517b977f0a6c2d52e6421a99b7840329\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/utils/SafeERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC20.sol\\\";\\nimport \\\"../extensions/draft-IERC20Permit.sol\\\";\\nimport \\\"../../../utils/Address.sol\\\";\\n\\n/**\\n * @title SafeERC20\\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\\n * contract returns false). Tokens that return no value (and instead revert or\\n * throw on failure) are also supported, non-reverting calls are assumed to be\\n * successful.\\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\\n */\\nlibrary SafeERC20 {\\n using Address for address;\\n\\n function safeTransfer(\\n IERC20 token,\\n address to,\\n uint256 value\\n ) internal {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\\n }\\n\\n function safeTransferFrom(\\n IERC20 token,\\n address from,\\n address to,\\n uint256 value\\n ) internal {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\\n }\\n\\n /**\\n * @dev Deprecated. This function has issues similar to the ones found in\\n * {IERC20-approve}, and its usage is discouraged.\\n *\\n * Whenever possible, use {safeIncreaseAllowance} and\\n * {safeDecreaseAllowance} instead.\\n */\\n function safeApprove(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n // safeApprove should only be called when setting an initial allowance,\\n // or when resetting it to zero. To increase and decrease it, use\\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\\n require(\\n (value == 0) || (token.allowance(address(this), spender) == 0),\\n \\\"SafeERC20: approve from non-zero to non-zero allowance\\\"\\n );\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\\n }\\n\\n function safeIncreaseAllowance(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n uint256 newAllowance = token.allowance(address(this), spender) + value;\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\n }\\n\\n function safeDecreaseAllowance(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n unchecked {\\n uint256 oldAllowance = token.allowance(address(this), spender);\\n require(oldAllowance >= value, \\\"SafeERC20: decreased allowance below zero\\\");\\n uint256 newAllowance = oldAllowance - value;\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\n }\\n }\\n\\n function safePermit(\\n IERC20Permit token,\\n address owner,\\n address spender,\\n uint256 value,\\n uint256 deadline,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) internal {\\n uint256 nonceBefore = token.nonces(owner);\\n token.permit(owner, spender, value, deadline, v, r, s);\\n uint256 nonceAfter = token.nonces(owner);\\n require(nonceAfter == nonceBefore + 1, \\\"SafeERC20: permit did not succeed\\\");\\n }\\n\\n /**\\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\\n * on the return value: the return value is optional (but if data is returned, it must not be false).\\n * @param token The token targeted by the call.\\n * @param data The call data (encoded using abi.encode or one of its variants).\\n */\\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\\n // the target address contains contract code and also asserts for success in the low-level call.\\n\\n bytes memory returndata = address(token).functionCall(data, \\\"SafeERC20: low-level call failed\\\");\\n if (returndata.length > 0) {\\n // Return data is optional\\n require(abi.decode(returndata, (bool)), \\\"SafeERC20: ERC20 operation did not succeed\\\");\\n }\\n }\\n}\\n\",\"keccak256\":\"0x9b72f93be69ca894d8492c244259615c4a742afc8d63720dbc8bb81087d9b238\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\n *\\n * _Available since v4.8._\\n */\\n function verifyCallResultFromTarget(\\n address target,\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n if (success) {\\n if (returndata.length == 0) {\\n // only check isContract if the call was successful and the return data is empty\\n // otherwise we already know that it was a contract\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n }\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason or using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xf96f969e24029d43d0df89e59d365f277021dac62b48e1c1e3ebe0acdd7f1ca1\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/math/SafeCast.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SafeCast.sol)\\n// This file was procedurally generated from scripts/generate/templates/SafeCast.js.\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Wrappers over Solidity's uintXX/intXX casting operators with added overflow\\n * checks.\\n *\\n * Downcasting from uint256/int256 in Solidity does not revert on overflow. This can\\n * easily result in undesired exploitation or bugs, since developers usually\\n * assume that overflows raise errors. `SafeCast` restores this intuition by\\n * reverting the transaction when such an operation overflows.\\n *\\n * Using this library instead of the unchecked operations eliminates an entire\\n * class of bugs, so it's recommended to use it always.\\n *\\n * Can be combined with {SafeMath} and {SignedSafeMath} to extend it to smaller types, by performing\\n * all math on `uint256` and `int256` and then downcasting.\\n */\\nlibrary SafeCast {\\n /**\\n * @dev Returns the downcasted uint248 from uint256, reverting on\\n * overflow (when the input is greater than largest uint248).\\n *\\n * Counterpart to Solidity's `uint248` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 248 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint248(uint256 value) internal pure returns (uint248) {\\n require(value <= type(uint248).max, \\\"SafeCast: value doesn't fit in 248 bits\\\");\\n return uint248(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint240 from uint256, reverting on\\n * overflow (when the input is greater than largest uint240).\\n *\\n * Counterpart to Solidity's `uint240` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 240 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint240(uint256 value) internal pure returns (uint240) {\\n require(value <= type(uint240).max, \\\"SafeCast: value doesn't fit in 240 bits\\\");\\n return uint240(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint232 from uint256, reverting on\\n * overflow (when the input is greater than largest uint232).\\n *\\n * Counterpart to Solidity's `uint232` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 232 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint232(uint256 value) internal pure returns (uint232) {\\n require(value <= type(uint232).max, \\\"SafeCast: value doesn't fit in 232 bits\\\");\\n return uint232(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint224 from uint256, reverting on\\n * overflow (when the input is greater than largest uint224).\\n *\\n * Counterpart to Solidity's `uint224` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 224 bits\\n *\\n * _Available since v4.2._\\n */\\n function toUint224(uint256 value) internal pure returns (uint224) {\\n require(value <= type(uint224).max, \\\"SafeCast: value doesn't fit in 224 bits\\\");\\n return uint224(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint216 from uint256, reverting on\\n * overflow (when the input is greater than largest uint216).\\n *\\n * Counterpart to Solidity's `uint216` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 216 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint216(uint256 value) internal pure returns (uint216) {\\n require(value <= type(uint216).max, \\\"SafeCast: value doesn't fit in 216 bits\\\");\\n return uint216(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint208 from uint256, reverting on\\n * overflow (when the input is greater than largest uint208).\\n *\\n * Counterpart to Solidity's `uint208` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 208 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint208(uint256 value) internal pure returns (uint208) {\\n require(value <= type(uint208).max, \\\"SafeCast: value doesn't fit in 208 bits\\\");\\n return uint208(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint200 from uint256, reverting on\\n * overflow (when the input is greater than largest uint200).\\n *\\n * Counterpart to Solidity's `uint200` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 200 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint200(uint256 value) internal pure returns (uint200) {\\n require(value <= type(uint200).max, \\\"SafeCast: value doesn't fit in 200 bits\\\");\\n return uint200(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint192 from uint256, reverting on\\n * overflow (when the input is greater than largest uint192).\\n *\\n * Counterpart to Solidity's `uint192` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 192 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint192(uint256 value) internal pure returns (uint192) {\\n require(value <= type(uint192).max, \\\"SafeCast: value doesn't fit in 192 bits\\\");\\n return uint192(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint184 from uint256, reverting on\\n * overflow (when the input is greater than largest uint184).\\n *\\n * Counterpart to Solidity's `uint184` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 184 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint184(uint256 value) internal pure returns (uint184) {\\n require(value <= type(uint184).max, \\\"SafeCast: value doesn't fit in 184 bits\\\");\\n return uint184(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint176 from uint256, reverting on\\n * overflow (when the input is greater than largest uint176).\\n *\\n * Counterpart to Solidity's `uint176` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 176 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint176(uint256 value) internal pure returns (uint176) {\\n require(value <= type(uint176).max, \\\"SafeCast: value doesn't fit in 176 bits\\\");\\n return uint176(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint168 from uint256, reverting on\\n * overflow (when the input is greater than largest uint168).\\n *\\n * Counterpart to Solidity's `uint168` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 168 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint168(uint256 value) internal pure returns (uint168) {\\n require(value <= type(uint168).max, \\\"SafeCast: value doesn't fit in 168 bits\\\");\\n return uint168(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint160 from uint256, reverting on\\n * overflow (when the input is greater than largest uint160).\\n *\\n * Counterpart to Solidity's `uint160` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 160 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint160(uint256 value) internal pure returns (uint160) {\\n require(value <= type(uint160).max, \\\"SafeCast: value doesn't fit in 160 bits\\\");\\n return uint160(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint152 from uint256, reverting on\\n * overflow (when the input is greater than largest uint152).\\n *\\n * Counterpart to Solidity's `uint152` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 152 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint152(uint256 value) internal pure returns (uint152) {\\n require(value <= type(uint152).max, \\\"SafeCast: value doesn't fit in 152 bits\\\");\\n return uint152(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint144 from uint256, reverting on\\n * overflow (when the input is greater than largest uint144).\\n *\\n * Counterpart to Solidity's `uint144` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 144 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint144(uint256 value) internal pure returns (uint144) {\\n require(value <= type(uint144).max, \\\"SafeCast: value doesn't fit in 144 bits\\\");\\n return uint144(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint136 from uint256, reverting on\\n * overflow (when the input is greater than largest uint136).\\n *\\n * Counterpart to Solidity's `uint136` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 136 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint136(uint256 value) internal pure returns (uint136) {\\n require(value <= type(uint136).max, \\\"SafeCast: value doesn't fit in 136 bits\\\");\\n return uint136(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint128 from uint256, reverting on\\n * overflow (when the input is greater than largest uint128).\\n *\\n * Counterpart to Solidity's `uint128` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 128 bits\\n *\\n * _Available since v2.5._\\n */\\n function toUint128(uint256 value) internal pure returns (uint128) {\\n require(value <= type(uint128).max, \\\"SafeCast: value doesn't fit in 128 bits\\\");\\n return uint128(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint120 from uint256, reverting on\\n * overflow (when the input is greater than largest uint120).\\n *\\n * Counterpart to Solidity's `uint120` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 120 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint120(uint256 value) internal pure returns (uint120) {\\n require(value <= type(uint120).max, \\\"SafeCast: value doesn't fit in 120 bits\\\");\\n return uint120(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint112 from uint256, reverting on\\n * overflow (when the input is greater than largest uint112).\\n *\\n * Counterpart to Solidity's `uint112` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 112 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint112(uint256 value) internal pure returns (uint112) {\\n require(value <= type(uint112).max, \\\"SafeCast: value doesn't fit in 112 bits\\\");\\n return uint112(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint104 from uint256, reverting on\\n * overflow (when the input is greater than largest uint104).\\n *\\n * Counterpart to Solidity's `uint104` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 104 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint104(uint256 value) internal pure returns (uint104) {\\n require(value <= type(uint104).max, \\\"SafeCast: value doesn't fit in 104 bits\\\");\\n return uint104(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint96 from uint256, reverting on\\n * overflow (when the input is greater than largest uint96).\\n *\\n * Counterpart to Solidity's `uint96` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 96 bits\\n *\\n * _Available since v4.2._\\n */\\n function toUint96(uint256 value) internal pure returns (uint96) {\\n require(value <= type(uint96).max, \\\"SafeCast: value doesn't fit in 96 bits\\\");\\n return uint96(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint88 from uint256, reverting on\\n * overflow (when the input is greater than largest uint88).\\n *\\n * Counterpart to Solidity's `uint88` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 88 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint88(uint256 value) internal pure returns (uint88) {\\n require(value <= type(uint88).max, \\\"SafeCast: value doesn't fit in 88 bits\\\");\\n return uint88(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint80 from uint256, reverting on\\n * overflow (when the input is greater than largest uint80).\\n *\\n * Counterpart to Solidity's `uint80` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 80 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint80(uint256 value) internal pure returns (uint80) {\\n require(value <= type(uint80).max, \\\"SafeCast: value doesn't fit in 80 bits\\\");\\n return uint80(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint72 from uint256, reverting on\\n * overflow (when the input is greater than largest uint72).\\n *\\n * Counterpart to Solidity's `uint72` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 72 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint72(uint256 value) internal pure returns (uint72) {\\n require(value <= type(uint72).max, \\\"SafeCast: value doesn't fit in 72 bits\\\");\\n return uint72(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint64 from uint256, reverting on\\n * overflow (when the input is greater than largest uint64).\\n *\\n * Counterpart to Solidity's `uint64` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 64 bits\\n *\\n * _Available since v2.5._\\n */\\n function toUint64(uint256 value) internal pure returns (uint64) {\\n require(value <= type(uint64).max, \\\"SafeCast: value doesn't fit in 64 bits\\\");\\n return uint64(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint56 from uint256, reverting on\\n * overflow (when the input is greater than largest uint56).\\n *\\n * Counterpart to Solidity's `uint56` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 56 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint56(uint256 value) internal pure returns (uint56) {\\n require(value <= type(uint56).max, \\\"SafeCast: value doesn't fit in 56 bits\\\");\\n return uint56(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint48 from uint256, reverting on\\n * overflow (when the input is greater than largest uint48).\\n *\\n * Counterpart to Solidity's `uint48` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 48 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint48(uint256 value) internal pure returns (uint48) {\\n require(value <= type(uint48).max, \\\"SafeCast: value doesn't fit in 48 bits\\\");\\n return uint48(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint40 from uint256, reverting on\\n * overflow (when the input is greater than largest uint40).\\n *\\n * Counterpart to Solidity's `uint40` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 40 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint40(uint256 value) internal pure returns (uint40) {\\n require(value <= type(uint40).max, \\\"SafeCast: value doesn't fit in 40 bits\\\");\\n return uint40(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint32 from uint256, reverting on\\n * overflow (when the input is greater than largest uint32).\\n *\\n * Counterpart to Solidity's `uint32` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 32 bits\\n *\\n * _Available since v2.5._\\n */\\n function toUint32(uint256 value) internal pure returns (uint32) {\\n require(value <= type(uint32).max, \\\"SafeCast: value doesn't fit in 32 bits\\\");\\n return uint32(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint24 from uint256, reverting on\\n * overflow (when the input is greater than largest uint24).\\n *\\n * Counterpart to Solidity's `uint24` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 24 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint24(uint256 value) internal pure returns (uint24) {\\n require(value <= type(uint24).max, \\\"SafeCast: value doesn't fit in 24 bits\\\");\\n return uint24(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint16 from uint256, reverting on\\n * overflow (when the input is greater than largest uint16).\\n *\\n * Counterpart to Solidity's `uint16` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 16 bits\\n *\\n * _Available since v2.5._\\n */\\n function toUint16(uint256 value) internal pure returns (uint16) {\\n require(value <= type(uint16).max, \\\"SafeCast: value doesn't fit in 16 bits\\\");\\n return uint16(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint8 from uint256, reverting on\\n * overflow (when the input is greater than largest uint8).\\n *\\n * Counterpart to Solidity's `uint8` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 8 bits\\n *\\n * _Available since v2.5._\\n */\\n function toUint8(uint256 value) internal pure returns (uint8) {\\n require(value <= type(uint8).max, \\\"SafeCast: value doesn't fit in 8 bits\\\");\\n return uint8(value);\\n }\\n\\n /**\\n * @dev Converts a signed int256 into an unsigned uint256.\\n *\\n * Requirements:\\n *\\n * - input must be greater than or equal to 0.\\n *\\n * _Available since v3.0._\\n */\\n function toUint256(int256 value) internal pure returns (uint256) {\\n require(value >= 0, \\\"SafeCast: value must be positive\\\");\\n return uint256(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted int248 from int256, reverting on\\n * overflow (when the input is less than smallest int248 or\\n * greater than largest int248).\\n *\\n * Counterpart to Solidity's `int248` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 248 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt248(int256 value) internal pure returns (int248 downcasted) {\\n downcasted = int248(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 248 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int240 from int256, reverting on\\n * overflow (when the input is less than smallest int240 or\\n * greater than largest int240).\\n *\\n * Counterpart to Solidity's `int240` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 240 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt240(int256 value) internal pure returns (int240 downcasted) {\\n downcasted = int240(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 240 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int232 from int256, reverting on\\n * overflow (when the input is less than smallest int232 or\\n * greater than largest int232).\\n *\\n * Counterpart to Solidity's `int232` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 232 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt232(int256 value) internal pure returns (int232 downcasted) {\\n downcasted = int232(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 232 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int224 from int256, reverting on\\n * overflow (when the input is less than smallest int224 or\\n * greater than largest int224).\\n *\\n * Counterpart to Solidity's `int224` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 224 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt224(int256 value) internal pure returns (int224 downcasted) {\\n downcasted = int224(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 224 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int216 from int256, reverting on\\n * overflow (when the input is less than smallest int216 or\\n * greater than largest int216).\\n *\\n * Counterpart to Solidity's `int216` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 216 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt216(int256 value) internal pure returns (int216 downcasted) {\\n downcasted = int216(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 216 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int208 from int256, reverting on\\n * overflow (when the input is less than smallest int208 or\\n * greater than largest int208).\\n *\\n * Counterpart to Solidity's `int208` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 208 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt208(int256 value) internal pure returns (int208 downcasted) {\\n downcasted = int208(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 208 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int200 from int256, reverting on\\n * overflow (when the input is less than smallest int200 or\\n * greater than largest int200).\\n *\\n * Counterpart to Solidity's `int200` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 200 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt200(int256 value) internal pure returns (int200 downcasted) {\\n downcasted = int200(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 200 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int192 from int256, reverting on\\n * overflow (when the input is less than smallest int192 or\\n * greater than largest int192).\\n *\\n * Counterpart to Solidity's `int192` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 192 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt192(int256 value) internal pure returns (int192 downcasted) {\\n downcasted = int192(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 192 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int184 from int256, reverting on\\n * overflow (when the input is less than smallest int184 or\\n * greater than largest int184).\\n *\\n * Counterpart to Solidity's `int184` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 184 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt184(int256 value) internal pure returns (int184 downcasted) {\\n downcasted = int184(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 184 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int176 from int256, reverting on\\n * overflow (when the input is less than smallest int176 or\\n * greater than largest int176).\\n *\\n * Counterpart to Solidity's `int176` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 176 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt176(int256 value) internal pure returns (int176 downcasted) {\\n downcasted = int176(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 176 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int168 from int256, reverting on\\n * overflow (when the input is less than smallest int168 or\\n * greater than largest int168).\\n *\\n * Counterpart to Solidity's `int168` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 168 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt168(int256 value) internal pure returns (int168 downcasted) {\\n downcasted = int168(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 168 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int160 from int256, reverting on\\n * overflow (when the input is less than smallest int160 or\\n * greater than largest int160).\\n *\\n * Counterpart to Solidity's `int160` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 160 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt160(int256 value) internal pure returns (int160 downcasted) {\\n downcasted = int160(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 160 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int152 from int256, reverting on\\n * overflow (when the input is less than smallest int152 or\\n * greater than largest int152).\\n *\\n * Counterpart to Solidity's `int152` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 152 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt152(int256 value) internal pure returns (int152 downcasted) {\\n downcasted = int152(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 152 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int144 from int256, reverting on\\n * overflow (when the input is less than smallest int144 or\\n * greater than largest int144).\\n *\\n * Counterpart to Solidity's `int144` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 144 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt144(int256 value) internal pure returns (int144 downcasted) {\\n downcasted = int144(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 144 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int136 from int256, reverting on\\n * overflow (when the input is less than smallest int136 or\\n * greater than largest int136).\\n *\\n * Counterpart to Solidity's `int136` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 136 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt136(int256 value) internal pure returns (int136 downcasted) {\\n downcasted = int136(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 136 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int128 from int256, reverting on\\n * overflow (when the input is less than smallest int128 or\\n * greater than largest int128).\\n *\\n * Counterpart to Solidity's `int128` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 128 bits\\n *\\n * _Available since v3.1._\\n */\\n function toInt128(int256 value) internal pure returns (int128 downcasted) {\\n downcasted = int128(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 128 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int120 from int256, reverting on\\n * overflow (when the input is less than smallest int120 or\\n * greater than largest int120).\\n *\\n * Counterpart to Solidity's `int120` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 120 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt120(int256 value) internal pure returns (int120 downcasted) {\\n downcasted = int120(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 120 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int112 from int256, reverting on\\n * overflow (when the input is less than smallest int112 or\\n * greater than largest int112).\\n *\\n * Counterpart to Solidity's `int112` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 112 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt112(int256 value) internal pure returns (int112 downcasted) {\\n downcasted = int112(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 112 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int104 from int256, reverting on\\n * overflow (when the input is less than smallest int104 or\\n * greater than largest int104).\\n *\\n * Counterpart to Solidity's `int104` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 104 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt104(int256 value) internal pure returns (int104 downcasted) {\\n downcasted = int104(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 104 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int96 from int256, reverting on\\n * overflow (when the input is less than smallest int96 or\\n * greater than largest int96).\\n *\\n * Counterpart to Solidity's `int96` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 96 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt96(int256 value) internal pure returns (int96 downcasted) {\\n downcasted = int96(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 96 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int88 from int256, reverting on\\n * overflow (when the input is less than smallest int88 or\\n * greater than largest int88).\\n *\\n * Counterpart to Solidity's `int88` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 88 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt88(int256 value) internal pure returns (int88 downcasted) {\\n downcasted = int88(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 88 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int80 from int256, reverting on\\n * overflow (when the input is less than smallest int80 or\\n * greater than largest int80).\\n *\\n * Counterpart to Solidity's `int80` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 80 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt80(int256 value) internal pure returns (int80 downcasted) {\\n downcasted = int80(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 80 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int72 from int256, reverting on\\n * overflow (when the input is less than smallest int72 or\\n * greater than largest int72).\\n *\\n * Counterpart to Solidity's `int72` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 72 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt72(int256 value) internal pure returns (int72 downcasted) {\\n downcasted = int72(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 72 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int64 from int256, reverting on\\n * overflow (when the input is less than smallest int64 or\\n * greater than largest int64).\\n *\\n * Counterpart to Solidity's `int64` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 64 bits\\n *\\n * _Available since v3.1._\\n */\\n function toInt64(int256 value) internal pure returns (int64 downcasted) {\\n downcasted = int64(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 64 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int56 from int256, reverting on\\n * overflow (when the input is less than smallest int56 or\\n * greater than largest int56).\\n *\\n * Counterpart to Solidity's `int56` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 56 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt56(int256 value) internal pure returns (int56 downcasted) {\\n downcasted = int56(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 56 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int48 from int256, reverting on\\n * overflow (when the input is less than smallest int48 or\\n * greater than largest int48).\\n *\\n * Counterpart to Solidity's `int48` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 48 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt48(int256 value) internal pure returns (int48 downcasted) {\\n downcasted = int48(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 48 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int40 from int256, reverting on\\n * overflow (when the input is less than smallest int40 or\\n * greater than largest int40).\\n *\\n * Counterpart to Solidity's `int40` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 40 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt40(int256 value) internal pure returns (int40 downcasted) {\\n downcasted = int40(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 40 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int32 from int256, reverting on\\n * overflow (when the input is less than smallest int32 or\\n * greater than largest int32).\\n *\\n * Counterpart to Solidity's `int32` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 32 bits\\n *\\n * _Available since v3.1._\\n */\\n function toInt32(int256 value) internal pure returns (int32 downcasted) {\\n downcasted = int32(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 32 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int24 from int256, reverting on\\n * overflow (when the input is less than smallest int24 or\\n * greater than largest int24).\\n *\\n * Counterpart to Solidity's `int24` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 24 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt24(int256 value) internal pure returns (int24 downcasted) {\\n downcasted = int24(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 24 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int16 from int256, reverting on\\n * overflow (when the input is less than smallest int16 or\\n * greater than largest int16).\\n *\\n * Counterpart to Solidity's `int16` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 16 bits\\n *\\n * _Available since v3.1._\\n */\\n function toInt16(int256 value) internal pure returns (int16 downcasted) {\\n downcasted = int16(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 16 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int8 from int256, reverting on\\n * overflow (when the input is less than smallest int8 or\\n * greater than largest int8).\\n *\\n * Counterpart to Solidity's `int8` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 8 bits\\n *\\n * _Available since v3.1._\\n */\\n function toInt8(int256 value) internal pure returns (int8 downcasted) {\\n downcasted = int8(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 8 bits\\\");\\n }\\n\\n /**\\n * @dev Converts an unsigned uint256 into a signed int256.\\n *\\n * Requirements:\\n *\\n * - input must be less than or equal to maxInt256.\\n *\\n * _Available since v3.0._\\n */\\n function toInt256(uint256 value) internal pure returns (int256) {\\n // Note: Unsafe cast below is okay because `type(int256).max` is guaranteed to be positive\\n require(value <= uint256(type(int256).max), \\\"SafeCast: value doesn't fit in an int256\\\");\\n return int256(value);\\n }\\n}\\n\",\"keccak256\":\"0x52a8cfb0f5239d11b457dcdd1b326992ef672714ca8da71a157255bddd13f3ad\",\"license\":\"MIT\"},\"contracts/Distributor.sol\":{\"content\":\"// SPDX-License-Identifier: BUSL-1.1\\n\\n/*\\n * \\u2588 \\n ***** \\u2593\\u2593\\u2593 \\n * \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\n * ///. \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\n ***** //////// \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\n * ///////////// \\u2593\\u2593\\u2593 \\n \\u2593\\u2593 ////////////////// \\u2588 \\u2593\\u2593 \\n \\u2593\\u2593 \\u2593\\u2593 /////////////////////// \\u2593\\u2593 \\u2593\\u2593 \\n \\u2593\\u2593 \\u2593\\u2593 //////////////////////////// \\u2593\\u2593 \\u2593\\u2593 \\n \\u2593\\u2593 \\u2593\\u2593 /////////\\u2593\\u2593\\u2593///////\\u2593\\u2593\\u2593///////// \\u2593\\u2593 \\u2593\\u2593 \\n \\u2593\\u2593 ,////////////////////////////////////// \\u2593\\u2593 \\u2593\\u2593 \\n \\u2593\\u2593 ////////////////////////////////////////// \\u2593\\u2593 \\n \\u2593\\u2593 //////////////////////\\u2593\\u2593\\u2593\\u2593///////////////////// \\n ,//////////////////////////////////////////////////// \\n .////////////////////////////////////////////////////////// \\n .//////////////////////////\\u2588\\u2588.,//////////////////////////\\u2588 \\n .//////////////////////\\u2588\\u2588\\u2588\\u2588..,./////////////////////\\u2588\\u2588 \\n ...////////////////\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588.....,.////////////////\\u2588\\u2588\\u2588 \\n ,.,////////////\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588 ........,///////////\\u2588\\u2588\\u2588\\u2588 \\n .,.,//////\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588 ,.......///////\\u2588\\u2588\\u2588\\u2588 \\n ,..//\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588 ........./\\u2588\\u2588\\u2588\\u2588 \\n ..,\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588 .....,\\u2588\\u2588\\u2588 \\n .\\u2588\\u2588 ,.,\\u2588 \\n \\n \\n \\n \\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\n \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593 \\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593 \\n \\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593 \\n \\u2593\\u2593\\u2593 \\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\n*/\\n\\npragma solidity ^0.8.17;\\n\\nimport { IERC20 } from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport { SafeERC20 } from \\\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\\\";\\nimport { SafeCast } from \\\"@openzeppelin/contracts/utils/math/SafeCast.sol\\\";\\n\\nimport \\\"./utils/UUPSHelper.sol\\\";\\n\\nstruct MerkleTree {\\n // Root of a Merkle tree which leaves are `(address user, address token, uint amount)`\\n // representing an amount of tokens accumulated by `user`.\\n // The Merkle tree is assumed to have only increasing amounts: that is to say if a user can claim 1,\\n // then after the amount associated in the Merkle tree for this token should be x > 1\\n bytes32 merkleRoot;\\n // Ipfs hash of the tree data\\n bytes32 ipfsHash;\\n}\\n\\nstruct Claim {\\n uint208 amount;\\n uint48 timestamp;\\n bytes32 merkleRoot;\\n}\\n\\n/// @title Distributor\\n/// @notice Allows LPs on AMMs with concentrated liquidity to claim the rewards that were distributed to them\\n/// @author Angle Labs. Inc\\ncontract Distributor is UUPSHelper {\\n using SafeERC20 for IERC20;\\n\\n /// @notice Epoch duration\\n uint32 internal constant _EPOCH_DURATION = 3600;\\n\\n // ================================= VARIABLES =================================\\n\\n /// @notice Tree of claimable tokens through this contract\\n MerkleTree public tree;\\n\\n /// @notice Tree that was in place in the contract before the last `tree` update\\n MerkleTree public lastTree;\\n\\n /// @notice Token to deposit to freeze the roots update\\n IERC20 public disputeToken;\\n\\n /// @notice `Core` contract handling access control\\n ICore public core;\\n\\n /// @notice Address which created the dispute\\n /// @dev Used to store if there is an ongoing dispute\\n address public disputer;\\n\\n /// @notice When the current tree will become valid\\n uint48 public endOfDisputePeriod;\\n\\n /// @notice Time after which a change in a tree becomes effective, in EPOCH_DURATION\\n uint48 public disputePeriod;\\n\\n /// @notice Amount to deposit to freeze the roots update\\n uint256 public disputeAmount;\\n\\n /// @notice Mapping user -> token -> amount to track claimed amounts\\n mapping(address => mapping(address => Claim)) public claimed;\\n\\n /// @notice Trusted EOAs to update the Merkle root\\n mapping(address => uint256) public canUpdateMerkleRoot;\\n\\n /// @notice Whether or not to disable permissionless claiming\\n mapping(address => uint256) public onlyOperatorCanClaim;\\n\\n /// @notice user -> operator -> authorisation to claim\\n mapping(address => mapping(address => uint256)) public operators;\\n\\n uint256[38] private __gap;\\n\\n // =================================== EVENTS ==================================\\n\\n event Claimed(address indexed user, address indexed token, uint256 amount);\\n event DisputeAmountUpdated(uint256 _disputeAmount);\\n event Disputed(string reason);\\n event DisputePeriodUpdated(uint48 _disputePeriod);\\n event DisputeResolved(bool valid);\\n event DisputeTokenUpdated(address indexed _disputeToken);\\n event OperatorClaimingToggled(address indexed user, bool isEnabled);\\n event OperatorToggled(address indexed user, address indexed operator, bool isWhitelisted);\\n event Recovered(address indexed token, address indexed to, uint256 amount);\\n event Revoked(); // With this event an indexer could maintain a table (timestamp, merkleRootUpdate)\\n event TreeUpdated(bytes32 merkleRoot, bytes32 ipfsHash, uint48 endOfDisputePeriod);\\n event TrustedToggled(address indexed eoa, bool trust);\\n\\n // ================================= MODIFIERS =================================\\n\\n /// @notice Checks whether the `msg.sender` has the governor role or the guardian role\\n modifier onlyGovernorOrGuardian() {\\n if (!core.isGovernorOrGuardian(msg.sender)) revert NotGovernorOrGuardian();\\n _;\\n }\\n\\n /// @notice Checks whether the `msg.sender` is the `user` address or is a trusted address\\n modifier onlyTrustedOrUser(address user) {\\n if (user != msg.sender && canUpdateMerkleRoot[msg.sender] != 1 && !core.isGovernorOrGuardian(msg.sender))\\n revert NotTrusted();\\n _;\\n }\\n\\n // ================================ CONSTRUCTOR ================================\\n\\n constructor() initializer {}\\n\\n function initialize(ICore _core) external initializer {\\n if (address(_core) == address(0)) revert ZeroAddress();\\n core = _core;\\n }\\n\\n /// @inheritdoc UUPSUpgradeable\\n function _authorizeUpgrade(address) internal view override onlyGuardianUpgrader(core) {}\\n\\n // =============================== MAIN FUNCTION ===============================\\n\\n /// @notice Claims rewards for a given set of users\\n /// @dev Anyone may call this function for anyone else, funds go to destination regardless, it's just a question of\\n /// who provides the proof and pays the gas: `msg.sender` is used only for addresses that require a trusted operator\\n /// @param users Recipient of tokens\\n /// @param tokens ERC20 claimed\\n /// @param amounts Amount of tokens that will be sent to the corresponding users\\n /// @param proofs Array of hashes bridging from a leaf `(hash of user | token | amount)` to the Merkle root\\n function claim(\\n address[] calldata users,\\n address[] calldata tokens,\\n uint256[] calldata amounts,\\n bytes32[][] calldata proofs\\n ) external {\\n uint256 usersLength = users.length;\\n if (\\n usersLength == 0 ||\\n usersLength != tokens.length ||\\n usersLength != amounts.length ||\\n usersLength != proofs.length\\n ) revert InvalidLengths();\\n\\n for (uint256 i; i < usersLength; ) {\\n address user = users[i];\\n address token = tokens[i];\\n uint256 amount = amounts[i];\\n\\n // Checking if only an approved operator can claim for `user`\\n if (onlyOperatorCanClaim[user] == 1 && operators[user][msg.sender] == 0) revert NotWhitelisted();\\n\\n // Verifying proof\\n bytes32 leaf = keccak256(abi.encode(user, token, amount));\\n if (!_verifyProof(leaf, proofs[i])) revert InvalidProof();\\n\\n // Closing reentrancy gate here\\n uint256 toSend = amount - claimed[user][token].amount;\\n claimed[user][token] = Claim(SafeCast.toUint208(amount), uint48(block.timestamp), getMerkleRoot());\\n\\n IERC20(token).safeTransfer(user, toSend);\\n emit Claimed(user, token, toSend);\\n unchecked {\\n ++i;\\n }\\n }\\n }\\n\\n /// @notice Returns the MerkleRoot that is currently live for the contract\\n function getMerkleRoot() public view returns (bytes32) {\\n if (block.timestamp >= endOfDisputePeriod && disputer == address(0)) return tree.merkleRoot;\\n else return lastTree.merkleRoot;\\n }\\n\\n // ============================ GOVERNANCE FUNCTIONS ===========================\\n\\n /// @notice Adds or removes EOAs which are trusted to update the Merkle root\\n function toggleTrusted(address eoa) external onlyGovernorOrGuardian {\\n uint256 trustedStatus = 1 - canUpdateMerkleRoot[eoa];\\n canUpdateMerkleRoot[eoa] = trustedStatus;\\n emit TrustedToggled(eoa, trustedStatus == 1);\\n }\\n\\n /// @notice Updates Merkle Tree\\n function updateTree(MerkleTree calldata _tree) external {\\n if (\\n disputer != address(0) ||\\n // A trusted address cannot update a tree right after a precedent tree update otherwise it can de facto\\n // validate a tree which has not passed the dispute period\\n ((canUpdateMerkleRoot[msg.sender] != 1 || block.timestamp < endOfDisputePeriod) &&\\n !core.isGovernorOrGuardian(msg.sender))\\n ) revert NotTrusted();\\n MerkleTree memory _lastTree = tree;\\n tree = _tree;\\n lastTree = _lastTree;\\n\\n uint48 _endOfPeriod = _endOfDisputePeriod(uint48(block.timestamp));\\n endOfDisputePeriod = _endOfPeriod;\\n emit TreeUpdated(_tree.merkleRoot, _tree.ipfsHash, _endOfPeriod);\\n }\\n\\n /// @notice Freezes the Merkle tree update until the dispute is resolved\\n /// @dev Requires a deposit of `disputeToken` that'll be slashed if the dispute is not accepted\\n /// @dev It is only possible to create a dispute within `disputePeriod` after each tree update\\n function disputeTree(string memory reason) external {\\n if (disputer != address(0)) revert UnresolvedDispute();\\n if (block.timestamp >= endOfDisputePeriod) revert InvalidDispute();\\n IERC20(disputeToken).safeTransferFrom(msg.sender, address(this), disputeAmount);\\n disputer = msg.sender;\\n emit Disputed(reason);\\n }\\n\\n /// @notice Resolve the ongoing dispute, if any\\n /// @param valid Whether the dispute was valid\\n function resolveDispute(bool valid) external onlyGovernorOrGuardian {\\n if (disputer == address(0)) revert NoDispute();\\n if (valid) {\\n IERC20(disputeToken).safeTransfer(disputer, disputeAmount);\\n // If a dispute is valid, the contract falls back to the last tree that was updated\\n _revokeTree();\\n } else {\\n IERC20(disputeToken).safeTransfer(msg.sender, disputeAmount);\\n endOfDisputePeriod = _endOfDisputePeriod(uint48(block.timestamp));\\n }\\n disputer = address(0);\\n emit DisputeResolved(valid);\\n }\\n\\n /// @notice Allows the governor or the guardian of this contract to fallback to the last version of the tree\\n /// immediately\\n function revokeTree() external onlyGovernorOrGuardian {\\n if (disputer != address(0)) revert UnresolvedDispute();\\n _revokeTree();\\n }\\n\\n /// @notice Toggles permissioned claiming for a given user\\n function toggleOnlyOperatorCanClaim(address user) external onlyTrustedOrUser(user) {\\n uint256 oldValue = onlyOperatorCanClaim[user];\\n onlyOperatorCanClaim[user] = 1 - oldValue;\\n emit OperatorClaimingToggled(user, oldValue == 0);\\n }\\n\\n /// @notice Toggles whitelisting for a given user and a given operator\\n function toggleOperator(address user, address operator) external onlyTrustedOrUser(user) {\\n uint256 oldValue = operators[user][operator];\\n operators[user][operator] = 1 - oldValue;\\n emit OperatorToggled(user, operator, oldValue == 0);\\n }\\n\\n /// @notice Recovers any ERC20 token\\n function recoverERC20(address tokenAddress, address to, uint256 amountToRecover) external onlyGovernorOrGuardian {\\n IERC20(tokenAddress).safeTransfer(to, amountToRecover);\\n emit Recovered(tokenAddress, to, amountToRecover);\\n }\\n\\n /// @notice Sets the dispute period after which a tree update becomes effective\\n function setDisputePeriod(uint48 _disputePeriod) external onlyGovernorOrGuardian {\\n disputePeriod = uint48(_disputePeriod);\\n emit DisputePeriodUpdated(_disputePeriod);\\n }\\n\\n /// @notice Sets the token used as a caution during disputes\\n function setDisputeToken(IERC20 _disputeToken) external onlyGovernorOrGuardian {\\n if (disputer != address(0)) revert UnresolvedDispute();\\n disputeToken = _disputeToken;\\n emit DisputeTokenUpdated(address(_disputeToken));\\n }\\n\\n /// @notice Sets the amount of `disputeToken` used as a caution during disputes\\n function setDisputeAmount(uint256 _disputeAmount) external onlyGovernorOrGuardian {\\n if (disputer != address(0)) revert UnresolvedDispute();\\n disputeAmount = _disputeAmount;\\n emit DisputeAmountUpdated(_disputeAmount);\\n }\\n\\n // ============================= INTERNAL FUNCTIONS ============================\\n\\n /// @notice Fallback to the last version of the tree\\n function _revokeTree() internal {\\n MerkleTree memory _tree = lastTree;\\n endOfDisputePeriod = 0;\\n tree = _tree;\\n emit Revoked();\\n emit TreeUpdated(\\n _tree.merkleRoot,\\n _tree.ipfsHash,\\n (uint48(block.timestamp) / _EPOCH_DURATION) * (_EPOCH_DURATION) // Last hour\\n );\\n }\\n\\n /// @notice Returns the end of the dispute period\\n /// @dev treeUpdate is rounded up to next hour and then `disputePeriod` hours are added\\n function _endOfDisputePeriod(uint48 treeUpdate) internal view returns (uint48) {\\n return ((treeUpdate - 1) / _EPOCH_DURATION + 1 + disputePeriod) * (_EPOCH_DURATION);\\n }\\n\\n /// @notice Checks the validity of a proof\\n /// @param leaf Hashed leaf data, the starting point of the proof\\n /// @param proof Array of hashes forming a hash chain from leaf to root\\n /// @return true If proof is correct, else false\\n function _verifyProof(bytes32 leaf, bytes32[] memory proof) internal view returns (bool) {\\n bytes32 currentHash = leaf;\\n uint256 proofLength = proof.length;\\n for (uint256 i; i < proofLength; ) {\\n if (currentHash < proof[i]) {\\n currentHash = keccak256(abi.encode(currentHash, proof[i]));\\n } else {\\n currentHash = keccak256(abi.encode(proof[i], currentHash));\\n }\\n unchecked {\\n ++i;\\n }\\n }\\n bytes32 root = getMerkleRoot();\\n if (root == bytes32(0)) revert InvalidUninitializedRoot();\\n return currentHash == root;\\n }\\n}\\n\",\"keccak256\":\"0xe59a10e2d62c9088ae8959ac6d839d995863832ea9fdb71485674264a21a9510\",\"license\":\"BUSL-1.1\"},\"contracts/interfaces/ICore.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\n\\npragma solidity ^0.8.17;\\n\\n/// @title ICore\\n/// @author Angle Labs, Inc.\\n/// @notice Interface for the `Core` contracts of smart contract modules used in Angle Labs contracts\\ninterface ICore {\\n /// @notice Checks whether an address is governor\\n /// @param admin Address to check\\n /// @return Whether the address has the `GOVERNOR_ROLE` or not\\n function isGovernor(address admin) external view returns (bool);\\n\\n /// @notice Checks whether an address is a governor or a guardian of a module\\n /// @param admin Address to check\\n /// @return Whether the address has the `GUARDIAN_ROLE` or not\\n /// @dev Governance should make sure when adding a governor to also give this governor the guardian\\n /// role by calling the `addGovernor` function\\n function isGovernorOrGuardian(address admin) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x11e92b745193d16934aaeb873c0388041dce2ef3e359a9c3315b668b05903100\",\"license\":\"GPL-3.0\"},\"contracts/utils/Errors.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\n\\npragma solidity ^0.8.17;\\n\\nerror InvalidDispute();\\nerror InvalidLengths();\\nerror InvalidParam();\\nerror InvalidParams();\\nerror InvalidProof();\\nerror InvalidUninitializedRoot();\\nerror InvalidReward();\\nerror InvalidSignature();\\nerror NoDispute();\\nerror NotGovernor();\\nerror NotGovernorOrGuardian();\\nerror NotSigned();\\nerror NotTrusted();\\nerror NotWhitelisted();\\nerror UnresolvedDispute();\\nerror ZeroAddress();\\n\",\"keccak256\":\"0x7cd16f5988dee579532a71ff4afd8668c75add546e7e4724c1aaadd888355139\",\"license\":\"GPL-3.0\"},\"contracts/utils/UUPSHelper.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\n\\n/*\\n * \\u2588 \\n ***** \\u2593\\u2593\\u2593 \\n * \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\n * ///. \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\n ***** //////// \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\n * ///////////// \\u2593\\u2593\\u2593 \\n \\u2593\\u2593 ////////////////// \\u2588 \\u2593\\u2593 \\n \\u2593\\u2593 \\u2593\\u2593 /////////////////////// \\u2593\\u2593 \\u2593\\u2593 \\n \\u2593\\u2593 \\u2593\\u2593 //////////////////////////// \\u2593\\u2593 \\u2593\\u2593 \\n \\u2593\\u2593 \\u2593\\u2593 /////////\\u2593\\u2593\\u2593///////\\u2593\\u2593\\u2593///////// \\u2593\\u2593 \\u2593\\u2593 \\n \\u2593\\u2593 ,////////////////////////////////////// \\u2593\\u2593 \\u2593\\u2593 \\n \\u2593\\u2593 ////////////////////////////////////////// \\u2593\\u2593 \\n \\u2593\\u2593 //////////////////////\\u2593\\u2593\\u2593\\u2593///////////////////// \\n ,//////////////////////////////////////////////////// \\n .////////////////////////////////////////////////////////// \\n .//////////////////////////\\u2588\\u2588.,//////////////////////////\\u2588 \\n .//////////////////////\\u2588\\u2588\\u2588\\u2588..,./////////////////////\\u2588\\u2588 \\n ...////////////////\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588.....,.////////////////\\u2588\\u2588\\u2588 \\n ,.,////////////\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588 ........,///////////\\u2588\\u2588\\u2588\\u2588 \\n .,.,//////\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588 ,.......///////\\u2588\\u2588\\u2588\\u2588 \\n ,..//\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588 ........./\\u2588\\u2588\\u2588\\u2588 \\n ..,\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588 .....,\\u2588\\u2588\\u2588 \\n .\\u2588\\u2588 ,.,\\u2588 \\n \\n \\n \\n \\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\n \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593 \\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593 \\n \\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593 \\n \\u2593\\u2593\\u2593 \\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\n*/\\n\\npragma solidity ^0.8.17;\\n\\nimport { UUPSUpgradeable } from \\\"@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol\\\";\\n\\nimport { ICore } from \\\"../interfaces/ICore.sol\\\";\\nimport \\\"../utils/Errors.sol\\\";\\n\\n/// @title UUPSHelper\\n/// @notice Helper contract for UUPSUpgradeable contracts where the upgradeability is controlled by a specific address\\n/// @author Angle Labs., Inc\\n/// @dev The 0 address check in the modifier allows the use of these modifiers during initialization\\nabstract contract UUPSHelper is UUPSUpgradeable {\\n modifier onlyGuardianUpgrader(ICore _core) {\\n if (address(_core) != address(0) && !_core.isGovernorOrGuardian(msg.sender)) revert NotGovernorOrGuardian();\\n _;\\n }\\n\\n modifier onlyGovernorUpgrader(ICore _core) {\\n if (address(_core) != address(0) && !_core.isGovernor(msg.sender)) revert NotGovernor();\\n _;\\n }\\n\\n constructor() initializer {}\\n}\\n\",\"keccak256\":\"0xb8011db6d148c8a111678c8074343c82114b923806aee0f60c48ed05f8bd6c40\",\"license\":\"GPL-3.0\"}},\"version\":1}", + "bytecode": "0x60a0604052306080523480156200001557600080fd5b50600054610100900460ff1615808015620000375750600054600160ff909116105b8062000067575062000054306200022060201b620022ed1760201c565b15801562000067575060005460ff166001145b620000bf5760405162461bcd60e51b815260206004820152602e60248201526000805160206200391683398151915260448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084015b60405180910390fd5b6000805460ff191660011790558015620000e3576000805461ff0019166101001790555b801562000119576000805461ff001916905560405160018152600080516020620039368339815191529060200160405180910390a15b50600054610100900460ff16158080156200013b5750600054600160ff909116105b806200016b575062000158306200022060201b620022ed1760201c565b1580156200016b575060005460ff166001145b620001bf5760405162461bcd60e51b815260206004820152602e60248201526000805160206200391683398151915260448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401620000b6565b6000805460ff191660011790558015620001e3576000805461ff0019166101001790555b801562000219576000805461ff001916905560405160018152600080516020620039368339815191529060200160405180910390a15b506200022f565b6001600160a01b03163b151590565b6080516136af6200026760003960008181610c4a01528181610cff01528181610ff9015281816110a901526111f201526136af6000f3fe6080604052600436106101c25760003560e01c80635cec892a116100f7578063bdac7ca311610095578063d9c9808711610064578063d9c9808714610626578063e57480e514610646578063f2f4eb2614610673578063fd54b228146106a057600080fd5b8063bdac7ca314610589578063c4d66de8146105a9578063c748d261146105c9578063cce80e7a146105f657600080fd5b806371ee95c0116100d157806371ee95c0146105145780637ee843491461053457806389e1e82a14610554578063957888351461057457600080fd5b80635cec892a1461046b578063623b9e9d146104a25780636ac56103146104c257600080fd5b80632a25dd4111610164578063495906571161013e57806349590657146103da5780634f1ef286146103ef57806352d1902d146104025780635bf31d4d1461041757600080fd5b80632a25dd411461037a5780633659cfe61461039a5780634641fdef146103ba57600080fd5b80631171bda9116101a05780631171bda9146102d557806314769142146102f55780632637588e14610322578063288278381461035a57600080fd5b806309454ba3146101c75780630c9cbf0e146101f05780630d10fca3146102b3575b600080fd5b3480156101d357600080fd5b506101dd606c5481565b6040519081526020015b60405180910390f35b3480156101fc57600080fd5b5061027461020b36600461305c565b606d6020908152600092835260408084209091529082529020805460019091015479ffffffffffffffffffffffffffffffffffffffffffffffffffff8216917a010000000000000000000000000000000000000000000000000000900465ffffffffffff169083565b6040805179ffffffffffffffffffffffffffffffffffffffffffffffffffff909416845265ffffffffffff9092166020840152908201526060016101e7565b3480156102bf57600080fd5b506102d36102ce366004613095565b6106bb565b005b3480156102e157600080fd5b506102d36102f03660046130ae565b61080f565b34801561030157600080fd5b506101dd6103103660046130ef565b606f6020526000908152604090205481565b34801561032e57600080fd5b506101dd61033d36600461305c565b607060209081526000928352604080842090915290825290205481565b34801561036657600080fd5b506102d36103753660046130ef565b610964565b34801561038657600080fd5b506102d36103953660046131cf565b610b02565b3480156103a657600080fd5b506102d36103b53660046130ef565b610c33565b3480156103c657600080fd5b506102d36103d5366004613218565b610e3d565b3480156103e657600080fd5b506101dd610f84565b6102d36103fd366004613240565b610fe2565b34801561040e57600080fd5b506101dd6111d8565b34801561042357600080fd5b50606b54610454907a010000000000000000000000000000000000000000000000000000900465ffffffffffff1681565b60405165ffffffffffff90911681526020016101e7565b34801561047757600080fd5b50606b546104549074010000000000000000000000000000000000000000900465ffffffffffff1681565b3480156104ae57600080fd5b506102d36104bd3660046130ef565b6112c4565b3480156104ce57600080fd5b50606b546104ef9073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016101e7565b34801561052057600080fd5b506102d361052f3660046132f0565b61144b565b34801561054057600080fd5b506102d361054f3660046130ef565b611885565b34801561056057600080fd5b506102d361056f3660046133c2565b6119e6565b34801561058057600080fd5b506102d3611bf0565b34801561059557600080fd5b506102d36105a436600461305c565b611d12565b3480156105b557600080fd5b506102d36105c43660046130ef565b611ecd565b3480156105d557600080fd5b506069546104ef9073ffffffffffffffffffffffffffffffffffffffff1681565b34801561060257600080fd5b50606754606854610611919082565b604080519283526020830191909152016101e7565b34801561063257600080fd5b506102d36106413660046133df565b6120e4565b34801561065257600080fd5b506101dd6106613660046130ef565b606e6020526000908152604090205481565b34801561067f57600080fd5b50606a546104ef9073ffffffffffffffffffffffffffffffffffffffff1681565b3480156106ac57600080fd5b50606554606654610611919082565b606a546040517f521d4de900000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff9091169063521d4de990602401602060405180830381865afa158015610729573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061074d91906133f7565b610783576040517f99e120bc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606b5473ffffffffffffffffffffffffffffffffffffffff16156107d3576040517f0583257400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606c8190556040518181527f39bb629f3d59f5eddf978050e1f5fabeca2b5d02dfc9c25e84f32e7da1069db4906020015b60405180910390a150565b606a546040517f521d4de900000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff9091169063521d4de990602401602060405180830381865afa15801561087d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108a191906133f7565b6108d7576040517f99e120bc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6108f873ffffffffffffffffffffffffffffffffffffffff84168383612309565b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167ffff3b3844276f57024e0b42afec1a37f75db36511e43819a4f2a63ab7862b6488360405161095791815260200190565b60405180910390a3505050565b8073ffffffffffffffffffffffffffffffffffffffff8116331480159061099b5750336000908152606e6020526040902054600114155b8015610a365750606a546040517f521d4de900000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff9091169063521d4de990602401602060405180830381865afa158015610a10573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a3491906133f7565b155b15610a6d576040517fc22a648e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff82166000908152606f6020526040902054610a9e816001613443565b73ffffffffffffffffffffffffffffffffffffffff84166000818152606f602090815260409182902093909355518315815290917f81d714ca01079a19c106993b49b2764df6bb6abe740164ef7b77ee9c100a024a910160405180910390a2505050565b606b5473ffffffffffffffffffffffffffffffffffffffff1615610b52576040517f0583257400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606b5474010000000000000000000000000000000000000000900465ffffffffffff164210610bad576040517f1a8f039500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606c54606954610bd99173ffffffffffffffffffffffffffffffffffffffff90911690339030906123e2565b606b80547fffffffffffffffffffffffff000000000000000000000000000000000000000016331790556040517f5eca00b8ed745eee61451333090bfa56aa1f2a9e696a2aebe5f1f5b6cef6f2ff9061080490839061347a565b73ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000163003610cfd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602c60248201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060448201527f64656c656761746563616c6c000000000000000000000000000000000000000060648201526084015b60405180910390fd5b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16610d727f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5473ffffffffffffffffffffffffffffffffffffffff1690565b73ffffffffffffffffffffffffffffffffffffffff1614610e15576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602c60248201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060448201527f6163746976652070726f787900000000000000000000000000000000000000006064820152608401610cf4565b610e1e81612446565b60408051600080825260208201909252610e3a91839190612530565b50565b606a546040517f521d4de900000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff9091169063521d4de990602401602060405180830381865afa158015610eab573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ecf91906133f7565b610f05576040517f99e120bc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606b805479ffffffffffffffffffffffffffffffffffffffffffffffffffff167a01000000000000000000000000000000000000000000000000000065ffffffffffff8416908102919091179091556040519081527ffdf22e84af74bd4ab6b9646f6370a02bc886ed6ac25882db14e4ebf4b8e3bc7e90602001610804565b606b5460009074010000000000000000000000000000000000000000900465ffffffffffff164210801590610fcf5750606b5473ffffffffffffffffffffffffffffffffffffffff16155b15610fdb575060655490565b5060675490565b73ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001630036110a7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602c60248201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060448201527f64656c656761746563616c6c00000000000000000000000000000000000000006064820152608401610cf4565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1661111c7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5473ffffffffffffffffffffffffffffffffffffffff1690565b73ffffffffffffffffffffffffffffffffffffffff16146111bf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602c60248201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060448201527f6163746976652070726f787900000000000000000000000000000000000000006064820152608401610cf4565b6111c882612446565b6111d482826001612530565b5050565b60003073ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000161461129f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c60448201527f6c6564207468726f7567682064656c656761746563616c6c00000000000000006064820152608401610cf4565b507f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc90565b606a546040517f521d4de900000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff9091169063521d4de990602401602060405180830381865afa158015611332573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061135691906133f7565b61138c576040517f99e120bc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606b5473ffffffffffffffffffffffffffffffffffffffff16156113dc576040517f0583257400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606980547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081179091556040517f1db8d6629941dcb63d5e0c927b89c174c714e139a4b9107a49de839d755f5d7490600090a250565b868015806114595750808614155b806114645750808414155b8061146f5750808214155b156114a6576040517f1df89e8b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60005b818110156118795760008a8a838181106114c5576114c56134cb565b90506020020160208101906114da91906130ef565b905060008989848181106114f0576114f06134cb565b905060200201602081019061150591906130ef565b9050600088888581811061151b5761151b6134cb565b905060200201359050606f60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205460011480156115a1575073ffffffffffffffffffffffffffffffffffffffff83166000908152607060209081526040808320338452909152902054155b156115d8576040517f584a793800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040805173ffffffffffffffffffffffffffffffffffffffff8086166020830152841691810191909152606081018290526000906080016040516020818303038152906040528051906020012090506116868189898881811061163d5761163d6134cb565b905060200281019061164f91906134fa565b8080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525061272f92505050565b6116bc576040517f09bde33900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff8085166000908152606d602090815260408083209387168352929052908120546117179079ffffffffffffffffffffffffffffffffffffffffffffffffffff1684613443565b9050604051806060016040528061172d8561285b565b79ffffffffffffffffffffffffffffffffffffffffffffffffffff1681526020014265ffffffffffff168152602001611764610f84565b905273ffffffffffffffffffffffffffffffffffffffff8087166000908152606d602090815260408083209389168084529382529182902084519185015165ffffffffffff167a0100000000000000000000000000000000000000000000000000000279ffffffffffffffffffffffffffffffffffffffffffffffffffff909216919091178155920151600190920191909155611802908683612309565b8373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167ff7a40077ff7a04c7e61f6f26fb13774259ddf1b6bce9ecf26a8276cdd39926838360405161186191815260200190565b60405180910390a385600101955050505050506114a9565b50505050505050505050565b606a546040517f521d4de900000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff9091169063521d4de990602401602060405180830381865afa1580156118f3573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061191791906133f7565b61194d576040517f99e120bc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff81166000908152606e602052604081205461197e906001613443565b73ffffffffffffffffffffffffffffffffffffffff83166000818152606e6020908152604091829020849055905160018414815292935090917f7628ea5f6112a16b36a8239aa208395a8e8f221688cfb3a5461faffb9700abcd910160405180910390a25050565b606a546040517f521d4de900000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff9091169063521d4de990602401602060405180830381865afa158015611a54573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a7891906133f7565b611aae576040517f99e120bc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606b5473ffffffffffffffffffffffffffffffffffffffff16611afd576040517f9375474800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8015611b3e57606b54606c54606954611b319273ffffffffffffffffffffffffffffffffffffffff91821692911690612309565b611b3961290b565b611b96565b606c54606954611b689173ffffffffffffffffffffffffffffffffffffffff909116903390612309565b611b71426129e1565b606b60146101000a81548165ffffffffffff021916908365ffffffffffff1602179055505b606b80547fffffffffffffffffffffffff000000000000000000000000000000000000000016905560405181151581527f8015c5005d9ad5d85ca80d3f894f08e0159277704c54166e5cff108800fa80cd90602001610804565b606a546040517f521d4de900000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff9091169063521d4de990602401602060405180830381865afa158015611c5e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c8291906133f7565b611cb8576040517f99e120bc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606b5473ffffffffffffffffffffffffffffffffffffffff1615611d08576040517f0583257400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b611d1061290b565b565b8173ffffffffffffffffffffffffffffffffffffffff81163314801590611d495750336000908152606e6020526040902054600114155b8015611de45750606a546040517f521d4de900000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff9091169063521d4de990602401602060405180830381865afa158015611dbe573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611de291906133f7565b155b15611e1b576040517fc22a648e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff808416600090815260706020908152604080832093861683529290522054611e59816001613443565b73ffffffffffffffffffffffffffffffffffffffff858116600081815260706020908152604080832094891680845294825291829020949094555184158152919290917f42343f44c66ea1eaffa334760d3da2cb731d2a0b3b3e30423df997faa36cc95c910160405180910390a350505050565b600054610100900460ff1615808015611eed5750600054600160ff909116105b80611f075750303b158015611f07575060005460ff166001145b611f93576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a65640000000000000000000000000000000000006064820152608401610cf4565b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790558015611ff157600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff166101001790555b73ffffffffffffffffffffffffffffffffffffffff821661203e576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606a80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff841617905580156111d457600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15050565b606b5473ffffffffffffffffffffffffffffffffffffffff161515806121e05750336000908152606e602052604090205460011415806121455750606b5474010000000000000000000000000000000000000000900465ffffffffffff1642105b80156121e05750606a546040517f521d4de900000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff9091169063521d4de990602401602060405180830381865afa1580156121ba573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121de91906133f7565b155b15612217576040517fc22a648e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b604080518082019091526065805480835260668054602080860182905286359094559285013590556067556068556000612250426129e1565b606b80547fffffffffffff000000000000ffffffffffffffffffffffffffffffffffffffff167401000000000000000000000000000000000000000065ffffffffffff841690810291909117909155604080518635815260208088013590820152908101919091529091507f23aa2e4f757a7bd974085d3e11439a843b137b30905e3ffd51b2097c34aef62e9060600160405180910390a1505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b60405173ffffffffffffffffffffffffffffffffffffffff83166024820152604481018290526123dd9084907fa9059cbb00000000000000000000000000000000000000000000000000000000906064015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152612a46565b505050565b60405173ffffffffffffffffffffffffffffffffffffffff808516602483015283166044820152606481018290526124409085907f23b872dd000000000000000000000000000000000000000000000000000000009060840161235b565b50505050565b606a5473ffffffffffffffffffffffffffffffffffffffff1680158015906124f957506040517f521d4de900000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff82169063521d4de990602401602060405180830381865afa1580156124d3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124f791906133f7565b155b156111d4576040517f99e120bc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff1615612563576123dd83612b52565b8273ffffffffffffffffffffffffffffffffffffffff166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa9250505080156125e8575060408051601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01682019092526125e591810190613562565b60015b612674576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201527f6f6e206973206e6f7420555550530000000000000000000000000000000000006064820152608401610cf4565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc8114612723576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f7860448201527f6961626c655555494400000000000000000000000000000000000000000000006064820152608401610cf4565b506123dd838383612c5c565b80516000908390825b8181101561280957848181518110612752576127526134cb565b60200260200101518310156127b35782858281518110612774576127746134cb565b6020026020010151604051602001612796929190918252602082015260400190565b604051602081830303815290604052805190602001209250612801565b8481815181106127c5576127c56134cb565b6020026020010151836040516020016127e8929190918252602082015260400190565b6040516020818303038152906040528051906020012092505b600101612738565b506000612814610f84565b90508061284d576040517f094ad65800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b919091149150505b92915050565b600079ffffffffffffffffffffffffffffffffffffffffffffffffffff821115612907576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602760248201527f53616665436173743a2076616c756520646f65736e27742066697420696e203260448201527f30382062697473000000000000000000000000000000000000000000000000006064820152608401610cf4565b5090565b60408051808201825260675480825260685460208301819052606b80547fffffffffffff000000000000ffffffffffffffffffffffffffffffffffffffff16905560659190915560665590517f44825a4b2df8acb19ce4e1afba9aa850c8b65cdb7942e2078f27d0b0960efee690600090a1805160208201517f23aa2e4f757a7bd974085d3e11439a843b137b30905e3ffd51b2097c34aef62e9190610e106129b4814261357b565b6129be91906135c7565b60408051938452602084019290925265ffffffffffff1690820152606001610804565b606b54600090610e10907a010000000000000000000000000000000000000000000000000000900465ffffffffffff1681612a1d6001866135f1565b612a27919061357b565b612a32906001613617565b612a3c9190613617565b61285591906135c7565b6000612aa8826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16612c819092919063ffffffff16565b8051909150156123dd5780806020019051810190612ac691906133f7565b6123dd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610cf4565b73ffffffffffffffffffffffffffffffffffffffff81163b612bf6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e7472616374000000000000000000000000000000000000006064820152608401610cf4565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b612c6583612c9a565b600082511180612c725750805b156123dd576124408383612ce7565b6060612c908484600085612e26565b90505b9392505050565b612ca381612b52565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b606073ffffffffffffffffffffffffffffffffffffffff83163b612d8d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e747261637400000000000000000000000000000000000000000000000000006064820152608401610cf4565b6000808473ffffffffffffffffffffffffffffffffffffffff1684604051612db59190613636565b600060405180830381855af49150503d8060008114612df0576040519150601f19603f3d011682016040523d82523d6000602084013e612df5565b606091505b5091509150612e1d828260405180606001604052806027815260200161365360279139612f41565b95945050505050565b606082471015612eb8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610cf4565b6000808673ffffffffffffffffffffffffffffffffffffffff168587604051612ee19190613636565b60006040518083038185875af1925050503d8060008114612f1e576040519150601f19603f3d011682016040523d82523d6000602084013e612f23565b606091505b5091509150612f3487838387612f5a565b925050505b949350505050565b60608315612f50575081612c93565b612c938383612ff6565b60608315612ff0578251600003612fe95773ffffffffffffffffffffffffffffffffffffffff85163b612fe9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610cf4565b5081612f39565b612f3983835b8151156130065781518083602001fd5b806040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cf4919061347a565b73ffffffffffffffffffffffffffffffffffffffff81168114610e3a57600080fd5b6000806040838503121561306f57600080fd5b823561307a8161303a565b9150602083013561308a8161303a565b809150509250929050565b6000602082840312156130a757600080fd5b5035919050565b6000806000606084860312156130c357600080fd5b83356130ce8161303a565b925060208401356130de8161303a565b929592945050506040919091013590565b60006020828403121561310157600080fd5b8135612c938161303a565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600067ffffffffffffffff808411156131565761315661310c565b604051601f85017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f0116810190828211818310171561319c5761319c61310c565b816040528093508581528686860111156131b557600080fd5b858560208301376000602087830101525050509392505050565b6000602082840312156131e157600080fd5b813567ffffffffffffffff8111156131f857600080fd5b8201601f8101841361320957600080fd5b612f398482356020840161313b565b60006020828403121561322a57600080fd5b813565ffffffffffff81168114612c9357600080fd5b6000806040838503121561325357600080fd5b823561325e8161303a565b9150602083013567ffffffffffffffff81111561327a57600080fd5b8301601f8101851361328b57600080fd5b61329a8582356020840161313b565b9150509250929050565b60008083601f8401126132b657600080fd5b50813567ffffffffffffffff8111156132ce57600080fd5b6020830191508360208260051b85010111156132e957600080fd5b9250929050565b6000806000806000806000806080898b03121561330c57600080fd5b883567ffffffffffffffff8082111561332457600080fd5b6133308c838d016132a4565b909a50985060208b013591508082111561334957600080fd5b6133558c838d016132a4565b909850965060408b013591508082111561336e57600080fd5b61337a8c838d016132a4565b909650945060608b013591508082111561339357600080fd5b506133a08b828c016132a4565b999c989b5096995094979396929594505050565b8015158114610e3a57600080fd5b6000602082840312156133d457600080fd5b8135612c93816133b4565b6000604082840312156133f157600080fd5b50919050565b60006020828403121561340957600080fd5b8151612c93816133b4565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b8181038181111561285557612855613414565b60005b83811015613471578181015183820152602001613459565b50506000910152565b6020815260008251806020840152613499816040850160208701613456565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169190910160400192915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe184360301811261352f57600080fd5b83018035915067ffffffffffffffff82111561354a57600080fd5b6020019150600581901b36038213156132e957600080fd5b60006020828403121561357457600080fd5b5051919050565b600065ffffffffffff808416806135bb577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b92169190910492915050565b65ffffffffffff8181168382160280821691908281146135e9576135e9613414565b505092915050565b65ffffffffffff82811682821603908082111561361057613610613414565b5092915050565b65ffffffffffff81811683821601908082111561361057613610613414565b60008251613648818460208701613456565b919091019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b34d02b1c5423a38ab6e0daaa965103d5485c504a385a0bee80f718a7c3fcce164736f6c63430008110033496e697469616c697a61626c653a20636f6e747261637420697320616c7265617f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498", + "deployedBytecode": "0x6080604052600436106101c25760003560e01c80635cec892a116100f7578063bdac7ca311610095578063d9c9808711610064578063d9c9808714610626578063e57480e514610646578063f2f4eb2614610673578063fd54b228146106a057600080fd5b8063bdac7ca314610589578063c4d66de8146105a9578063c748d261146105c9578063cce80e7a146105f657600080fd5b806371ee95c0116100d157806371ee95c0146105145780637ee843491461053457806389e1e82a14610554578063957888351461057457600080fd5b80635cec892a1461046b578063623b9e9d146104a25780636ac56103146104c257600080fd5b80632a25dd4111610164578063495906571161013e57806349590657146103da5780634f1ef286146103ef57806352d1902d146104025780635bf31d4d1461041757600080fd5b80632a25dd411461037a5780633659cfe61461039a5780634641fdef146103ba57600080fd5b80631171bda9116101a05780631171bda9146102d557806314769142146102f55780632637588e14610322578063288278381461035a57600080fd5b806309454ba3146101c75780630c9cbf0e146101f05780630d10fca3146102b3575b600080fd5b3480156101d357600080fd5b506101dd606c5481565b6040519081526020015b60405180910390f35b3480156101fc57600080fd5b5061027461020b36600461305c565b606d6020908152600092835260408084209091529082529020805460019091015479ffffffffffffffffffffffffffffffffffffffffffffffffffff8216917a010000000000000000000000000000000000000000000000000000900465ffffffffffff169083565b6040805179ffffffffffffffffffffffffffffffffffffffffffffffffffff909416845265ffffffffffff9092166020840152908201526060016101e7565b3480156102bf57600080fd5b506102d36102ce366004613095565b6106bb565b005b3480156102e157600080fd5b506102d36102f03660046130ae565b61080f565b34801561030157600080fd5b506101dd6103103660046130ef565b606f6020526000908152604090205481565b34801561032e57600080fd5b506101dd61033d36600461305c565b607060209081526000928352604080842090915290825290205481565b34801561036657600080fd5b506102d36103753660046130ef565b610964565b34801561038657600080fd5b506102d36103953660046131cf565b610b02565b3480156103a657600080fd5b506102d36103b53660046130ef565b610c33565b3480156103c657600080fd5b506102d36103d5366004613218565b610e3d565b3480156103e657600080fd5b506101dd610f84565b6102d36103fd366004613240565b610fe2565b34801561040e57600080fd5b506101dd6111d8565b34801561042357600080fd5b50606b54610454907a010000000000000000000000000000000000000000000000000000900465ffffffffffff1681565b60405165ffffffffffff90911681526020016101e7565b34801561047757600080fd5b50606b546104549074010000000000000000000000000000000000000000900465ffffffffffff1681565b3480156104ae57600080fd5b506102d36104bd3660046130ef565b6112c4565b3480156104ce57600080fd5b50606b546104ef9073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016101e7565b34801561052057600080fd5b506102d361052f3660046132f0565b61144b565b34801561054057600080fd5b506102d361054f3660046130ef565b611885565b34801561056057600080fd5b506102d361056f3660046133c2565b6119e6565b34801561058057600080fd5b506102d3611bf0565b34801561059557600080fd5b506102d36105a436600461305c565b611d12565b3480156105b557600080fd5b506102d36105c43660046130ef565b611ecd565b3480156105d557600080fd5b506069546104ef9073ffffffffffffffffffffffffffffffffffffffff1681565b34801561060257600080fd5b50606754606854610611919082565b604080519283526020830191909152016101e7565b34801561063257600080fd5b506102d36106413660046133df565b6120e4565b34801561065257600080fd5b506101dd6106613660046130ef565b606e6020526000908152604090205481565b34801561067f57600080fd5b50606a546104ef9073ffffffffffffffffffffffffffffffffffffffff1681565b3480156106ac57600080fd5b50606554606654610611919082565b606a546040517f521d4de900000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff9091169063521d4de990602401602060405180830381865afa158015610729573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061074d91906133f7565b610783576040517f99e120bc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606b5473ffffffffffffffffffffffffffffffffffffffff16156107d3576040517f0583257400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606c8190556040518181527f39bb629f3d59f5eddf978050e1f5fabeca2b5d02dfc9c25e84f32e7da1069db4906020015b60405180910390a150565b606a546040517f521d4de900000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff9091169063521d4de990602401602060405180830381865afa15801561087d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108a191906133f7565b6108d7576040517f99e120bc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6108f873ffffffffffffffffffffffffffffffffffffffff84168383612309565b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167ffff3b3844276f57024e0b42afec1a37f75db36511e43819a4f2a63ab7862b6488360405161095791815260200190565b60405180910390a3505050565b8073ffffffffffffffffffffffffffffffffffffffff8116331480159061099b5750336000908152606e6020526040902054600114155b8015610a365750606a546040517f521d4de900000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff9091169063521d4de990602401602060405180830381865afa158015610a10573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a3491906133f7565b155b15610a6d576040517fc22a648e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff82166000908152606f6020526040902054610a9e816001613443565b73ffffffffffffffffffffffffffffffffffffffff84166000818152606f602090815260409182902093909355518315815290917f81d714ca01079a19c106993b49b2764df6bb6abe740164ef7b77ee9c100a024a910160405180910390a2505050565b606b5473ffffffffffffffffffffffffffffffffffffffff1615610b52576040517f0583257400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606b5474010000000000000000000000000000000000000000900465ffffffffffff164210610bad576040517f1a8f039500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606c54606954610bd99173ffffffffffffffffffffffffffffffffffffffff90911690339030906123e2565b606b80547fffffffffffffffffffffffff000000000000000000000000000000000000000016331790556040517f5eca00b8ed745eee61451333090bfa56aa1f2a9e696a2aebe5f1f5b6cef6f2ff9061080490839061347a565b73ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000163003610cfd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602c60248201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060448201527f64656c656761746563616c6c000000000000000000000000000000000000000060648201526084015b60405180910390fd5b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16610d727f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5473ffffffffffffffffffffffffffffffffffffffff1690565b73ffffffffffffffffffffffffffffffffffffffff1614610e15576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602c60248201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060448201527f6163746976652070726f787900000000000000000000000000000000000000006064820152608401610cf4565b610e1e81612446565b60408051600080825260208201909252610e3a91839190612530565b50565b606a546040517f521d4de900000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff9091169063521d4de990602401602060405180830381865afa158015610eab573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ecf91906133f7565b610f05576040517f99e120bc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606b805479ffffffffffffffffffffffffffffffffffffffffffffffffffff167a01000000000000000000000000000000000000000000000000000065ffffffffffff8416908102919091179091556040519081527ffdf22e84af74bd4ab6b9646f6370a02bc886ed6ac25882db14e4ebf4b8e3bc7e90602001610804565b606b5460009074010000000000000000000000000000000000000000900465ffffffffffff164210801590610fcf5750606b5473ffffffffffffffffffffffffffffffffffffffff16155b15610fdb575060655490565b5060675490565b73ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001630036110a7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602c60248201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060448201527f64656c656761746563616c6c00000000000000000000000000000000000000006064820152608401610cf4565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1661111c7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5473ffffffffffffffffffffffffffffffffffffffff1690565b73ffffffffffffffffffffffffffffffffffffffff16146111bf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602c60248201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060448201527f6163746976652070726f787900000000000000000000000000000000000000006064820152608401610cf4565b6111c882612446565b6111d482826001612530565b5050565b60003073ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000161461129f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c60448201527f6c6564207468726f7567682064656c656761746563616c6c00000000000000006064820152608401610cf4565b507f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc90565b606a546040517f521d4de900000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff9091169063521d4de990602401602060405180830381865afa158015611332573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061135691906133f7565b61138c576040517f99e120bc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606b5473ffffffffffffffffffffffffffffffffffffffff16156113dc576040517f0583257400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606980547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081179091556040517f1db8d6629941dcb63d5e0c927b89c174c714e139a4b9107a49de839d755f5d7490600090a250565b868015806114595750808614155b806114645750808414155b8061146f5750808214155b156114a6576040517f1df89e8b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60005b818110156118795760008a8a838181106114c5576114c56134cb565b90506020020160208101906114da91906130ef565b905060008989848181106114f0576114f06134cb565b905060200201602081019061150591906130ef565b9050600088888581811061151b5761151b6134cb565b905060200201359050606f60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205460011480156115a1575073ffffffffffffffffffffffffffffffffffffffff83166000908152607060209081526040808320338452909152902054155b156115d8576040517f584a793800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040805173ffffffffffffffffffffffffffffffffffffffff8086166020830152841691810191909152606081018290526000906080016040516020818303038152906040528051906020012090506116868189898881811061163d5761163d6134cb565b905060200281019061164f91906134fa565b8080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525061272f92505050565b6116bc576040517f09bde33900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff8085166000908152606d602090815260408083209387168352929052908120546117179079ffffffffffffffffffffffffffffffffffffffffffffffffffff1684613443565b9050604051806060016040528061172d8561285b565b79ffffffffffffffffffffffffffffffffffffffffffffffffffff1681526020014265ffffffffffff168152602001611764610f84565b905273ffffffffffffffffffffffffffffffffffffffff8087166000908152606d602090815260408083209389168084529382529182902084519185015165ffffffffffff167a0100000000000000000000000000000000000000000000000000000279ffffffffffffffffffffffffffffffffffffffffffffffffffff909216919091178155920151600190920191909155611802908683612309565b8373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167ff7a40077ff7a04c7e61f6f26fb13774259ddf1b6bce9ecf26a8276cdd39926838360405161186191815260200190565b60405180910390a385600101955050505050506114a9565b50505050505050505050565b606a546040517f521d4de900000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff9091169063521d4de990602401602060405180830381865afa1580156118f3573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061191791906133f7565b61194d576040517f99e120bc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff81166000908152606e602052604081205461197e906001613443565b73ffffffffffffffffffffffffffffffffffffffff83166000818152606e6020908152604091829020849055905160018414815292935090917f7628ea5f6112a16b36a8239aa208395a8e8f221688cfb3a5461faffb9700abcd910160405180910390a25050565b606a546040517f521d4de900000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff9091169063521d4de990602401602060405180830381865afa158015611a54573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a7891906133f7565b611aae576040517f99e120bc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606b5473ffffffffffffffffffffffffffffffffffffffff16611afd576040517f9375474800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8015611b3e57606b54606c54606954611b319273ffffffffffffffffffffffffffffffffffffffff91821692911690612309565b611b3961290b565b611b96565b606c54606954611b689173ffffffffffffffffffffffffffffffffffffffff909116903390612309565b611b71426129e1565b606b60146101000a81548165ffffffffffff021916908365ffffffffffff1602179055505b606b80547fffffffffffffffffffffffff000000000000000000000000000000000000000016905560405181151581527f8015c5005d9ad5d85ca80d3f894f08e0159277704c54166e5cff108800fa80cd90602001610804565b606a546040517f521d4de900000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff9091169063521d4de990602401602060405180830381865afa158015611c5e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c8291906133f7565b611cb8576040517f99e120bc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606b5473ffffffffffffffffffffffffffffffffffffffff1615611d08576040517f0583257400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b611d1061290b565b565b8173ffffffffffffffffffffffffffffffffffffffff81163314801590611d495750336000908152606e6020526040902054600114155b8015611de45750606a546040517f521d4de900000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff9091169063521d4de990602401602060405180830381865afa158015611dbe573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611de291906133f7565b155b15611e1b576040517fc22a648e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff808416600090815260706020908152604080832093861683529290522054611e59816001613443565b73ffffffffffffffffffffffffffffffffffffffff858116600081815260706020908152604080832094891680845294825291829020949094555184158152919290917f42343f44c66ea1eaffa334760d3da2cb731d2a0b3b3e30423df997faa36cc95c910160405180910390a350505050565b600054610100900460ff1615808015611eed5750600054600160ff909116105b80611f075750303b158015611f07575060005460ff166001145b611f93576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a65640000000000000000000000000000000000006064820152608401610cf4565b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790558015611ff157600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff166101001790555b73ffffffffffffffffffffffffffffffffffffffff821661203e576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606a80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff841617905580156111d457600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15050565b606b5473ffffffffffffffffffffffffffffffffffffffff161515806121e05750336000908152606e602052604090205460011415806121455750606b5474010000000000000000000000000000000000000000900465ffffffffffff1642105b80156121e05750606a546040517f521d4de900000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff9091169063521d4de990602401602060405180830381865afa1580156121ba573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121de91906133f7565b155b15612217576040517fc22a648e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b604080518082019091526065805480835260668054602080860182905286359094559285013590556067556068556000612250426129e1565b606b80547fffffffffffff000000000000ffffffffffffffffffffffffffffffffffffffff167401000000000000000000000000000000000000000065ffffffffffff841690810291909117909155604080518635815260208088013590820152908101919091529091507f23aa2e4f757a7bd974085d3e11439a843b137b30905e3ffd51b2097c34aef62e9060600160405180910390a1505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b60405173ffffffffffffffffffffffffffffffffffffffff83166024820152604481018290526123dd9084907fa9059cbb00000000000000000000000000000000000000000000000000000000906064015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152612a46565b505050565b60405173ffffffffffffffffffffffffffffffffffffffff808516602483015283166044820152606481018290526124409085907f23b872dd000000000000000000000000000000000000000000000000000000009060840161235b565b50505050565b606a5473ffffffffffffffffffffffffffffffffffffffff1680158015906124f957506040517f521d4de900000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff82169063521d4de990602401602060405180830381865afa1580156124d3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124f791906133f7565b155b156111d4576040517f99e120bc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff1615612563576123dd83612b52565b8273ffffffffffffffffffffffffffffffffffffffff166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa9250505080156125e8575060408051601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01682019092526125e591810190613562565b60015b612674576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201527f6f6e206973206e6f7420555550530000000000000000000000000000000000006064820152608401610cf4565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc8114612723576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f7860448201527f6961626c655555494400000000000000000000000000000000000000000000006064820152608401610cf4565b506123dd838383612c5c565b80516000908390825b8181101561280957848181518110612752576127526134cb565b60200260200101518310156127b35782858281518110612774576127746134cb565b6020026020010151604051602001612796929190918252602082015260400190565b604051602081830303815290604052805190602001209250612801565b8481815181106127c5576127c56134cb565b6020026020010151836040516020016127e8929190918252602082015260400190565b6040516020818303038152906040528051906020012092505b600101612738565b506000612814610f84565b90508061284d576040517f094ad65800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b919091149150505b92915050565b600079ffffffffffffffffffffffffffffffffffffffffffffffffffff821115612907576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602760248201527f53616665436173743a2076616c756520646f65736e27742066697420696e203260448201527f30382062697473000000000000000000000000000000000000000000000000006064820152608401610cf4565b5090565b60408051808201825260675480825260685460208301819052606b80547fffffffffffff000000000000ffffffffffffffffffffffffffffffffffffffff16905560659190915560665590517f44825a4b2df8acb19ce4e1afba9aa850c8b65cdb7942e2078f27d0b0960efee690600090a1805160208201517f23aa2e4f757a7bd974085d3e11439a843b137b30905e3ffd51b2097c34aef62e9190610e106129b4814261357b565b6129be91906135c7565b60408051938452602084019290925265ffffffffffff1690820152606001610804565b606b54600090610e10907a010000000000000000000000000000000000000000000000000000900465ffffffffffff1681612a1d6001866135f1565b612a27919061357b565b612a32906001613617565b612a3c9190613617565b61285591906135c7565b6000612aa8826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16612c819092919063ffffffff16565b8051909150156123dd5780806020019051810190612ac691906133f7565b6123dd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610cf4565b73ffffffffffffffffffffffffffffffffffffffff81163b612bf6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e7472616374000000000000000000000000000000000000006064820152608401610cf4565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b612c6583612c9a565b600082511180612c725750805b156123dd576124408383612ce7565b6060612c908484600085612e26565b90505b9392505050565b612ca381612b52565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b606073ffffffffffffffffffffffffffffffffffffffff83163b612d8d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e747261637400000000000000000000000000000000000000000000000000006064820152608401610cf4565b6000808473ffffffffffffffffffffffffffffffffffffffff1684604051612db59190613636565b600060405180830381855af49150503d8060008114612df0576040519150601f19603f3d011682016040523d82523d6000602084013e612df5565b606091505b5091509150612e1d828260405180606001604052806027815260200161365360279139612f41565b95945050505050565b606082471015612eb8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610cf4565b6000808673ffffffffffffffffffffffffffffffffffffffff168587604051612ee19190613636565b60006040518083038185875af1925050503d8060008114612f1e576040519150601f19603f3d011682016040523d82523d6000602084013e612f23565b606091505b5091509150612f3487838387612f5a565b925050505b949350505050565b60608315612f50575081612c93565b612c938383612ff6565b60608315612ff0578251600003612fe95773ffffffffffffffffffffffffffffffffffffffff85163b612fe9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610cf4565b5081612f39565b612f3983835b8151156130065781518083602001fd5b806040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cf4919061347a565b73ffffffffffffffffffffffffffffffffffffffff81168114610e3a57600080fd5b6000806040838503121561306f57600080fd5b823561307a8161303a565b9150602083013561308a8161303a565b809150509250929050565b6000602082840312156130a757600080fd5b5035919050565b6000806000606084860312156130c357600080fd5b83356130ce8161303a565b925060208401356130de8161303a565b929592945050506040919091013590565b60006020828403121561310157600080fd5b8135612c938161303a565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600067ffffffffffffffff808411156131565761315661310c565b604051601f85017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f0116810190828211818310171561319c5761319c61310c565b816040528093508581528686860111156131b557600080fd5b858560208301376000602087830101525050509392505050565b6000602082840312156131e157600080fd5b813567ffffffffffffffff8111156131f857600080fd5b8201601f8101841361320957600080fd5b612f398482356020840161313b565b60006020828403121561322a57600080fd5b813565ffffffffffff81168114612c9357600080fd5b6000806040838503121561325357600080fd5b823561325e8161303a565b9150602083013567ffffffffffffffff81111561327a57600080fd5b8301601f8101851361328b57600080fd5b61329a8582356020840161313b565b9150509250929050565b60008083601f8401126132b657600080fd5b50813567ffffffffffffffff8111156132ce57600080fd5b6020830191508360208260051b85010111156132e957600080fd5b9250929050565b6000806000806000806000806080898b03121561330c57600080fd5b883567ffffffffffffffff8082111561332457600080fd5b6133308c838d016132a4565b909a50985060208b013591508082111561334957600080fd5b6133558c838d016132a4565b909850965060408b013591508082111561336e57600080fd5b61337a8c838d016132a4565b909650945060608b013591508082111561339357600080fd5b506133a08b828c016132a4565b999c989b5096995094979396929594505050565b8015158114610e3a57600080fd5b6000602082840312156133d457600080fd5b8135612c93816133b4565b6000604082840312156133f157600080fd5b50919050565b60006020828403121561340957600080fd5b8151612c93816133b4565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b8181038181111561285557612855613414565b60005b83811015613471578181015183820152602001613459565b50506000910152565b6020815260008251806020840152613499816040850160208701613456565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169190910160400192915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe184360301811261352f57600080fd5b83018035915067ffffffffffffffff82111561354a57600080fd5b6020019150600581901b36038213156132e957600080fd5b60006020828403121561357457600080fd5b5051919050565b600065ffffffffffff808416806135bb577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b92169190910492915050565b65ffffffffffff8181168382160280821691908281146135e9576135e9613414565b505092915050565b65ffffffffffff82811682821603908082111561361057613610613414565b5092915050565b65ffffffffffff81811683821601908082111561361057613610613414565b60008251613648818460208701613456565b919091019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b34d02b1c5423a38ab6e0daaa965103d5485c504a385a0bee80f718a7c3fcce164736f6c63430008110033", + "devdoc": { + "author": "Angle Labs. Inc", + "kind": "dev", + "methods": { + "claim(address[],address[],uint256[],bytes32[][])": { + "details": "Anyone may call this function for anyone else, funds go to destination regardless, it's just a question of who provides the proof and pays the gas: `msg.sender` is used only for addresses that require a trusted operator", + "params": { + "amounts": "Amount of tokens that will be sent to the corresponding users", + "proofs": "Array of hashes bridging from a leaf `(hash of user | token | amount)` to the Merkle root", + "tokens": "ERC20 claimed", + "users": "Recipient of tokens" + } + }, + "disputeTree(string)": { + "details": "Requires a deposit of `disputeToken` that'll be slashed if the dispute is not acceptedIt is only possible to create a dispute within `disputePeriod` after each tree update" + }, + "proxiableUUID()": { + "details": "Implementation of the ERC1822 {proxiableUUID} function. This returns the storage slot used by the implementation. It is used to validate the implementation's compatibility when performing an upgrade. IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this function revert if invoked through a proxy. This is guaranteed by the `notDelegated` modifier." + }, + "resolveDispute(bool)": { + "params": { + "valid": "Whether the dispute was valid" + } + }, + "upgradeTo(address)": { + "details": "Upgrade the implementation of the proxy to `newImplementation`. Calls {_authorizeUpgrade}. Emits an {Upgraded} event." + }, + "upgradeToAndCall(address,bytes)": { + "details": "Upgrade the implementation of the proxy to `newImplementation`, and subsequently execute the function call encoded in `data`. Calls {_authorizeUpgrade}. Emits an {Upgraded} event." + } + }, + "stateVariables": { + "disputer": { + "details": "Used to store if there is an ongoing dispute" + } + }, + "title": "Distributor", + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": { + "canUpdateMerkleRoot(address)": { + "notice": "Trusted EOAs to update the Merkle root" + }, + "claim(address[],address[],uint256[],bytes32[][])": { + "notice": "Claims rewards for a given set of users" + }, + "claimed(address,address)": { + "notice": "Mapping user -> token -> amount to track claimed amounts" + }, + "core()": { + "notice": "`Core` contract handling access control" + }, + "disputeAmount()": { + "notice": "Amount to deposit to freeze the roots update" + }, + "disputePeriod()": { + "notice": "Time after which a change in a tree becomes effective, in EPOCH_DURATION" + }, + "disputeToken()": { + "notice": "Token to deposit to freeze the roots update" + }, + "disputeTree(string)": { + "notice": "Freezes the Merkle tree update until the dispute is resolved" + }, + "disputer()": { + "notice": "Address which created the dispute" + }, + "endOfDisputePeriod()": { + "notice": "When the current tree will become valid" + }, + "getMerkleRoot()": { + "notice": "Returns the MerkleRoot that is currently live for the contract" + }, + "lastTree()": { + "notice": "Tree that was in place in the contract before the last `tree` update" + }, + "onlyOperatorCanClaim(address)": { + "notice": "Whether or not to disable permissionless claiming" + }, + "operators(address,address)": { + "notice": "user -> operator -> authorisation to claim" + }, + "recoverERC20(address,address,uint256)": { + "notice": "Recovers any ERC20 token" + }, + "resolveDispute(bool)": { + "notice": "Resolve the ongoing dispute, if any" + }, + "revokeTree()": { + "notice": "Allows the governor or the guardian of this contract to fallback to the last version of the tree immediately" + }, + "setDisputeAmount(uint256)": { + "notice": "Sets the amount of `disputeToken` used as a caution during disputes" + }, + "setDisputePeriod(uint48)": { + "notice": "Sets the dispute period after which a tree update becomes effective" + }, + "setDisputeToken(address)": { + "notice": "Sets the token used as a caution during disputes" + }, + "toggleOnlyOperatorCanClaim(address)": { + "notice": "Toggles permissioned claiming for a given user" + }, + "toggleOperator(address,address)": { + "notice": "Toggles whitelisting for a given user and a given operator" + }, + "toggleTrusted(address)": { + "notice": "Adds or removes EOAs which are trusted to update the Merkle root" + }, + "tree()": { + "notice": "Tree of claimable tokens through this contract" + }, + "updateTree((bytes32,bytes32))": { + "notice": "Updates Merkle Tree" + } + }, + "notice": "Allows LPs on AMMs with concentrated liquidity to claim the rewards that were distributed to them", + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 395, + "contract": "contracts/Distributor.sol:Distributor", + "label": "_initialized", + "offset": 0, + "slot": "0", + "type": "t_uint8" + }, + { + "astId": 398, + "contract": "contracts/Distributor.sol:Distributor", + "label": "_initializing", + "offset": 1, + "slot": "0", + "type": "t_bool" + }, + { + "astId": 377, + "contract": "contracts/Distributor.sol:Distributor", + "label": "__gap", + "offset": 0, + "slot": "1", + "type": "t_array(t_uint256)50_storage" + }, + { + "astId": 692, + "contract": "contracts/Distributor.sol:Distributor", + "label": "__gap", + "offset": 0, + "slot": "51", + "type": "t_array(t_uint256)50_storage" + }, + { + "astId": 6919, + "contract": "contracts/Distributor.sol:Distributor", + "label": "tree", + "offset": 0, + "slot": "101", + "type": "t_struct(MerkleTree)6897_storage" + }, + { + "astId": 6923, + "contract": "contracts/Distributor.sol:Distributor", + "label": "lastTree", + "offset": 0, + "slot": "103", + "type": "t_struct(MerkleTree)6897_storage" + }, + { + "astId": 6927, + "contract": "contracts/Distributor.sol:Distributor", + "label": "disputeToken", + "offset": 0, + "slot": "105", + "type": "t_contract(IERC20)1266" + }, + { + "astId": 6931, + "contract": "contracts/Distributor.sol:Distributor", + "label": "core", + "offset": 0, + "slot": "106", + "type": "t_contract(ICore)8866" + }, + { + "astId": 6934, + "contract": "contracts/Distributor.sol:Distributor", + "label": "disputer", + "offset": 0, + "slot": "107", + "type": "t_address" + }, + { + "astId": 6937, + "contract": "contracts/Distributor.sol:Distributor", + "label": "endOfDisputePeriod", + "offset": 20, + "slot": "107", + "type": "t_uint48" + }, + { + "astId": 6940, + "contract": "contracts/Distributor.sol:Distributor", + "label": "disputePeriod", + "offset": 26, + "slot": "107", + "type": "t_uint48" + }, + { + "astId": 6943, + "contract": "contracts/Distributor.sol:Distributor", + "label": "disputeAmount", + "offset": 0, + "slot": "108", + "type": "t_uint256" + }, + { + "astId": 6951, + "contract": "contracts/Distributor.sol:Distributor", + "label": "claimed", + "offset": 0, + "slot": "109", + "type": "t_mapping(t_address,t_mapping(t_address,t_struct(Claim)6904_storage))" + }, + { + "astId": 6956, + "contract": "contracts/Distributor.sol:Distributor", + "label": "canUpdateMerkleRoot", + "offset": 0, + "slot": "110", + "type": "t_mapping(t_address,t_uint256)" + }, + { + "astId": 6961, + "contract": "contracts/Distributor.sol:Distributor", + "label": "onlyOperatorCanClaim", + "offset": 0, + "slot": "111", + "type": "t_mapping(t_address,t_uint256)" + }, + { + "astId": 6968, + "contract": "contracts/Distributor.sol:Distributor", + "label": "operators", + "offset": 0, + "slot": "112", + "type": "t_mapping(t_address,t_mapping(t_address,t_uint256))" + }, + { + "astId": 6972, + "contract": "contracts/Distributor.sol:Distributor", + "label": "__gap", + "offset": 0, + "slot": "113", + "type": "t_array(t_uint256)38_storage" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_array(t_uint256)38_storage": { + "base": "t_uint256", + "encoding": "inplace", + "label": "uint256[38]", + "numberOfBytes": "1216" + }, + "t_array(t_uint256)50_storage": { + "base": "t_uint256", + "encoding": "inplace", + "label": "uint256[50]", + "numberOfBytes": "1600" + }, + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_bytes32": { + "encoding": "inplace", + "label": "bytes32", + "numberOfBytes": "32" + }, + "t_contract(ICore)8866": { + "encoding": "inplace", + "label": "contract ICore", + "numberOfBytes": "20" + }, + "t_contract(IERC20)1266": { + "encoding": "inplace", + "label": "contract IERC20", + "numberOfBytes": "20" + }, + "t_mapping(t_address,t_mapping(t_address,t_struct(Claim)6904_storage))": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => mapping(address => struct Claim))", + "numberOfBytes": "32", + "value": "t_mapping(t_address,t_struct(Claim)6904_storage)" + }, + "t_mapping(t_address,t_mapping(t_address,t_uint256))": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => mapping(address => uint256))", + "numberOfBytes": "32", + "value": "t_mapping(t_address,t_uint256)" + }, + "t_mapping(t_address,t_struct(Claim)6904_storage)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => struct Claim)", + "numberOfBytes": "32", + "value": "t_struct(Claim)6904_storage" + }, + "t_mapping(t_address,t_uint256)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => uint256)", + "numberOfBytes": "32", + "value": "t_uint256" + }, + "t_struct(Claim)6904_storage": { + "encoding": "inplace", + "label": "struct Claim", + "members": [ + { + "astId": 6899, + "contract": "contracts/Distributor.sol:Distributor", + "label": "amount", + "offset": 0, + "slot": "0", + "type": "t_uint208" + }, + { + "astId": 6901, + "contract": "contracts/Distributor.sol:Distributor", + "label": "timestamp", + "offset": 26, + "slot": "0", + "type": "t_uint48" + }, + { + "astId": 6903, + "contract": "contracts/Distributor.sol:Distributor", + "label": "merkleRoot", + "offset": 0, + "slot": "1", + "type": "t_bytes32" + } + ], + "numberOfBytes": "64" + }, + "t_struct(MerkleTree)6897_storage": { + "encoding": "inplace", + "label": "struct MerkleTree", + "members": [ + { + "astId": 6894, + "contract": "contracts/Distributor.sol:Distributor", + "label": "merkleRoot", + "offset": 0, + "slot": "0", + "type": "t_bytes32" + }, + { + "astId": 6896, + "contract": "contracts/Distributor.sol:Distributor", + "label": "ipfsHash", + "offset": 0, + "slot": "1", + "type": "t_bytes32" + } + ], + "numberOfBytes": "64" + }, + "t_uint208": { + "encoding": "inplace", + "label": "uint208", + "numberOfBytes": "26" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + }, + "t_uint48": { + "encoding": "inplace", + "label": "uint48", + "numberOfBytes": "6" + }, + "t_uint8": { + "encoding": "inplace", + "label": "uint8", + "numberOfBytes": "1" + } + } + } +} \ No newline at end of file diff --git a/deployments/filecoin/solcInputs/1d17a992f70400315a977c7229541e31.json b/deployments/filecoin/solcInputs/1d17a992f70400315a977c7229541e31.json new file mode 100644 index 0000000..3683843 --- /dev/null +++ b/deployments/filecoin/solcInputs/1d17a992f70400315a977c7229541e31.json @@ -0,0 +1,132 @@ +{ + "language": "Solidity", + "sources": { + "@openzeppelin/contracts-upgradeable/interfaces/draft-IERC1822Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\n * proxy whose upgrades are fully controlled by the current implementation.\n */\ninterface IERC1822ProxiableUpgradeable {\n /**\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\n * address.\n *\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\n * function revert if invoked through a proxy.\n */\n function proxiableUUID() external view returns (bytes32);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/proxy/beacon/IBeaconUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\n */\ninterface IBeaconUpgradeable {\n /**\n * @dev Must return an address that can be used as a delegate call target.\n *\n * {BeaconProxy} will check that this address is a contract.\n */\n function implementation() external view returns (address);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/proxy/ERC1967/ERC1967UpgradeUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (proxy/ERC1967/ERC1967Upgrade.sol)\n\npragma solidity ^0.8.2;\n\nimport \"../beacon/IBeaconUpgradeable.sol\";\nimport \"../../interfaces/draft-IERC1822Upgradeable.sol\";\nimport \"../../utils/AddressUpgradeable.sol\";\nimport \"../../utils/StorageSlotUpgradeable.sol\";\nimport \"../utils/Initializable.sol\";\n\n/**\n * @dev This abstract contract provides getters and event emitting update functions for\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\n *\n * _Available since v4.1._\n *\n * @custom:oz-upgrades-unsafe-allow delegatecall\n */\nabstract contract ERC1967UpgradeUpgradeable is Initializable {\n function __ERC1967Upgrade_init() internal onlyInitializing {\n }\n\n function __ERC1967Upgrade_init_unchained() internal onlyInitializing {\n }\n // This is the keccak-256 hash of \"eip1967.proxy.rollback\" subtracted by 1\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\n\n /**\n * @dev Storage slot with the address of the current implementation.\n * This is the keccak-256 hash of \"eip1967.proxy.implementation\" subtracted by 1, and is\n * validated in the constructor.\n */\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n\n /**\n * @dev Emitted when the implementation is upgraded.\n */\n event Upgraded(address indexed implementation);\n\n /**\n * @dev Returns the current implementation address.\n */\n function _getImplementation() internal view returns (address) {\n return StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value;\n }\n\n /**\n * @dev Stores a new address in the EIP1967 implementation slot.\n */\n function _setImplementation(address newImplementation) private {\n require(AddressUpgradeable.isContract(newImplementation), \"ERC1967: new implementation is not a contract\");\n StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\n }\n\n /**\n * @dev Perform implementation upgrade\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeTo(address newImplementation) internal {\n _setImplementation(newImplementation);\n emit Upgraded(newImplementation);\n }\n\n /**\n * @dev Perform implementation upgrade with additional setup call.\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeToAndCall(\n address newImplementation,\n bytes memory data,\n bool forceCall\n ) internal {\n _upgradeTo(newImplementation);\n if (data.length > 0 || forceCall) {\n _functionDelegateCall(newImplementation, data);\n }\n }\n\n /**\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeToAndCallUUPS(\n address newImplementation,\n bytes memory data,\n bool forceCall\n ) internal {\n // Upgrades from old implementations will perform a rollback test. This test requires the new\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\n // this special case will break upgrade paths from old UUPS implementation to new ones.\n if (StorageSlotUpgradeable.getBooleanSlot(_ROLLBACK_SLOT).value) {\n _setImplementation(newImplementation);\n } else {\n try IERC1822ProxiableUpgradeable(newImplementation).proxiableUUID() returns (bytes32 slot) {\n require(slot == _IMPLEMENTATION_SLOT, \"ERC1967Upgrade: unsupported proxiableUUID\");\n } catch {\n revert(\"ERC1967Upgrade: new implementation is not UUPS\");\n }\n _upgradeToAndCall(newImplementation, data, forceCall);\n }\n }\n\n /**\n * @dev Storage slot with the admin of the contract.\n * This is the keccak-256 hash of \"eip1967.proxy.admin\" subtracted by 1, and is\n * validated in the constructor.\n */\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\n\n /**\n * @dev Emitted when the admin account has changed.\n */\n event AdminChanged(address previousAdmin, address newAdmin);\n\n /**\n * @dev Returns the current admin.\n */\n function _getAdmin() internal view returns (address) {\n return StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value;\n }\n\n /**\n * @dev Stores a new address in the EIP1967 admin slot.\n */\n function _setAdmin(address newAdmin) private {\n require(newAdmin != address(0), \"ERC1967: new admin is the zero address\");\n StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\n }\n\n /**\n * @dev Changes the admin of the proxy.\n *\n * Emits an {AdminChanged} event.\n */\n function _changeAdmin(address newAdmin) internal {\n emit AdminChanged(_getAdmin(), newAdmin);\n _setAdmin(newAdmin);\n }\n\n /**\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\n */\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\n\n /**\n * @dev Emitted when the beacon is upgraded.\n */\n event BeaconUpgraded(address indexed beacon);\n\n /**\n * @dev Returns the current beacon.\n */\n function _getBeacon() internal view returns (address) {\n return StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value;\n }\n\n /**\n * @dev Stores a new beacon in the EIP1967 beacon slot.\n */\n function _setBeacon(address newBeacon) private {\n require(AddressUpgradeable.isContract(newBeacon), \"ERC1967: new beacon is not a contract\");\n require(\n AddressUpgradeable.isContract(IBeaconUpgradeable(newBeacon).implementation()),\n \"ERC1967: beacon implementation is not a contract\"\n );\n StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value = newBeacon;\n }\n\n /**\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\n *\n * Emits a {BeaconUpgraded} event.\n */\n function _upgradeBeaconToAndCall(\n address newBeacon,\n bytes memory data,\n bool forceCall\n ) internal {\n _setBeacon(newBeacon);\n emit BeaconUpgraded(newBeacon);\n if (data.length > 0 || forceCall) {\n _functionDelegateCall(IBeaconUpgradeable(newBeacon).implementation(), data);\n }\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function _functionDelegateCall(address target, bytes memory data) private returns (bytes memory) {\n require(AddressUpgradeable.isContract(target), \"Address: delegate call to non-contract\");\n\n // solhint-disable-next-line avoid-low-level-calls\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return AddressUpgradeable.verifyCallResult(success, returndata, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.1) (proxy/utils/Initializable.sol)\n\npragma solidity ^0.8.2;\n\nimport \"../../utils/AddressUpgradeable.sol\";\n\n/**\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\n *\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\n * reused. This mechanism prevents re-execution of each \"step\" but allows the creation of new initialization steps in\n * case an upgrade adds a module that needs to be initialized.\n *\n * For example:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * contract MyToken is ERC20Upgradeable {\n * function initialize() initializer public {\n * __ERC20_init(\"MyToken\", \"MTK\");\n * }\n * }\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\n * function initializeV2() reinitializer(2) public {\n * __ERC20Permit_init(\"MyToken\");\n * }\n * }\n * ```\n *\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\n *\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\n *\n * [CAUTION]\n * ====\n * Avoid leaving a contract uninitialized.\n *\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * /// @custom:oz-upgrades-unsafe-allow constructor\n * constructor() {\n * _disableInitializers();\n * }\n * ```\n * ====\n */\nabstract contract Initializable {\n /**\n * @dev Indicates that the contract has been initialized.\n * @custom:oz-retyped-from bool\n */\n uint8 private _initialized;\n\n /**\n * @dev Indicates that the contract is in the process of being initialized.\n */\n bool private _initializing;\n\n /**\n * @dev Triggered when the contract has been initialized or reinitialized.\n */\n event Initialized(uint8 version);\n\n /**\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\n * `onlyInitializing` functions can be used to initialize parent contracts.\n *\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\n * constructor.\n *\n * Emits an {Initialized} event.\n */\n modifier initializer() {\n bool isTopLevelCall = !_initializing;\n require(\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\n \"Initializable: contract is already initialized\"\n );\n _initialized = 1;\n if (isTopLevelCall) {\n _initializing = true;\n }\n _;\n if (isTopLevelCall) {\n _initializing = false;\n emit Initialized(1);\n }\n }\n\n /**\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\n * used to initialize parent contracts.\n *\n * A reinitializer may be used after the original initialization step. This is essential to configure modules that\n * are added through upgrades and that require initialization.\n *\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\n * cannot be nested. If one is invoked in the context of another, execution will revert.\n *\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\n * a contract, executing them in the right order is up to the developer or operator.\n *\n * WARNING: setting the version to 255 will prevent any future reinitialization.\n *\n * Emits an {Initialized} event.\n */\n modifier reinitializer(uint8 version) {\n require(!_initializing && _initialized < version, \"Initializable: contract is already initialized\");\n _initialized = version;\n _initializing = true;\n _;\n _initializing = false;\n emit Initialized(version);\n }\n\n /**\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\n */\n modifier onlyInitializing() {\n require(_initializing, \"Initializable: contract is not initializing\");\n _;\n }\n\n /**\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\n * through proxies.\n *\n * Emits an {Initialized} event the first time it is successfully executed.\n */\n function _disableInitializers() internal virtual {\n require(!_initializing, \"Initializable: contract is initializing\");\n if (_initialized < type(uint8).max) {\n _initialized = type(uint8).max;\n emit Initialized(type(uint8).max);\n }\n }\n\n /**\n * @dev Returns the highest version that has been initialized. See {reinitializer}.\n */\n function _getInitializedVersion() internal view returns (uint8) {\n return _initialized;\n }\n\n /**\n * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.\n */\n function _isInitializing() internal view returns (bool) {\n return _initializing;\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (proxy/utils/UUPSUpgradeable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../interfaces/draft-IERC1822Upgradeable.sol\";\nimport \"../ERC1967/ERC1967UpgradeUpgradeable.sol\";\nimport \"./Initializable.sol\";\n\n/**\n * @dev An upgradeability mechanism designed for UUPS proxies. The functions included here can perform an upgrade of an\n * {ERC1967Proxy}, when this contract is set as the implementation behind such a proxy.\n *\n * A security mechanism ensures that an upgrade does not turn off upgradeability accidentally, although this risk is\n * reinstated if the upgrade retains upgradeability but removes the security mechanism, e.g. by replacing\n * `UUPSUpgradeable` with a custom implementation of upgrades.\n *\n * The {_authorizeUpgrade} function must be overridden to include access restriction to the upgrade mechanism.\n *\n * _Available since v4.1._\n */\nabstract contract UUPSUpgradeable is Initializable, IERC1822ProxiableUpgradeable, ERC1967UpgradeUpgradeable {\n function __UUPSUpgradeable_init() internal onlyInitializing {\n }\n\n function __UUPSUpgradeable_init_unchained() internal onlyInitializing {\n }\n /// @custom:oz-upgrades-unsafe-allow state-variable-immutable state-variable-assignment\n address private immutable __self = address(this);\n\n /**\n * @dev Check that the execution is being performed through a delegatecall call and that the execution context is\n * a proxy contract with an implementation (as defined in ERC1967) pointing to self. This should only be the case\n * for UUPS and transparent proxies that are using the current contract as their implementation. Execution of a\n * function through ERC1167 minimal proxies (clones) would not normally pass this test, but is not guaranteed to\n * fail.\n */\n modifier onlyProxy() {\n require(address(this) != __self, \"Function must be called through delegatecall\");\n require(_getImplementation() == __self, \"Function must be called through active proxy\");\n _;\n }\n\n /**\n * @dev Check that the execution is not being performed through a delegate call. This allows a function to be\n * callable on the implementing contract but not through proxies.\n */\n modifier notDelegated() {\n require(address(this) == __self, \"UUPSUpgradeable: must not be called through delegatecall\");\n _;\n }\n\n /**\n * @dev Implementation of the ERC1822 {proxiableUUID} function. This returns the storage slot used by the\n * implementation. It is used to validate the implementation's compatibility when performing an upgrade.\n *\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\n * function revert if invoked through a proxy. This is guaranteed by the `notDelegated` modifier.\n */\n function proxiableUUID() external view virtual override notDelegated returns (bytes32) {\n return _IMPLEMENTATION_SLOT;\n }\n\n /**\n * @dev Upgrade the implementation of the proxy to `newImplementation`.\n *\n * Calls {_authorizeUpgrade}.\n *\n * Emits an {Upgraded} event.\n */\n function upgradeTo(address newImplementation) external virtual onlyProxy {\n _authorizeUpgrade(newImplementation);\n _upgradeToAndCallUUPS(newImplementation, new bytes(0), false);\n }\n\n /**\n * @dev Upgrade the implementation of the proxy to `newImplementation`, and subsequently execute the function call\n * encoded in `data`.\n *\n * Calls {_authorizeUpgrade}.\n *\n * Emits an {Upgraded} event.\n */\n function upgradeToAndCall(address newImplementation, bytes memory data) external payable virtual onlyProxy {\n _authorizeUpgrade(newImplementation);\n _upgradeToAndCallUUPS(newImplementation, data, true);\n }\n\n /**\n * @dev Function that should revert when `msg.sender` is not authorized to upgrade the contract. Called by\n * {upgradeTo} and {upgradeToAndCall}.\n *\n * Normally, this function will use an xref:access.adoc[access control] modifier such as {Ownable-onlyOwner}.\n *\n * ```solidity\n * function _authorizeUpgrade(address) internal override onlyOwner {}\n * ```\n */\n function _authorizeUpgrade(address newImplementation) internal virtual;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (security/ReentrancyGuard.sol)\n\npragma solidity ^0.8.0;\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Contract module that helps prevent reentrant calls to a function.\n *\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\n * available, which can be applied to functions to make sure there are no nested\n * (reentrant) calls to them.\n *\n * Note that because there is a single `nonReentrant` guard, functions marked as\n * `nonReentrant` may not call one another. This can be worked around by making\n * those functions `private`, and then adding `external` `nonReentrant` entry\n * points to them.\n *\n * TIP: If you would like to learn more about reentrancy and alternative ways\n * to protect against it, check out our blog post\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\n */\nabstract contract ReentrancyGuardUpgradeable is Initializable {\n // Booleans are more expensive than uint256 or any type that takes up a full\n // word because each write operation emits an extra SLOAD to first read the\n // slot's contents, replace the bits taken up by the boolean, and then write\n // back. This is the compiler's defense against contract upgrades and\n // pointer aliasing, and it cannot be disabled.\n\n // The values being non-zero value makes deployment a bit more expensive,\n // but in exchange the refund on every call to nonReentrant will be lower in\n // amount. Since refunds are capped to a percentage of the total\n // transaction's gas, it is best to keep them low in cases like this one, to\n // increase the likelihood of the full refund coming into effect.\n uint256 private constant _NOT_ENTERED = 1;\n uint256 private constant _ENTERED = 2;\n\n uint256 private _status;\n\n function __ReentrancyGuard_init() internal onlyInitializing {\n __ReentrancyGuard_init_unchained();\n }\n\n function __ReentrancyGuard_init_unchained() internal onlyInitializing {\n _status = _NOT_ENTERED;\n }\n\n /**\n * @dev Prevents a contract from calling itself, directly or indirectly.\n * Calling a `nonReentrant` function from another `nonReentrant`\n * function is not supported. It is possible to prevent this from happening\n * by making the `nonReentrant` function external, and making it call a\n * `private` function that does the actual work.\n */\n modifier nonReentrant() {\n _nonReentrantBefore();\n _;\n _nonReentrantAfter();\n }\n\n function _nonReentrantBefore() private {\n // On the first call to nonReentrant, _status will be _NOT_ENTERED\n require(_status != _ENTERED, \"ReentrancyGuard: reentrant call\");\n\n // Any calls to nonReentrant after this point will fail\n _status = _ENTERED;\n }\n\n function _nonReentrantAfter() private {\n // By storing the original value once again, a refund is triggered (see\n // https://eips.ethereum.org/EIPS/eip-2200)\n _status = _NOT_ENTERED;\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[49] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20Upgradeable {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary AddressUpgradeable {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/StorageSlotUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/StorageSlot.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Library for reading and writing primitive types to specific storage slots.\n *\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\n * This library helps with reading and writing to such slots without the need for inline assembly.\n *\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\n *\n * Example usage to set ERC1967 implementation slot:\n * ```\n * contract ERC1967 {\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n *\n * function _getImplementation() internal view returns (address) {\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\n * }\n *\n * function _setImplementation(address newImplementation) internal {\n * require(Address.isContract(newImplementation), \"ERC1967: new implementation is not a contract\");\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\n * }\n * }\n * ```\n *\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\n */\nlibrary StorageSlotUpgradeable {\n struct AddressSlot {\n address value;\n }\n\n struct BooleanSlot {\n bool value;\n }\n\n struct Bytes32Slot {\n bytes32 value;\n }\n\n struct Uint256Slot {\n uint256 value;\n }\n\n /**\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\n */\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\n */\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\n */\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\n */\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n */\ninterface IERC20Permit {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also apply here.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `deadline` must be a timestamp in the future.\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\n * over the EIP712-formatted function arguments.\n * - the signature must use ``owner``'s current nonce (see {nonces}).\n *\n * For more information on the signature format, see the\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\n * section].\n */\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n\n /**\n * @dev Returns the current nonce for `owner`. This value must be\n * included whenever a signature is generated for {permit}.\n *\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\n * prevents a signature from being used multiple times.\n */\n function nonces(address owner) external view returns (uint256);\n\n /**\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\n */\n // solhint-disable-next-line func-name-mixedcase\n function DOMAIN_SEPARATOR() external view returns (bytes32);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20Metadata is IERC20 {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/IERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\nimport \"../extensions/draft-IERC20Permit.sol\";\nimport \"../../../utils/Address.sol\";\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n using Address for address;\n\n function safeTransfer(\n IERC20 token,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n function safeTransferFrom(\n IERC20 token,\n address from,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\n }\n\n /**\n * @dev Deprecated. This function has issues similar to the ones found in\n * {IERC20-approve}, and its usage is discouraged.\n *\n * Whenever possible, use {safeIncreaseAllowance} and\n * {safeDecreaseAllowance} instead.\n */\n function safeApprove(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n // safeApprove should only be called when setting an initial allowance,\n // or when resetting it to zero. To increase and decrease it, use\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\n require(\n (value == 0) || (token.allowance(address(this), spender) == 0),\n \"SafeERC20: approve from non-zero to non-zero allowance\"\n );\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\n }\n\n function safeIncreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n uint256 newAllowance = token.allowance(address(this), spender) + value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n\n function safeDecreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n unchecked {\n uint256 oldAllowance = token.allowance(address(this), spender);\n require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\n uint256 newAllowance = oldAllowance - value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n }\n\n function safePermit(\n IERC20Permit token,\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal {\n uint256 nonceBefore = token.nonces(owner);\n token.permit(owner, spender, value, deadline, v, r, s);\n uint256 nonceAfter = token.nonces(owner);\n require(nonceAfter == nonceBefore + 1, \"SafeERC20: permit did not succeed\");\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data, \"SafeERC20: low-level call failed\");\n if (returndata.length > 0) {\n // Return data is optional\n require(abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Address.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/cryptography/ECDSA.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/ECDSA.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../Strings.sol\";\n\n/**\n * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.\n *\n * These functions can be used to verify that a message was signed by the holder\n * of the private keys of a given address.\n */\nlibrary ECDSA {\n enum RecoverError {\n NoError,\n InvalidSignature,\n InvalidSignatureLength,\n InvalidSignatureS,\n InvalidSignatureV // Deprecated in v4.8\n }\n\n function _throwError(RecoverError error) private pure {\n if (error == RecoverError.NoError) {\n return; // no error: do nothing\n } else if (error == RecoverError.InvalidSignature) {\n revert(\"ECDSA: invalid signature\");\n } else if (error == RecoverError.InvalidSignatureLength) {\n revert(\"ECDSA: invalid signature length\");\n } else if (error == RecoverError.InvalidSignatureS) {\n revert(\"ECDSA: invalid signature 's' value\");\n }\n }\n\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with\n * `signature` or error string. This address can then be used for verification purposes.\n *\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {toEthSignedMessageHash} on it.\n *\n * Documentation for signature generation:\n * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]\n * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]\n *\n * _Available since v4.3._\n */\n function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {\n if (signature.length == 65) {\n bytes32 r;\n bytes32 s;\n uint8 v;\n // ecrecover takes the signature parameters, and the only way to get them\n // currently is to use assembly.\n /// @solidity memory-safe-assembly\n assembly {\n r := mload(add(signature, 0x20))\n s := mload(add(signature, 0x40))\n v := byte(0, mload(add(signature, 0x60)))\n }\n return tryRecover(hash, v, r, s);\n } else {\n return (address(0), RecoverError.InvalidSignatureLength);\n }\n }\n\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with\n * `signature`. This address can then be used for verification purposes.\n *\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {toEthSignedMessageHash} on it.\n */\n function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, signature);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.\n *\n * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]\n *\n * _Available since v4.3._\n */\n function tryRecover(\n bytes32 hash,\n bytes32 r,\n bytes32 vs\n ) internal pure returns (address, RecoverError) {\n bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);\n uint8 v = uint8((uint256(vs) >> 255) + 27);\n return tryRecover(hash, v, r, s);\n }\n\n /**\n * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.\n *\n * _Available since v4.2._\n */\n function recover(\n bytes32 hash,\n bytes32 r,\n bytes32 vs\n ) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, r, vs);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Overload of {ECDSA-tryRecover} that receives the `v`,\n * `r` and `s` signature fields separately.\n *\n * _Available since v4.3._\n */\n function tryRecover(\n bytes32 hash,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal pure returns (address, RecoverError) {\n // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature\n // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines\n // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most\n // signatures from current libraries generate a unique signature with an s-value in the lower half order.\n //\n // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value\n // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or\n // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept\n // these malleable signatures as well.\n if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {\n return (address(0), RecoverError.InvalidSignatureS);\n }\n\n // If the signature is valid (and not malleable), return the signer address\n address signer = ecrecover(hash, v, r, s);\n if (signer == address(0)) {\n return (address(0), RecoverError.InvalidSignature);\n }\n\n return (signer, RecoverError.NoError);\n }\n\n /**\n * @dev Overload of {ECDSA-recover} that receives the `v`,\n * `r` and `s` signature fields separately.\n */\n function recover(\n bytes32 hash,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, v, r, s);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Returns an Ethereum Signed Message, created from a `hash`. This\n * produces hash corresponding to the one signed with the\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n * JSON-RPC method as part of EIP-191.\n *\n * See {recover}.\n */\n function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {\n // 32 is the length in bytes of hash,\n // enforced by the type signature above\n return keccak256(abi.encodePacked(\"\\x19Ethereum Signed Message:\\n32\", hash));\n }\n\n /**\n * @dev Returns an Ethereum Signed Message, created from `s`. This\n * produces hash corresponding to the one signed with the\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n * JSON-RPC method as part of EIP-191.\n *\n * See {recover}.\n */\n function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(\"\\x19Ethereum Signed Message:\\n\", Strings.toString(s.length), s));\n }\n\n /**\n * @dev Returns an Ethereum Signed Typed Data, created from a\n * `domainSeparator` and a `structHash`. This produces hash corresponding\n * to the one signed with the\n * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]\n * JSON-RPC method as part of EIP-712.\n *\n * See {recover}.\n */\n function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(\"\\x19\\x01\", domainSeparator, structHash));\n }\n}\n" + }, + "@openzeppelin/contracts/utils/math/Math.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary Math {\n enum Rounding {\n Down, // Toward negative infinity\n Up, // Toward infinity\n Zero // Toward zero\n }\n\n /**\n * @dev Returns the largest of two numbers.\n */\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two numbers.\n */\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two numbers. The result is rounded towards\n * zero.\n */\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b) / 2 can overflow.\n return (a & b) + (a ^ b) / 2;\n }\n\n /**\n * @dev Returns the ceiling of the division of two numbers.\n *\n * This differs from standard division with `/` in that it rounds up instead\n * of rounding down.\n */\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b - 1) / b can overflow on addition, so we distribute.\n return a == 0 ? 0 : (a - 1) / b + 1;\n }\n\n /**\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\n * with further edits by Uniswap Labs also under MIT license.\n */\n function mulDiv(\n uint256 x,\n uint256 y,\n uint256 denominator\n ) internal pure returns (uint256 result) {\n unchecked {\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\n // variables such that product = prod1 * 2^256 + prod0.\n uint256 prod0; // Least significant 256 bits of the product\n uint256 prod1; // Most significant 256 bits of the product\n assembly {\n let mm := mulmod(x, y, not(0))\n prod0 := mul(x, y)\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n }\n\n // Handle non-overflow cases, 256 by 256 division.\n if (prod1 == 0) {\n return prod0 / denominator;\n }\n\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\n require(denominator > prod1);\n\n ///////////////////////////////////////////////\n // 512 by 256 division.\n ///////////////////////////////////////////////\n\n // Make division exact by subtracting the remainder from [prod1 prod0].\n uint256 remainder;\n assembly {\n // Compute remainder using mulmod.\n remainder := mulmod(x, y, denominator)\n\n // Subtract 256 bit number from 512 bit number.\n prod1 := sub(prod1, gt(remainder, prod0))\n prod0 := sub(prod0, remainder)\n }\n\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\n // See https://cs.stackexchange.com/q/138556/92363.\n\n // Does not overflow because the denominator cannot be zero at this stage in the function.\n uint256 twos = denominator & (~denominator + 1);\n assembly {\n // Divide denominator by twos.\n denominator := div(denominator, twos)\n\n // Divide [prod1 prod0] by twos.\n prod0 := div(prod0, twos)\n\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\n twos := add(div(sub(0, twos), twos), 1)\n }\n\n // Shift in bits from prod1 into prod0.\n prod0 |= prod1 * twos;\n\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\n // four bits. That is, denominator * inv = 1 mod 2^4.\n uint256 inverse = (3 * denominator) ^ 2;\n\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\n // in modular arithmetic, doubling the correct bits in each step.\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\n\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\n // is no longer required.\n result = prod0 * inverse;\n return result;\n }\n }\n\n /**\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\n */\n function mulDiv(\n uint256 x,\n uint256 y,\n uint256 denominator,\n Rounding rounding\n ) internal pure returns (uint256) {\n uint256 result = mulDiv(x, y, denominator);\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\n result += 1;\n }\n return result;\n }\n\n /**\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\n *\n * Inspired by Henry S. Warren, Jr.'s \"Hacker's Delight\" (Chapter 11).\n */\n function sqrt(uint256 a) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\n //\n // We know that the \"msb\" (most significant bit) of our target number `a` is a power of 2 such that we have\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\n //\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\n // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\n // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\n //\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\n uint256 result = 1 << (log2(a) >> 1);\n\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\n // into the expected uint128 result.\n unchecked {\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n return min(result, a / result);\n }\n }\n\n /**\n * @notice Calculates sqrt(a), following the selected rounding direction.\n */\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = sqrt(a);\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 2, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 128;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 64;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 32;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 16;\n }\n if (value >> 8 > 0) {\n value >>= 8;\n result += 8;\n }\n if (value >> 4 > 0) {\n value >>= 4;\n result += 4;\n }\n if (value >> 2 > 0) {\n value >>= 2;\n result += 2;\n }\n if (value >> 1 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log2(value);\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 10, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >= 10**64) {\n value /= 10**64;\n result += 64;\n }\n if (value >= 10**32) {\n value /= 10**32;\n result += 32;\n }\n if (value >= 10**16) {\n value /= 10**16;\n result += 16;\n }\n if (value >= 10**8) {\n value /= 10**8;\n result += 8;\n }\n if (value >= 10**4) {\n value /= 10**4;\n result += 4;\n }\n if (value >= 10**2) {\n value /= 10**2;\n result += 2;\n }\n if (value >= 10**1) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log10(value);\n return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 256, rounded down, of a positive value.\n * Returns 0 if given 0.\n *\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\n */\n function log256(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 16;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 8;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 4;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 2;\n }\n if (value >> 8 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log256(value);\n return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/math/SafeCast.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SafeCast.sol)\n// This file was procedurally generated from scripts/generate/templates/SafeCast.js.\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Wrappers over Solidity's uintXX/intXX casting operators with added overflow\n * checks.\n *\n * Downcasting from uint256/int256 in Solidity does not revert on overflow. This can\n * easily result in undesired exploitation or bugs, since developers usually\n * assume that overflows raise errors. `SafeCast` restores this intuition by\n * reverting the transaction when such an operation overflows.\n *\n * Using this library instead of the unchecked operations eliminates an entire\n * class of bugs, so it's recommended to use it always.\n *\n * Can be combined with {SafeMath} and {SignedSafeMath} to extend it to smaller types, by performing\n * all math on `uint256` and `int256` and then downcasting.\n */\nlibrary SafeCast {\n /**\n * @dev Returns the downcasted uint248 from uint256, reverting on\n * overflow (when the input is greater than largest uint248).\n *\n * Counterpart to Solidity's `uint248` operator.\n *\n * Requirements:\n *\n * - input must fit into 248 bits\n *\n * _Available since v4.7._\n */\n function toUint248(uint256 value) internal pure returns (uint248) {\n require(value <= type(uint248).max, \"SafeCast: value doesn't fit in 248 bits\");\n return uint248(value);\n }\n\n /**\n * @dev Returns the downcasted uint240 from uint256, reverting on\n * overflow (when the input is greater than largest uint240).\n *\n * Counterpart to Solidity's `uint240` operator.\n *\n * Requirements:\n *\n * - input must fit into 240 bits\n *\n * _Available since v4.7._\n */\n function toUint240(uint256 value) internal pure returns (uint240) {\n require(value <= type(uint240).max, \"SafeCast: value doesn't fit in 240 bits\");\n return uint240(value);\n }\n\n /**\n * @dev Returns the downcasted uint232 from uint256, reverting on\n * overflow (when the input is greater than largest uint232).\n *\n * Counterpart to Solidity's `uint232` operator.\n *\n * Requirements:\n *\n * - input must fit into 232 bits\n *\n * _Available since v4.7._\n */\n function toUint232(uint256 value) internal pure returns (uint232) {\n require(value <= type(uint232).max, \"SafeCast: value doesn't fit in 232 bits\");\n return uint232(value);\n }\n\n /**\n * @dev Returns the downcasted uint224 from uint256, reverting on\n * overflow (when the input is greater than largest uint224).\n *\n * Counterpart to Solidity's `uint224` operator.\n *\n * Requirements:\n *\n * - input must fit into 224 bits\n *\n * _Available since v4.2._\n */\n function toUint224(uint256 value) internal pure returns (uint224) {\n require(value <= type(uint224).max, \"SafeCast: value doesn't fit in 224 bits\");\n return uint224(value);\n }\n\n /**\n * @dev Returns the downcasted uint216 from uint256, reverting on\n * overflow (when the input is greater than largest uint216).\n *\n * Counterpart to Solidity's `uint216` operator.\n *\n * Requirements:\n *\n * - input must fit into 216 bits\n *\n * _Available since v4.7._\n */\n function toUint216(uint256 value) internal pure returns (uint216) {\n require(value <= type(uint216).max, \"SafeCast: value doesn't fit in 216 bits\");\n return uint216(value);\n }\n\n /**\n * @dev Returns the downcasted uint208 from uint256, reverting on\n * overflow (when the input is greater than largest uint208).\n *\n * Counterpart to Solidity's `uint208` operator.\n *\n * Requirements:\n *\n * - input must fit into 208 bits\n *\n * _Available since v4.7._\n */\n function toUint208(uint256 value) internal pure returns (uint208) {\n require(value <= type(uint208).max, \"SafeCast: value doesn't fit in 208 bits\");\n return uint208(value);\n }\n\n /**\n * @dev Returns the downcasted uint200 from uint256, reverting on\n * overflow (when the input is greater than largest uint200).\n *\n * Counterpart to Solidity's `uint200` operator.\n *\n * Requirements:\n *\n * - input must fit into 200 bits\n *\n * _Available since v4.7._\n */\n function toUint200(uint256 value) internal pure returns (uint200) {\n require(value <= type(uint200).max, \"SafeCast: value doesn't fit in 200 bits\");\n return uint200(value);\n }\n\n /**\n * @dev Returns the downcasted uint192 from uint256, reverting on\n * overflow (when the input is greater than largest uint192).\n *\n * Counterpart to Solidity's `uint192` operator.\n *\n * Requirements:\n *\n * - input must fit into 192 bits\n *\n * _Available since v4.7._\n */\n function toUint192(uint256 value) internal pure returns (uint192) {\n require(value <= type(uint192).max, \"SafeCast: value doesn't fit in 192 bits\");\n return uint192(value);\n }\n\n /**\n * @dev Returns the downcasted uint184 from uint256, reverting on\n * overflow (when the input is greater than largest uint184).\n *\n * Counterpart to Solidity's `uint184` operator.\n *\n * Requirements:\n *\n * - input must fit into 184 bits\n *\n * _Available since v4.7._\n */\n function toUint184(uint256 value) internal pure returns (uint184) {\n require(value <= type(uint184).max, \"SafeCast: value doesn't fit in 184 bits\");\n return uint184(value);\n }\n\n /**\n * @dev Returns the downcasted uint176 from uint256, reverting on\n * overflow (when the input is greater than largest uint176).\n *\n * Counterpart to Solidity's `uint176` operator.\n *\n * Requirements:\n *\n * - input must fit into 176 bits\n *\n * _Available since v4.7._\n */\n function toUint176(uint256 value) internal pure returns (uint176) {\n require(value <= type(uint176).max, \"SafeCast: value doesn't fit in 176 bits\");\n return uint176(value);\n }\n\n /**\n * @dev Returns the downcasted uint168 from uint256, reverting on\n * overflow (when the input is greater than largest uint168).\n *\n * Counterpart to Solidity's `uint168` operator.\n *\n * Requirements:\n *\n * - input must fit into 168 bits\n *\n * _Available since v4.7._\n */\n function toUint168(uint256 value) internal pure returns (uint168) {\n require(value <= type(uint168).max, \"SafeCast: value doesn't fit in 168 bits\");\n return uint168(value);\n }\n\n /**\n * @dev Returns the downcasted uint160 from uint256, reverting on\n * overflow (when the input is greater than largest uint160).\n *\n * Counterpart to Solidity's `uint160` operator.\n *\n * Requirements:\n *\n * - input must fit into 160 bits\n *\n * _Available since v4.7._\n */\n function toUint160(uint256 value) internal pure returns (uint160) {\n require(value <= type(uint160).max, \"SafeCast: value doesn't fit in 160 bits\");\n return uint160(value);\n }\n\n /**\n * @dev Returns the downcasted uint152 from uint256, reverting on\n * overflow (when the input is greater than largest uint152).\n *\n * Counterpart to Solidity's `uint152` operator.\n *\n * Requirements:\n *\n * - input must fit into 152 bits\n *\n * _Available since v4.7._\n */\n function toUint152(uint256 value) internal pure returns (uint152) {\n require(value <= type(uint152).max, \"SafeCast: value doesn't fit in 152 bits\");\n return uint152(value);\n }\n\n /**\n * @dev Returns the downcasted uint144 from uint256, reverting on\n * overflow (when the input is greater than largest uint144).\n *\n * Counterpart to Solidity's `uint144` operator.\n *\n * Requirements:\n *\n * - input must fit into 144 bits\n *\n * _Available since v4.7._\n */\n function toUint144(uint256 value) internal pure returns (uint144) {\n require(value <= type(uint144).max, \"SafeCast: value doesn't fit in 144 bits\");\n return uint144(value);\n }\n\n /**\n * @dev Returns the downcasted uint136 from uint256, reverting on\n * overflow (when the input is greater than largest uint136).\n *\n * Counterpart to Solidity's `uint136` operator.\n *\n * Requirements:\n *\n * - input must fit into 136 bits\n *\n * _Available since v4.7._\n */\n function toUint136(uint256 value) internal pure returns (uint136) {\n require(value <= type(uint136).max, \"SafeCast: value doesn't fit in 136 bits\");\n return uint136(value);\n }\n\n /**\n * @dev Returns the downcasted uint128 from uint256, reverting on\n * overflow (when the input is greater than largest uint128).\n *\n * Counterpart to Solidity's `uint128` operator.\n *\n * Requirements:\n *\n * - input must fit into 128 bits\n *\n * _Available since v2.5._\n */\n function toUint128(uint256 value) internal pure returns (uint128) {\n require(value <= type(uint128).max, \"SafeCast: value doesn't fit in 128 bits\");\n return uint128(value);\n }\n\n /**\n * @dev Returns the downcasted uint120 from uint256, reverting on\n * overflow (when the input is greater than largest uint120).\n *\n * Counterpart to Solidity's `uint120` operator.\n *\n * Requirements:\n *\n * - input must fit into 120 bits\n *\n * _Available since v4.7._\n */\n function toUint120(uint256 value) internal pure returns (uint120) {\n require(value <= type(uint120).max, \"SafeCast: value doesn't fit in 120 bits\");\n return uint120(value);\n }\n\n /**\n * @dev Returns the downcasted uint112 from uint256, reverting on\n * overflow (when the input is greater than largest uint112).\n *\n * Counterpart to Solidity's `uint112` operator.\n *\n * Requirements:\n *\n * - input must fit into 112 bits\n *\n * _Available since v4.7._\n */\n function toUint112(uint256 value) internal pure returns (uint112) {\n require(value <= type(uint112).max, \"SafeCast: value doesn't fit in 112 bits\");\n return uint112(value);\n }\n\n /**\n * @dev Returns the downcasted uint104 from uint256, reverting on\n * overflow (when the input is greater than largest uint104).\n *\n * Counterpart to Solidity's `uint104` operator.\n *\n * Requirements:\n *\n * - input must fit into 104 bits\n *\n * _Available since v4.7._\n */\n function toUint104(uint256 value) internal pure returns (uint104) {\n require(value <= type(uint104).max, \"SafeCast: value doesn't fit in 104 bits\");\n return uint104(value);\n }\n\n /**\n * @dev Returns the downcasted uint96 from uint256, reverting on\n * overflow (when the input is greater than largest uint96).\n *\n * Counterpart to Solidity's `uint96` operator.\n *\n * Requirements:\n *\n * - input must fit into 96 bits\n *\n * _Available since v4.2._\n */\n function toUint96(uint256 value) internal pure returns (uint96) {\n require(value <= type(uint96).max, \"SafeCast: value doesn't fit in 96 bits\");\n return uint96(value);\n }\n\n /**\n * @dev Returns the downcasted uint88 from uint256, reverting on\n * overflow (when the input is greater than largest uint88).\n *\n * Counterpart to Solidity's `uint88` operator.\n *\n * Requirements:\n *\n * - input must fit into 88 bits\n *\n * _Available since v4.7._\n */\n function toUint88(uint256 value) internal pure returns (uint88) {\n require(value <= type(uint88).max, \"SafeCast: value doesn't fit in 88 bits\");\n return uint88(value);\n }\n\n /**\n * @dev Returns the downcasted uint80 from uint256, reverting on\n * overflow (when the input is greater than largest uint80).\n *\n * Counterpart to Solidity's `uint80` operator.\n *\n * Requirements:\n *\n * - input must fit into 80 bits\n *\n * _Available since v4.7._\n */\n function toUint80(uint256 value) internal pure returns (uint80) {\n require(value <= type(uint80).max, \"SafeCast: value doesn't fit in 80 bits\");\n return uint80(value);\n }\n\n /**\n * @dev Returns the downcasted uint72 from uint256, reverting on\n * overflow (when the input is greater than largest uint72).\n *\n * Counterpart to Solidity's `uint72` operator.\n *\n * Requirements:\n *\n * - input must fit into 72 bits\n *\n * _Available since v4.7._\n */\n function toUint72(uint256 value) internal pure returns (uint72) {\n require(value <= type(uint72).max, \"SafeCast: value doesn't fit in 72 bits\");\n return uint72(value);\n }\n\n /**\n * @dev Returns the downcasted uint64 from uint256, reverting on\n * overflow (when the input is greater than largest uint64).\n *\n * Counterpart to Solidity's `uint64` operator.\n *\n * Requirements:\n *\n * - input must fit into 64 bits\n *\n * _Available since v2.5._\n */\n function toUint64(uint256 value) internal pure returns (uint64) {\n require(value <= type(uint64).max, \"SafeCast: value doesn't fit in 64 bits\");\n return uint64(value);\n }\n\n /**\n * @dev Returns the downcasted uint56 from uint256, reverting on\n * overflow (when the input is greater than largest uint56).\n *\n * Counterpart to Solidity's `uint56` operator.\n *\n * Requirements:\n *\n * - input must fit into 56 bits\n *\n * _Available since v4.7._\n */\n function toUint56(uint256 value) internal pure returns (uint56) {\n require(value <= type(uint56).max, \"SafeCast: value doesn't fit in 56 bits\");\n return uint56(value);\n }\n\n /**\n * @dev Returns the downcasted uint48 from uint256, reverting on\n * overflow (when the input is greater than largest uint48).\n *\n * Counterpart to Solidity's `uint48` operator.\n *\n * Requirements:\n *\n * - input must fit into 48 bits\n *\n * _Available since v4.7._\n */\n function toUint48(uint256 value) internal pure returns (uint48) {\n require(value <= type(uint48).max, \"SafeCast: value doesn't fit in 48 bits\");\n return uint48(value);\n }\n\n /**\n * @dev Returns the downcasted uint40 from uint256, reverting on\n * overflow (when the input is greater than largest uint40).\n *\n * Counterpart to Solidity's `uint40` operator.\n *\n * Requirements:\n *\n * - input must fit into 40 bits\n *\n * _Available since v4.7._\n */\n function toUint40(uint256 value) internal pure returns (uint40) {\n require(value <= type(uint40).max, \"SafeCast: value doesn't fit in 40 bits\");\n return uint40(value);\n }\n\n /**\n * @dev Returns the downcasted uint32 from uint256, reverting on\n * overflow (when the input is greater than largest uint32).\n *\n * Counterpart to Solidity's `uint32` operator.\n *\n * Requirements:\n *\n * - input must fit into 32 bits\n *\n * _Available since v2.5._\n */\n function toUint32(uint256 value) internal pure returns (uint32) {\n require(value <= type(uint32).max, \"SafeCast: value doesn't fit in 32 bits\");\n return uint32(value);\n }\n\n /**\n * @dev Returns the downcasted uint24 from uint256, reverting on\n * overflow (when the input is greater than largest uint24).\n *\n * Counterpart to Solidity's `uint24` operator.\n *\n * Requirements:\n *\n * - input must fit into 24 bits\n *\n * _Available since v4.7._\n */\n function toUint24(uint256 value) internal pure returns (uint24) {\n require(value <= type(uint24).max, \"SafeCast: value doesn't fit in 24 bits\");\n return uint24(value);\n }\n\n /**\n * @dev Returns the downcasted uint16 from uint256, reverting on\n * overflow (when the input is greater than largest uint16).\n *\n * Counterpart to Solidity's `uint16` operator.\n *\n * Requirements:\n *\n * - input must fit into 16 bits\n *\n * _Available since v2.5._\n */\n function toUint16(uint256 value) internal pure returns (uint16) {\n require(value <= type(uint16).max, \"SafeCast: value doesn't fit in 16 bits\");\n return uint16(value);\n }\n\n /**\n * @dev Returns the downcasted uint8 from uint256, reverting on\n * overflow (when the input is greater than largest uint8).\n *\n * Counterpart to Solidity's `uint8` operator.\n *\n * Requirements:\n *\n * - input must fit into 8 bits\n *\n * _Available since v2.5._\n */\n function toUint8(uint256 value) internal pure returns (uint8) {\n require(value <= type(uint8).max, \"SafeCast: value doesn't fit in 8 bits\");\n return uint8(value);\n }\n\n /**\n * @dev Converts a signed int256 into an unsigned uint256.\n *\n * Requirements:\n *\n * - input must be greater than or equal to 0.\n *\n * _Available since v3.0._\n */\n function toUint256(int256 value) internal pure returns (uint256) {\n require(value >= 0, \"SafeCast: value must be positive\");\n return uint256(value);\n }\n\n /**\n * @dev Returns the downcasted int248 from int256, reverting on\n * overflow (when the input is less than smallest int248 or\n * greater than largest int248).\n *\n * Counterpart to Solidity's `int248` operator.\n *\n * Requirements:\n *\n * - input must fit into 248 bits\n *\n * _Available since v4.7._\n */\n function toInt248(int256 value) internal pure returns (int248 downcasted) {\n downcasted = int248(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 248 bits\");\n }\n\n /**\n * @dev Returns the downcasted int240 from int256, reverting on\n * overflow (when the input is less than smallest int240 or\n * greater than largest int240).\n *\n * Counterpart to Solidity's `int240` operator.\n *\n * Requirements:\n *\n * - input must fit into 240 bits\n *\n * _Available since v4.7._\n */\n function toInt240(int256 value) internal pure returns (int240 downcasted) {\n downcasted = int240(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 240 bits\");\n }\n\n /**\n * @dev Returns the downcasted int232 from int256, reverting on\n * overflow (when the input is less than smallest int232 or\n * greater than largest int232).\n *\n * Counterpart to Solidity's `int232` operator.\n *\n * Requirements:\n *\n * - input must fit into 232 bits\n *\n * _Available since v4.7._\n */\n function toInt232(int256 value) internal pure returns (int232 downcasted) {\n downcasted = int232(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 232 bits\");\n }\n\n /**\n * @dev Returns the downcasted int224 from int256, reverting on\n * overflow (when the input is less than smallest int224 or\n * greater than largest int224).\n *\n * Counterpart to Solidity's `int224` operator.\n *\n * Requirements:\n *\n * - input must fit into 224 bits\n *\n * _Available since v4.7._\n */\n function toInt224(int256 value) internal pure returns (int224 downcasted) {\n downcasted = int224(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 224 bits\");\n }\n\n /**\n * @dev Returns the downcasted int216 from int256, reverting on\n * overflow (when the input is less than smallest int216 or\n * greater than largest int216).\n *\n * Counterpart to Solidity's `int216` operator.\n *\n * Requirements:\n *\n * - input must fit into 216 bits\n *\n * _Available since v4.7._\n */\n function toInt216(int256 value) internal pure returns (int216 downcasted) {\n downcasted = int216(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 216 bits\");\n }\n\n /**\n * @dev Returns the downcasted int208 from int256, reverting on\n * overflow (when the input is less than smallest int208 or\n * greater than largest int208).\n *\n * Counterpart to Solidity's `int208` operator.\n *\n * Requirements:\n *\n * - input must fit into 208 bits\n *\n * _Available since v4.7._\n */\n function toInt208(int256 value) internal pure returns (int208 downcasted) {\n downcasted = int208(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 208 bits\");\n }\n\n /**\n * @dev Returns the downcasted int200 from int256, reverting on\n * overflow (when the input is less than smallest int200 or\n * greater than largest int200).\n *\n * Counterpart to Solidity's `int200` operator.\n *\n * Requirements:\n *\n * - input must fit into 200 bits\n *\n * _Available since v4.7._\n */\n function toInt200(int256 value) internal pure returns (int200 downcasted) {\n downcasted = int200(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 200 bits\");\n }\n\n /**\n * @dev Returns the downcasted int192 from int256, reverting on\n * overflow (when the input is less than smallest int192 or\n * greater than largest int192).\n *\n * Counterpart to Solidity's `int192` operator.\n *\n * Requirements:\n *\n * - input must fit into 192 bits\n *\n * _Available since v4.7._\n */\n function toInt192(int256 value) internal pure returns (int192 downcasted) {\n downcasted = int192(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 192 bits\");\n }\n\n /**\n * @dev Returns the downcasted int184 from int256, reverting on\n * overflow (when the input is less than smallest int184 or\n * greater than largest int184).\n *\n * Counterpart to Solidity's `int184` operator.\n *\n * Requirements:\n *\n * - input must fit into 184 bits\n *\n * _Available since v4.7._\n */\n function toInt184(int256 value) internal pure returns (int184 downcasted) {\n downcasted = int184(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 184 bits\");\n }\n\n /**\n * @dev Returns the downcasted int176 from int256, reverting on\n * overflow (when the input is less than smallest int176 or\n * greater than largest int176).\n *\n * Counterpart to Solidity's `int176` operator.\n *\n * Requirements:\n *\n * - input must fit into 176 bits\n *\n * _Available since v4.7._\n */\n function toInt176(int256 value) internal pure returns (int176 downcasted) {\n downcasted = int176(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 176 bits\");\n }\n\n /**\n * @dev Returns the downcasted int168 from int256, reverting on\n * overflow (when the input is less than smallest int168 or\n * greater than largest int168).\n *\n * Counterpart to Solidity's `int168` operator.\n *\n * Requirements:\n *\n * - input must fit into 168 bits\n *\n * _Available since v4.7._\n */\n function toInt168(int256 value) internal pure returns (int168 downcasted) {\n downcasted = int168(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 168 bits\");\n }\n\n /**\n * @dev Returns the downcasted int160 from int256, reverting on\n * overflow (when the input is less than smallest int160 or\n * greater than largest int160).\n *\n * Counterpart to Solidity's `int160` operator.\n *\n * Requirements:\n *\n * - input must fit into 160 bits\n *\n * _Available since v4.7._\n */\n function toInt160(int256 value) internal pure returns (int160 downcasted) {\n downcasted = int160(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 160 bits\");\n }\n\n /**\n * @dev Returns the downcasted int152 from int256, reverting on\n * overflow (when the input is less than smallest int152 or\n * greater than largest int152).\n *\n * Counterpart to Solidity's `int152` operator.\n *\n * Requirements:\n *\n * - input must fit into 152 bits\n *\n * _Available since v4.7._\n */\n function toInt152(int256 value) internal pure returns (int152 downcasted) {\n downcasted = int152(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 152 bits\");\n }\n\n /**\n * @dev Returns the downcasted int144 from int256, reverting on\n * overflow (when the input is less than smallest int144 or\n * greater than largest int144).\n *\n * Counterpart to Solidity's `int144` operator.\n *\n * Requirements:\n *\n * - input must fit into 144 bits\n *\n * _Available since v4.7._\n */\n function toInt144(int256 value) internal pure returns (int144 downcasted) {\n downcasted = int144(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 144 bits\");\n }\n\n /**\n * @dev Returns the downcasted int136 from int256, reverting on\n * overflow (when the input is less than smallest int136 or\n * greater than largest int136).\n *\n * Counterpart to Solidity's `int136` operator.\n *\n * Requirements:\n *\n * - input must fit into 136 bits\n *\n * _Available since v4.7._\n */\n function toInt136(int256 value) internal pure returns (int136 downcasted) {\n downcasted = int136(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 136 bits\");\n }\n\n /**\n * @dev Returns the downcasted int128 from int256, reverting on\n * overflow (when the input is less than smallest int128 or\n * greater than largest int128).\n *\n * Counterpart to Solidity's `int128` operator.\n *\n * Requirements:\n *\n * - input must fit into 128 bits\n *\n * _Available since v3.1._\n */\n function toInt128(int256 value) internal pure returns (int128 downcasted) {\n downcasted = int128(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 128 bits\");\n }\n\n /**\n * @dev Returns the downcasted int120 from int256, reverting on\n * overflow (when the input is less than smallest int120 or\n * greater than largest int120).\n *\n * Counterpart to Solidity's `int120` operator.\n *\n * Requirements:\n *\n * - input must fit into 120 bits\n *\n * _Available since v4.7._\n */\n function toInt120(int256 value) internal pure returns (int120 downcasted) {\n downcasted = int120(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 120 bits\");\n }\n\n /**\n * @dev Returns the downcasted int112 from int256, reverting on\n * overflow (when the input is less than smallest int112 or\n * greater than largest int112).\n *\n * Counterpart to Solidity's `int112` operator.\n *\n * Requirements:\n *\n * - input must fit into 112 bits\n *\n * _Available since v4.7._\n */\n function toInt112(int256 value) internal pure returns (int112 downcasted) {\n downcasted = int112(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 112 bits\");\n }\n\n /**\n * @dev Returns the downcasted int104 from int256, reverting on\n * overflow (when the input is less than smallest int104 or\n * greater than largest int104).\n *\n * Counterpart to Solidity's `int104` operator.\n *\n * Requirements:\n *\n * - input must fit into 104 bits\n *\n * _Available since v4.7._\n */\n function toInt104(int256 value) internal pure returns (int104 downcasted) {\n downcasted = int104(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 104 bits\");\n }\n\n /**\n * @dev Returns the downcasted int96 from int256, reverting on\n * overflow (when the input is less than smallest int96 or\n * greater than largest int96).\n *\n * Counterpart to Solidity's `int96` operator.\n *\n * Requirements:\n *\n * - input must fit into 96 bits\n *\n * _Available since v4.7._\n */\n function toInt96(int256 value) internal pure returns (int96 downcasted) {\n downcasted = int96(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 96 bits\");\n }\n\n /**\n * @dev Returns the downcasted int88 from int256, reverting on\n * overflow (when the input is less than smallest int88 or\n * greater than largest int88).\n *\n * Counterpart to Solidity's `int88` operator.\n *\n * Requirements:\n *\n * - input must fit into 88 bits\n *\n * _Available since v4.7._\n */\n function toInt88(int256 value) internal pure returns (int88 downcasted) {\n downcasted = int88(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 88 bits\");\n }\n\n /**\n * @dev Returns the downcasted int80 from int256, reverting on\n * overflow (when the input is less than smallest int80 or\n * greater than largest int80).\n *\n * Counterpart to Solidity's `int80` operator.\n *\n * Requirements:\n *\n * - input must fit into 80 bits\n *\n * _Available since v4.7._\n */\n function toInt80(int256 value) internal pure returns (int80 downcasted) {\n downcasted = int80(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 80 bits\");\n }\n\n /**\n * @dev Returns the downcasted int72 from int256, reverting on\n * overflow (when the input is less than smallest int72 or\n * greater than largest int72).\n *\n * Counterpart to Solidity's `int72` operator.\n *\n * Requirements:\n *\n * - input must fit into 72 bits\n *\n * _Available since v4.7._\n */\n function toInt72(int256 value) internal pure returns (int72 downcasted) {\n downcasted = int72(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 72 bits\");\n }\n\n /**\n * @dev Returns the downcasted int64 from int256, reverting on\n * overflow (when the input is less than smallest int64 or\n * greater than largest int64).\n *\n * Counterpart to Solidity's `int64` operator.\n *\n * Requirements:\n *\n * - input must fit into 64 bits\n *\n * _Available since v3.1._\n */\n function toInt64(int256 value) internal pure returns (int64 downcasted) {\n downcasted = int64(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 64 bits\");\n }\n\n /**\n * @dev Returns the downcasted int56 from int256, reverting on\n * overflow (when the input is less than smallest int56 or\n * greater than largest int56).\n *\n * Counterpart to Solidity's `int56` operator.\n *\n * Requirements:\n *\n * - input must fit into 56 bits\n *\n * _Available since v4.7._\n */\n function toInt56(int256 value) internal pure returns (int56 downcasted) {\n downcasted = int56(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 56 bits\");\n }\n\n /**\n * @dev Returns the downcasted int48 from int256, reverting on\n * overflow (when the input is less than smallest int48 or\n * greater than largest int48).\n *\n * Counterpart to Solidity's `int48` operator.\n *\n * Requirements:\n *\n * - input must fit into 48 bits\n *\n * _Available since v4.7._\n */\n function toInt48(int256 value) internal pure returns (int48 downcasted) {\n downcasted = int48(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 48 bits\");\n }\n\n /**\n * @dev Returns the downcasted int40 from int256, reverting on\n * overflow (when the input is less than smallest int40 or\n * greater than largest int40).\n *\n * Counterpart to Solidity's `int40` operator.\n *\n * Requirements:\n *\n * - input must fit into 40 bits\n *\n * _Available since v4.7._\n */\n function toInt40(int256 value) internal pure returns (int40 downcasted) {\n downcasted = int40(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 40 bits\");\n }\n\n /**\n * @dev Returns the downcasted int32 from int256, reverting on\n * overflow (when the input is less than smallest int32 or\n * greater than largest int32).\n *\n * Counterpart to Solidity's `int32` operator.\n *\n * Requirements:\n *\n * - input must fit into 32 bits\n *\n * _Available since v3.1._\n */\n function toInt32(int256 value) internal pure returns (int32 downcasted) {\n downcasted = int32(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 32 bits\");\n }\n\n /**\n * @dev Returns the downcasted int24 from int256, reverting on\n * overflow (when the input is less than smallest int24 or\n * greater than largest int24).\n *\n * Counterpart to Solidity's `int24` operator.\n *\n * Requirements:\n *\n * - input must fit into 24 bits\n *\n * _Available since v4.7._\n */\n function toInt24(int256 value) internal pure returns (int24 downcasted) {\n downcasted = int24(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 24 bits\");\n }\n\n /**\n * @dev Returns the downcasted int16 from int256, reverting on\n * overflow (when the input is less than smallest int16 or\n * greater than largest int16).\n *\n * Counterpart to Solidity's `int16` operator.\n *\n * Requirements:\n *\n * - input must fit into 16 bits\n *\n * _Available since v3.1._\n */\n function toInt16(int256 value) internal pure returns (int16 downcasted) {\n downcasted = int16(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 16 bits\");\n }\n\n /**\n * @dev Returns the downcasted int8 from int256, reverting on\n * overflow (when the input is less than smallest int8 or\n * greater than largest int8).\n *\n * Counterpart to Solidity's `int8` operator.\n *\n * Requirements:\n *\n * - input must fit into 8 bits\n *\n * _Available since v3.1._\n */\n function toInt8(int256 value) internal pure returns (int8 downcasted) {\n downcasted = int8(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 8 bits\");\n }\n\n /**\n * @dev Converts an unsigned uint256 into a signed int256.\n *\n * Requirements:\n *\n * - input must be less than or equal to maxInt256.\n *\n * _Available since v3.0._\n */\n function toInt256(uint256 value) internal pure returns (int256) {\n // Note: Unsafe cast below is okay because `type(int256).max` is guaranteed to be positive\n require(value <= uint256(type(int256).max), \"SafeCast: value doesn't fit in an int256\");\n return int256(value);\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Strings.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./math/Math.sol\";\n\n/**\n * @dev String operations.\n */\nlibrary Strings {\n bytes16 private constant _SYMBOLS = \"0123456789abcdef\";\n uint8 private constant _ADDRESS_LENGTH = 20;\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n */\n function toString(uint256 value) internal pure returns (string memory) {\n unchecked {\n uint256 length = Math.log10(value) + 1;\n string memory buffer = new string(length);\n uint256 ptr;\n /// @solidity memory-safe-assembly\n assembly {\n ptr := add(buffer, add(32, length))\n }\n while (true) {\n ptr--;\n /// @solidity memory-safe-assembly\n assembly {\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\n }\n value /= 10;\n if (value == 0) break;\n }\n return buffer;\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n */\n function toHexString(uint256 value) internal pure returns (string memory) {\n unchecked {\n return toHexString(value, Math.log256(value) + 1);\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n */\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n bytes memory buffer = new bytes(2 * length + 2);\n buffer[0] = \"0\";\n buffer[1] = \"x\";\n for (uint256 i = 2 * length + 1; i > 1; --i) {\n buffer[i] = _SYMBOLS[value & 0xf];\n value >>= 4;\n }\n require(value == 0, \"Strings: hex length insufficient\");\n return string(buffer);\n }\n\n /**\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\n */\n function toHexString(address addr) internal pure returns (string memory) {\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\n }\n}\n" + }, + "contracts/deprecated/OldDistributor.sol": { + "content": "// SPDX-License-Identifier: BUSL-1.1\n\n/*\n * █ \n ***** ▓▓▓ \n * ▓▓▓▓▓▓▓ \n * ///. ▓▓▓▓▓▓▓▓▓▓▓▓▓ \n ***** //////// ▓▓▓▓▓▓▓ \n * ///////////// ▓▓▓ \n ▓▓ ////////////////// █ ▓▓ \n ▓▓ ▓▓ /////////////////////// ▓▓ ▓▓ \n ▓▓ ▓▓ //////////////////////////// ▓▓ ▓▓ \n ▓▓ ▓▓ /////////▓▓▓///////▓▓▓///////// ▓▓ ▓▓ \n ▓▓ ,////////////////////////////////////// ▓▓ ▓▓ \n ▓▓ ////////////////////////////////////////// ▓▓ \n ▓▓ //////////////////////▓▓▓▓///////////////////// \n ,//////////////////////////////////////////////////// \n .////////////////////////////////////////////////////////// \n .//////////////////////////██.,//////////////////////////█ \n .//////////////////////████..,./////////////////////██ \n ...////////////////███████.....,.////////////////███ \n ,.,////////////████████ ........,///////////████ \n .,.,//////█████████ ,.......///////████ \n ,..//████████ ........./████ \n ..,██████ .....,███ \n .██ ,.,█ \n \n \n \n ▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓ ▓▓▓▓▓▓▓▓▓▓ \n ▓▓▓▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓ ▓▓ ▓▓▓▓ \n ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓ ▓▓▓▓▓ \n ▓▓▓ ▓▓ ▓▓▓ ▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ \n*/\n\npragma solidity ^0.8.17;\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport \"@openzeppelin/contracts/utils/math/SafeCast.sol\";\n\nimport \"../utils/UUPSHelper.sol\";\n\nstruct MerkleTree {\n // Root of a Merkle tree which leaves are `(address user, address token, uint amount)`\n // representing an amount of tokens accumulated by `user`.\n // The Merkle tree is assumed to have only increasing amounts: that is to say if a user can claim 1,\n // then after the amount associated in the Merkle tree for this token should be x > 1\n bytes32 merkleRoot;\n // Ipfs hash of the tree data\n bytes32 ipfsHash;\n}\n\nstruct Claim {\n uint208 amount;\n uint48 timestamp;\n}\n\n/// @title OldDistributor\n/// @notice Allows LPs on AMMs with concentrated liquidity to claim the rewards that were distributed to them\n/// @author Angle Labs. Inc\ncontract OldDistributor is UUPSHelper {\n using SafeERC20 for IERC20;\n\n // ================================= VARIABLES =================================\n\n /// @notice Tree of claimable tokens through this contract\n MerkleTree public tree;\n\n /// @notice Tree that was in place in the contract before the last `tree` update\n MerkleTree public lastTree;\n\n /// @notice Token to deposit to freeze the roots update\n IERC20 public disputeToken;\n\n /// @notice `Core` contract handling access control\n ICore public core;\n\n /// @notice Address which created the dispute\n /// @dev Used to store if there is an ongoing dispute\n address public disputer;\n\n /// @notice Last time the `tree` was updated\n uint48 public lastTreeUpdate;\n\n /// @notice Time before which a change in a tree becomes effective\n uint48 public disputePeriod;\n\n /// @notice Amount to deposit to freeze the roots update\n uint256 public disputeAmount;\n\n /// @notice Mapping user -> token -> amount to track claimed amounts\n mapping(address => mapping(address => Claim)) public claimed;\n\n /// @notice Trusted EOAs to update the Merkle root\n mapping(address => uint256) public canUpdateMerkleRoot;\n\n /// @notice Whether or not to disable permissionless claiming\n mapping(address => uint256) public onlyOperatorCanClaim;\n\n /// @notice user -> operator -> authorisation to claim\n mapping(address => mapping(address => uint256)) public operators;\n\n uint256[38] private __gap;\n\n // =================================== EVENTS ==================================\n\n event Claimed(address user, address token, uint256 amount);\n event Disputed(string reason);\n event DisputePeriodUpdated(uint48 _disputePeriod);\n event DisputeTokenUpdated(address indexed _disputeToken);\n event DisputeAmountUpdated(uint256 _disputeAmount);\n event DisputeResolved(bool valid);\n event OperatorClaimingToggled(address user, bool isEnabled);\n event OperatorToggled(address user, address operator, bool isWhitelisted);\n event Recovered(address indexed token, address indexed to, uint256 amount);\n event TreeUpdated(bytes32 merkleRoot, bytes32 ipfsHash);\n event TrustedToggled(address indexed eoa, bool trust);\n\n // ================================= MODIFIERS =================================\n\n /// @notice Checks whether the `msg.sender` has the governor role or the guardian role\n modifier onlyGovernorOrGuardian() {\n if (!core.isGovernorOrGuardian(msg.sender)) revert NotGovernorOrGuardian();\n _;\n }\n\n /// @notice Checks whether the `msg.sender` is the `user` address or is a trusted address\n modifier onlyTrustedOrUser(address user) {\n if (user != msg.sender && canUpdateMerkleRoot[msg.sender] != 1 && !core.isGovernorOrGuardian(msg.sender))\n revert NotTrusted();\n _;\n }\n\n // ================================ CONSTRUCTOR ================================\n\n constructor() initializer {}\n\n function initialize(ICore _core) external initializer {\n if (address(_core) == address(0)) revert ZeroAddress();\n core = _core;\n }\n\n /// @inheritdoc UUPSUpgradeable\n function _authorizeUpgrade(address) internal view override onlyGuardianUpgrader(core) {}\n\n // =============================== MAIN FUNCTION ===============================\n\n /// @notice Claims rewards for a given set of users\n /// @dev Anyone may call this function for anyone else, funds go to destination regardless, it's just a question of\n /// who provides the proof and pays the gas: `msg.sender` is used only for addresses that require a trusted operator\n /// @param users Recipient of tokens\n /// @param tokens ERC20 claimed\n /// @param amounts Amount of tokens that will be sent to the corresponding users\n /// @param proofs Array of hashes bridging from a leaf `(hash of user | token | amount)` to the Merkle root\n function claim(\n address[] calldata users,\n address[] calldata tokens,\n uint256[] calldata amounts,\n bytes32[][] calldata proofs\n ) external {\n uint256 usersLength = users.length;\n if (\n usersLength == 0 ||\n usersLength != tokens.length ||\n usersLength != amounts.length ||\n usersLength != proofs.length\n ) revert InvalidLengths();\n\n for (uint256 i; i < usersLength; ) {\n address user = users[i];\n address token = tokens[i];\n uint256 amount = amounts[i];\n\n // Checking if only an approved operator can claim for `user`\n if (onlyOperatorCanClaim[user] == 1 && operators[user][msg.sender] == 0) revert NotWhitelisted();\n\n // Verifying proof\n bytes32 leaf = keccak256(abi.encode(user, token, amount));\n if (!_verifyProof(leaf, proofs[i])) revert InvalidProof();\n\n // Closing reentrancy gate here\n uint256 toSend = amount - claimed[user][token].amount;\n claimed[user][token] = Claim(SafeCast.toUint208(amount), uint48(block.timestamp));\n\n IERC20(token).safeTransfer(user, toSend);\n emit Claimed(user, token, toSend);\n unchecked {\n ++i;\n }\n }\n }\n\n /// @notice Returns the MerkleRoot that is currently live for the contract\n function getMerkleRoot() public view returns (bytes32) {\n if (block.timestamp - lastTreeUpdate >= disputePeriod) return tree.merkleRoot;\n else return lastTree.merkleRoot;\n }\n\n // ============================ GOVERNANCE FUNCTIONS ===========================\n\n /// @notice Adds or removes EOAs which are trusted to update the Merkle root\n function toggleTrusted(address eoa) external onlyGovernorOrGuardian {\n uint256 trustedStatus = 1 - canUpdateMerkleRoot[eoa];\n canUpdateMerkleRoot[eoa] = trustedStatus;\n emit TrustedToggled(eoa, trustedStatus == 1);\n }\n\n /// @notice Updates Merkle Tree\n function updateTree(MerkleTree calldata _tree) external {\n if (\n disputer != address(0) ||\n // A trusted address cannot update a tree right after a precedent tree update otherwise it can de facto\n // validate a tree which has not passed the dispute period\n ((canUpdateMerkleRoot[msg.sender] != 1 || block.timestamp - lastTreeUpdate < disputePeriod) &&\n !core.isGovernorOrGuardian(msg.sender))\n ) revert NotTrusted();\n MerkleTree memory _lastTree = tree;\n tree = _tree;\n lastTree = _lastTree;\n lastTreeUpdate = uint48(block.timestamp);\n emit TreeUpdated(_tree.merkleRoot, _tree.ipfsHash);\n }\n\n /// @notice Freezes the Merkle tree update until the dispute is resolved\n /// @dev Requires a deposit of `disputeToken` that'll be slashed if the dispute is not accepted\n /// @dev It is only possible to create a dispute for `disputePeriod` after each tree update\n function disputeTree(string memory reason) external {\n if (block.timestamp - lastTreeUpdate >= disputePeriod) revert InvalidDispute();\n IERC20(disputeToken).safeTransferFrom(msg.sender, address(this), disputeAmount);\n disputer = msg.sender;\n emit Disputed(reason);\n }\n\n /// @notice Resolve the ongoing dispute, if any\n /// @param valid Whether the dispute was valid\n function resolveDispute(bool valid) external onlyGovernorOrGuardian {\n if (disputer == address(0)) revert NoDispute();\n if (valid) {\n IERC20(disputeToken).safeTransfer(disputer, disputeAmount);\n // If a dispute is valid, the contract falls back to the last tree that was updated\n _revokeTree();\n } else {\n IERC20(disputeToken).safeTransfer(msg.sender, disputeAmount);\n lastTreeUpdate = uint48(block.timestamp);\n }\n disputer = address(0);\n emit DisputeResolved(valid);\n }\n\n /// @notice Allows the governor or the guardian of this contract to fallback to the last version of the tree\n /// immediately\n function revokeTree() external onlyGovernorOrGuardian {\n if (disputer != address(0)) revert UnresolvedDispute();\n _revokeTree();\n }\n\n /// @notice Toggles permissioned claiming for a given user\n function toggleOnlyOperatorCanClaim(address user) external onlyTrustedOrUser(user) {\n uint256 oldValue = onlyOperatorCanClaim[user];\n onlyOperatorCanClaim[user] = 1 - oldValue;\n emit OperatorClaimingToggled(user, oldValue == 0);\n }\n\n /// @notice Toggles whitelisting for a given user and a given operator\n function toggleOperator(address user, address operator) external onlyTrustedOrUser(user) {\n uint256 oldValue = operators[user][operator];\n operators[user][operator] = 1 - oldValue;\n emit OperatorToggled(user, operator, oldValue == 0);\n }\n\n /// @notice Recovers any ERC20 token\n function recoverERC20(address tokenAddress, address to, uint256 amountToRecover) external onlyGovernorOrGuardian {\n IERC20(tokenAddress).safeTransfer(to, amountToRecover);\n emit Recovered(tokenAddress, to, amountToRecover);\n }\n\n /// @notice Sets the dispute period before which a tree update becomes effective\n function setDisputePeriod(uint48 _disputePeriod) external onlyGovernorOrGuardian {\n if (_disputePeriod > block.timestamp) revert InvalidParam();\n disputePeriod = uint48(_disputePeriod);\n emit DisputePeriodUpdated(_disputePeriod);\n }\n\n /// @notice Sets the token used as a caution during disputes\n function setDisputeToken(IERC20 _disputeToken) external onlyGovernorOrGuardian {\n if (disputer != address(0)) revert UnresolvedDispute();\n disputeToken = _disputeToken;\n emit DisputeTokenUpdated(address(_disputeToken));\n }\n\n /// @notice Sets the amount of `disputeToken` used as a caution during disputes\n function setDisputeAmount(uint256 _disputeAmount) external onlyGovernorOrGuardian {\n if (disputer != address(0)) revert UnresolvedDispute();\n disputeAmount = _disputeAmount;\n emit DisputeAmountUpdated(_disputeAmount);\n }\n\n // ============================= INTERNAL FUNCTIONS ============================\n\n /// @notice Fallback to the last version of the tree\n function _revokeTree() internal {\n MerkleTree memory _tree = lastTree;\n lastTreeUpdate = 0;\n tree = _tree;\n emit TreeUpdated(_tree.merkleRoot, _tree.ipfsHash);\n }\n\n /// @notice Checks the validity of a proof\n /// @param leaf Hashed leaf data, the starting point of the proof\n /// @param proof Array of hashes forming a hash chain from leaf to root\n /// @return true If proof is correct, else false\n function _verifyProof(bytes32 leaf, bytes32[] memory proof) internal view returns (bool) {\n bytes32 currentHash = leaf;\n uint256 proofLength = proof.length;\n for (uint256 i; i < proofLength; ) {\n if (currentHash < proof[i]) {\n currentHash = keccak256(abi.encode(currentHash, proof[i]));\n } else {\n currentHash = keccak256(abi.encode(proof[i], currentHash));\n }\n unchecked {\n ++i;\n }\n }\n bytes32 root = getMerkleRoot();\n if (root == bytes32(0)) revert InvalidUninitializedRoot();\n return currentHash == root;\n }\n}\n" + }, + "contracts/DistributionCreator.sol": { + "content": "// SPDX-License-Identifier: BUSL-1.1\n\n/*\n * █ \n ***** ▓▓▓ \n * ▓▓▓▓▓▓▓ \n * ///. ▓▓▓▓▓▓▓▓▓▓▓▓▓ \n ***** //////// ▓▓▓▓▓▓▓ \n * ///////////// ▓▓▓ \n ▓▓ ////////////////// █ ▓▓ \n ▓▓ ▓▓ /////////////////////// ▓▓ ▓▓ \n ▓▓ ▓▓ //////////////////////////// ▓▓ ▓▓ \n ▓▓ ▓▓ /////////▓▓▓///////▓▓▓///////// ▓▓ ▓▓ \n ▓▓ ,////////////////////////////////////// ▓▓ ▓▓ \n ▓▓ ////////////////////////////////////////// ▓▓ \n ▓▓ //////////////////////▓▓▓▓///////////////////// \n ,//////////////////////////////////////////////////// \n .////////////////////////////////////////////////////////// \n .//////////////////////////██.,//////////////////////////█ \n .//////////////////////████..,./////////////////////██ \n ...////////////////███████.....,.////////////////███ \n ,.,////////////████████ ........,///////////████ \n .,.,//////█████████ ,.......///////████ \n ,..//████████ ........./████ \n ..,██████ .....,███ \n .██ ,.,█ \n \n \n \n ▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓ ▓▓▓▓▓▓▓▓▓▓ \n ▓▓▓▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓ ▓▓ ▓▓▓▓ \n ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓ ▓▓▓▓▓ \n ▓▓▓ ▓▓ ▓▓▓ ▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ \n*/\n\npragma solidity ^0.8.17;\n\nimport { ReentrancyGuardUpgradeable } from \"@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol\";\nimport { IERC20, IERC20Metadata } from \"@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol\";\nimport { SafeERC20 } from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport { ECDSA } from \"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\";\n\nimport { IUniswapV3Pool } from \"./interfaces/external/uniswap/IUniswapV3Pool.sol\";\n\nimport \"./utils/UUPSHelper.sol\";\nimport { DistributionParameters } from \"./struct/DistributionParameters.sol\";\nimport { UniswapTokenData, ExtensiveDistributionParameters } from \"./struct/ExtensiveDistributionParameters.sol\";\nimport { RewardTokenAmounts } from \"./struct/RewardTokenAmounts.sol\";\n\ninterface IDistributionCreator {\n function tryGetExtensiveDistributionParameters(\n DistributionParameters memory distribution\n ) external view returns (bool success, ExtensiveDistributionParameters memory extensiveParams);\n}\n\n/// @title DistributionCreator\n/// @author Angle Labs, Inc.\n/// @notice Manages the distribution of rewards across different pools with concentrated liquidity (like on Uniswap V3)\n/// @dev This contract is mostly a helper for APIs built on top of Merkl\n/// @dev People depositing rewards must have signed a `message` with the conditions for using the\n/// product\n//solhint-disable\ncontract DistributionCreator is UUPSHelper, ReentrancyGuardUpgradeable {\n using SafeERC20 for IERC20;\n\n // =========================== CONSTANTS / VARIABLES ===========================\n\n /// @notice Epoch duration\n uint32 public constant EPOCH_DURATION = 3600;\n\n /// @notice Base for fee computation\n uint256 public constant BASE_9 = 1e9;\n\n /// @notice `Core` contract handling access control\n ICore public core;\n\n /// @notice User contract for distributing rewards\n address public distributor;\n\n /// @notice Address to which fees are forwarded\n address public feeRecipient;\n\n /// @notice Value (in base 10**9) of the fees taken when creating a distribution for a pool which do not\n /// have a whitelisted token in it\n uint256 public fees;\n\n /// @notice Message that needs to be acknowledged by users creating a distribution\n string public message;\n\n /// @notice Hash of the message that needs to be signed\n bytes32 public messageHash;\n\n /// @notice List of all rewards ever distributed or to be distributed in the contract\n /// @dev An attacker could try to populate this list. It shouldn't be an issue as only view functions\n /// iterate on it\n DistributionParameters[] public distributionList;\n\n /// @notice Maps an address to its fee rebate\n mapping(address => uint256) public feeRebate;\n\n /// @notice Maps a token to whether it is whitelisted or not. No fees are to be paid for incentives given\n /// on pools with whitelisted tokens\n mapping(address => uint256) public isWhitelistedToken;\n\n /// @notice Maps an address to its nonce for creating a distribution\n mapping(address => uint256) public nonces;\n\n /// @notice Maps an address to the last valid hash signed\n mapping(address => bytes32) public userSignatures;\n\n /// @notice Maps a user to whether it is whitelisted for not signing\n mapping(address => uint256) public userSignatureWhitelist;\n\n /// @notice Maps a token to the minimum amount that must be sent per epoch for a distribution to be valid\n /// @dev If `rewardTokenMinAmounts[token] == 0`, then `token` cannot be used as a reward\n mapping(address => uint256) public rewardTokenMinAmounts;\n\n /// @notice List of all reward tokens that have at some point been accepted\n address[] public rewardTokens;\n\n uint256[36] private __gap;\n\n // =================================== EVENTS ==================================\n\n event DistributorUpdated(address indexed _distributor);\n event FeeRebateUpdated(address indexed user, uint256 userFeeRebate);\n event FeeRecipientUpdated(address indexed _feeRecipient);\n event FeesSet(uint256 _fees);\n event MessageUpdated(bytes32 _messageHash);\n event NewDistribution(DistributionParameters distribution, address indexed sender);\n event RewardTokenMinimumAmountUpdated(address indexed token, uint256 amount);\n event TokenWhitelistToggled(address indexed token, uint256 toggleStatus);\n event UserSigned(bytes32 messageHash, address indexed user);\n event UserSigningWhitelistToggled(address indexed user, uint256 toggleStatus);\n\n // ================================= MODIFIERS =================================\n\n /// @notice Checks whether the `msg.sender` has the governor role or the guardian role\n modifier onlyGovernorOrGuardian() {\n if (!core.isGovernorOrGuardian(msg.sender)) revert NotGovernorOrGuardian();\n _;\n }\n\n /// @notice Checks whether an address has signed the message or not\n modifier hasSigned() {\n if (\n userSignatureWhitelist[msg.sender] == 0 &&\n userSignatures[msg.sender] != messageHash &&\n userSignatureWhitelist[tx.origin] == 0 &&\n userSignatures[tx.origin] != messageHash\n ) revert NotSigned();\n _;\n }\n\n // ================================ CONSTRUCTOR ================================\n\n function initialize(ICore _core, address _distributor, uint256 _fees) external initializer {\n if (address(_core) == address(0) || _distributor == address(0)) revert ZeroAddress();\n if (_fees >= BASE_9) revert InvalidParam();\n distributor = _distributor;\n core = _core;\n fees = _fees;\n }\n\n constructor() initializer {}\n\n /// @inheritdoc UUPSUpgradeable\n function _authorizeUpgrade(address) internal view override onlyGuardianUpgrader(core) {}\n\n // ============================== DEPOSIT FUNCTION =============================\n\n /// @notice Creates a `distribution` to incentivize a given pool for a specific period of time\n /// @return distributionAmount How many reward tokens are actually taken into consideration in the contract\n /// @dev If the address specified as a UniV3 pool is not effectively a pool, it will not be handled by the\n /// distribution script and rewards may be lost\n /// @dev Reward tokens sent as part of distributions must have been whitelisted before and amounts\n /// sent should be bigger than a minimum amount specific to each token\n /// @dev The `positionWrappers` specified in the `distribution` struct need to be supported by the script\n /// List of supported `positionWrappers` can be found in the docs.\n /// @dev If the pool incentivized contains one whitelisted token, then no fees are taken on the rewards\n /// @dev This function reverts if the sender has not signed the message `messageHash` once through one of\n /// the functions enabling to sign\n function createDistribution(\n DistributionParameters memory distribution\n ) external hasSigned returns (uint256 distributionAmount) {\n return _createDistribution(distribution);\n }\n\n /// @notice Same as the function above but for multiple distributions at once\n /// @return List of all the distribution amounts actually deposited for each `distribution` in the `distributions` list\n function createDistributions(\n DistributionParameters[] memory distributions\n ) external hasSigned returns (uint256[] memory) {\n uint256 distributionsLength = distributions.length;\n uint256[] memory distributionAmounts = new uint256[](distributionsLength);\n for (uint256 i; i < distributionsLength; ) {\n distributionAmounts[i] = _createDistribution(distributions[i]);\n unchecked {\n ++i;\n }\n }\n return distributionAmounts;\n }\n\n /// @notice Checks whether the `msg.sender`'s `signature` is compatible with the message\n /// to sign and stores the signature\n /// @dev If you signed the message once, and the message has not been modified, then you do not\n /// need to sign again\n function sign(bytes calldata signature) external {\n _sign(signature);\n }\n\n /// @notice Combines signing the message and creating a distribution\n function signAndCreateDistribution(\n DistributionParameters memory distribution,\n bytes calldata signature\n ) external returns (uint256 distributionAmount) {\n _sign(signature);\n return _createDistribution(distribution);\n }\n\n /// @notice Internal version of `createDistribution`\n function _createDistribution(\n DistributionParameters memory distribution\n ) internal nonReentrant returns (uint256 distributionAmount) {\n uint32 epochStart = _getRoundedEpoch(distribution.epochStart);\n uint256 minDistributionAmount = rewardTokenMinAmounts[distribution.rewardToken];\n distribution.epochStart = epochStart;\n // Reward are not accepted in the following conditions:\n if (\n // if epoch parameters lead to a past distribution\n epochStart + EPOCH_DURATION < block.timestamp ||\n // if the amount of epochs for which this distribution should last is zero\n distribution.numEpoch == 0 ||\n // if the distribution parameters are not correctly specified\n distribution.propFees + distribution.propToken0 + distribution.propToken1 != 1e4 ||\n // if boosted addresses get less than non-boosted addresses in case of\n (distribution.boostingAddress != address(0) && distribution.boostedReward < 1e4) ||\n // if the type of the position wrappers is not well specified\n distribution.positionWrappers.length != distribution.wrapperTypes.length ||\n // if the reward token is not whitelisted as an incentive token\n minDistributionAmount == 0 ||\n // if the amount distributed is too small with respect to what is allowed\n distribution.amount / distribution.numEpoch < minDistributionAmount\n ) revert InvalidReward();\n distributionAmount = distribution.amount;\n // Computing fees: these are waived for whitelisted addresses and if there is a whitelisted token in a pool\n uint256 userFeeRebate = feeRebate[msg.sender];\n if (\n userFeeRebate < BASE_9 &&\n // Algebra pools also have these `token0` and `token1` parameters\n isWhitelistedToken[IUniswapV3Pool(distribution.uniV3Pool).token0()] == 0 &&\n isWhitelistedToken[IUniswapV3Pool(distribution.uniV3Pool).token1()] == 0\n ) {\n uint256 _fees = (fees * (BASE_9 - userFeeRebate)) / BASE_9;\n uint256 distributionAmountMinusFees = (distributionAmount * (BASE_9 - _fees)) / BASE_9;\n address _feeRecipient = feeRecipient;\n _feeRecipient = _feeRecipient == address(0) ? address(this) : _feeRecipient;\n IERC20(distribution.rewardToken).safeTransferFrom(\n msg.sender,\n _feeRecipient,\n distributionAmount - distributionAmountMinusFees\n );\n distributionAmount = distributionAmountMinusFees;\n distribution.amount = distributionAmount;\n }\n\n IERC20(distribution.rewardToken).safeTransferFrom(msg.sender, distributor, distributionAmount);\n uint256 senderNonce = nonces[msg.sender];\n nonces[msg.sender] = senderNonce + 1;\n distribution.rewardId = bytes32(keccak256(abi.encodePacked(msg.sender, senderNonce)));\n distributionList.push(distribution);\n emit NewDistribution(distribution, msg.sender);\n }\n\n /// @notice Internal version of the `sign` function\n function _sign(bytes calldata signature) internal {\n bytes32 _messageHash = messageHash;\n if (ECDSA.recover(_messageHash, signature) != msg.sender) revert InvalidSignature();\n userSignatures[msg.sender] = _messageHash;\n emit UserSigned(_messageHash, msg.sender);\n }\n\n // ================================= UI HELPERS ================================\n // These functions are not to be queried on-chain and hence are not optimized for gas consumption\n\n /// @notice Returns the list of all distributions ever made or to be done in the future\n function getAllDistributions() external view returns (DistributionParameters[] memory) {\n return distributionList;\n }\n\n /// @notice Returns the list of all currently active distributions on pools of supported AMMs (like Uniswap V3)\n function getActiveDistributions()\n external\n view\n returns (ExtensiveDistributionParameters[] memory searchDistributions)\n {\n uint32 roundedEpoch = _getRoundedEpoch(uint32(block.timestamp));\n (searchDistributions, ) = _getPoolDistributionsBetweenEpochs(\n address(0),\n roundedEpoch,\n roundedEpoch + EPOCH_DURATION,\n 0,\n type(uint32).max\n );\n }\n\n /// @notice Similar to `getActiveDistributions()` with additional parameters to prevent out of gas error\n /// @param skip Disregard distibutions with a global index lower than `skip`\n /// @param first Limit the length of the returned array to `first`\n /// @return searchDistributions Eligible distributions\n /// @return lastIndexDistribution Index of the last distribution assessed in the list of all distributions\n /// For pagniation purpose, in case of out of gas, you can call back the same function but with `skip` set to `lastIndexDistribution`\n function getActiveDistributions(\n uint32 skip,\n uint32 first\n )\n external\n view\n returns (ExtensiveDistributionParameters[] memory searchDistributions, uint256 lastIndexDistribution)\n {\n uint32 roundedEpoch = _getRoundedEpoch(uint32(block.timestamp));\n return _getPoolDistributionsBetweenEpochs(address(0), roundedEpoch, roundedEpoch + EPOCH_DURATION, skip, first);\n }\n\n /// @notice Returns the list of all the reward tokens supported as well as their minimum amounts\n function getValidRewardTokens() external view returns (RewardTokenAmounts[] memory) {\n uint256 length;\n uint256 rewardTokenListLength = rewardTokens.length;\n RewardTokenAmounts[] memory validRewardTokens = new RewardTokenAmounts[](rewardTokenListLength);\n for (uint32 i; i < rewardTokenListLength; ) {\n address token = rewardTokens[i];\n uint256 minAmount = rewardTokenMinAmounts[token];\n if (minAmount > 0) {\n validRewardTokens[length] = RewardTokenAmounts(token, minAmount);\n length += 1;\n }\n unchecked {\n ++i;\n }\n }\n assembly {\n mstore(validRewardTokens, length)\n }\n return validRewardTokens;\n }\n\n /// @notice Returns the list of all the distributions that were or that are going to be live at\n /// a specific epoch\n function getDistributionsForEpoch(\n uint32 epoch\n ) external view returns (ExtensiveDistributionParameters[] memory searchDistributions) {\n uint32 roundedEpoch = _getRoundedEpoch(epoch);\n (searchDistributions, ) = _getPoolDistributionsBetweenEpochs(\n address(0),\n roundedEpoch,\n roundedEpoch + EPOCH_DURATION,\n 0,\n type(uint32).max\n );\n }\n\n /// @notice Similar to `getDistributionsForEpoch(uint256 epoch)` with additional parameters to prevent out of gas error\n /// @param skip Disregard distibutions with a global index lower than `skip`\n /// @param first Limit the length of the returned array to `first`\n /// @return searchDistributions Eligible distributions\n /// @return lastIndexDistribution Index of the last distribution assessed in the list of all distributions\n /// For pagniation purpose, in case of out of gas, you can call back the same function but with `skip` set to `lastIndexDistribution`\n function getDistributionsForEpoch(\n uint32 epoch,\n uint32 skip,\n uint32 first\n ) external view returns (ExtensiveDistributionParameters[] memory, uint256 lastIndexDistribution) {\n uint32 roundedEpoch = _getRoundedEpoch(epoch);\n return _getPoolDistributionsBetweenEpochs(address(0), roundedEpoch, roundedEpoch + EPOCH_DURATION, skip, first);\n }\n\n /// @notice Gets the distributions that were or will be live at some point between `epochStart` (included) and `epochEnd` (excluded)\n /// @dev If a distribution starts during `epochEnd`, it is not be returned by this function\n /// @dev Conversely, if a distribution starts after `epochStart` and ends before `epochEnd`, it is returned by this function\n function getDistributionsBetweenEpochs(\n uint32 epochStart,\n uint32 epochEnd\n ) external view returns (ExtensiveDistributionParameters[] memory searchDistributions) {\n (searchDistributions, ) = _getPoolDistributionsBetweenEpochs(\n address(0),\n _getRoundedEpoch(epochStart),\n _getRoundedEpoch(epochEnd),\n 0,\n type(uint32).max\n );\n }\n\n /// @notice Similar to `getDistributionsBetweenEpochs(uint256 epochStart, uint256 epochEnd)` with additional parameters to prevent out of gas error\n /// @param skip Disregard distibutions with a global index lower than `skip`\n /// @param first Limit the length of the returned array to `first`\n /// @return searchDistributions Eligible distributions\n /// @return lastIndexDistribution Index of the last distribution assessed in the list of all distributions\n /// For pagniation purpose, in case of out of gas, you can call back the same function but with `skip` set to `lastIndexDistribution`\n function getDistributionsBetweenEpochs(\n uint32 epochStart,\n uint32 epochEnd,\n uint32 skip,\n uint32 first\n ) external view returns (ExtensiveDistributionParameters[] memory, uint256 lastIndexDistribution) {\n return\n _getPoolDistributionsBetweenEpochs(\n address(0),\n _getRoundedEpoch(epochStart),\n _getRoundedEpoch(epochEnd),\n skip,\n first\n );\n }\n\n /// @notice Returns the list of all distributions that were or will be live after `epochStart` (included)\n function getDistributionsAfterEpoch(\n uint32 epochStart\n ) external view returns (ExtensiveDistributionParameters[] memory searchDistributions) {\n (searchDistributions, ) = _getPoolDistributionsBetweenEpochs(\n address(0),\n _getRoundedEpoch(epochStart),\n type(uint32).max,\n 0,\n type(uint32).max\n );\n }\n\n /// @notice Similar to `getDistributionsAfterEpoch(uint256 epochStart)` with additional parameters to prevent out of gas error\n /// @param skip Disregard distibutions with a global index lower than `skip`\n /// @param first Limit the length of the returned array to `first`\n /// @return searchDistributions Eligible distributions\n /// @return lastIndexDistribution Index of the last distribution assessed in the list of all distributions\n /// For pagniation purpose, in case of out of gas, you can call back the same function but with `skip` set to `lastIndexDistribution`\n function getDistributionsAfterEpoch(\n uint32 epochStart,\n uint32 skip,\n uint32 first\n ) external view returns (ExtensiveDistributionParameters[] memory, uint256 lastIndexDistribution) {\n return\n _getPoolDistributionsBetweenEpochs(address(0), _getRoundedEpoch(epochStart), type(uint32).max, skip, first);\n }\n\n /// @notice Returns the list of all currently active distributions for a specific UniswapV3 pool\n function getActivePoolDistributions(\n address uniV3Pool\n ) external view returns (ExtensiveDistributionParameters[] memory searchDistributions) {\n uint32 roundedEpoch = _getRoundedEpoch(uint32(block.timestamp));\n (searchDistributions, ) = _getPoolDistributionsBetweenEpochs(\n uniV3Pool,\n roundedEpoch,\n roundedEpoch + EPOCH_DURATION,\n 0,\n type(uint32).max\n );\n }\n\n /// @notice Similar to `getActivePoolDistributions(address uniV3Pool)` with additional parameters to prevent out of gas error\n /// @param skip Disregard distibutions with a global index lower than `skip`\n /// @param first Limit the length of the returned array to `first`\n /// @return searchDistributions Eligible distributions\n /// @return lastIndexDistribution Index of the last distribution assessed in the list of all distributions\n /// For pagniation purpose, in case of out of gas, you can call back the same function but with `skip` set to `lastIndexDistribution`\n function getActivePoolDistributions(\n address uniV3Pool,\n uint32 skip,\n uint32 first\n ) external view returns (ExtensiveDistributionParameters[] memory, uint256 lastIndexDistribution) {\n uint32 roundedEpoch = _getRoundedEpoch(uint32(block.timestamp));\n return _getPoolDistributionsBetweenEpochs(uniV3Pool, roundedEpoch, roundedEpoch + EPOCH_DURATION, skip, first);\n }\n\n /// @notice Returns the list of all the distributions that were or that are going to be live at a\n /// specific epoch and for a specific pool\n function getPoolDistributionsForEpoch(\n address uniV3Pool,\n uint32 epoch\n ) external view returns (ExtensiveDistributionParameters[] memory searchDistributions) {\n uint32 roundedEpoch = _getRoundedEpoch(epoch);\n (searchDistributions, ) = _getPoolDistributionsBetweenEpochs(\n uniV3Pool,\n roundedEpoch,\n roundedEpoch + EPOCH_DURATION,\n 0,\n type(uint32).max\n );\n }\n\n /// @notice Similar to `getPoolDistributionsForEpoch(address uniV3Pool,uint32 epoch)` with additional parameters to prevent out of gas error\n /// @param skip Disregard distibutions with a global index lower than `skip`\n /// @param first Limit the length of the returned array to `first`\n /// @return searchDistributions Eligible distributions\n /// @return lastIndexDistribution Index of the last distribution assessed in the list of all distributions\n /// For pagniation purpose, in case of out of gas, you can call back the same function but with `skip` set to `lastIndexDistribution`\n function getPoolDistributionsForEpoch(\n address uniV3Pool,\n uint32 epoch,\n uint32 skip,\n uint32 first\n ) external view returns (ExtensiveDistributionParameters[] memory, uint256 lastIndexDistribution) {\n uint32 roundedEpoch = _getRoundedEpoch(epoch);\n return _getPoolDistributionsBetweenEpochs(uniV3Pool, roundedEpoch, roundedEpoch + EPOCH_DURATION, skip, first);\n }\n\n /// @notice Returns the list of all distributions that were or will be live at some point between\n /// `epochStart` (included) and `epochEnd` (excluded) for a specific pool\n function getPoolDistributionsBetweenEpochs(\n address uniV3Pool,\n uint32 epochStart,\n uint32 epochEnd\n ) external view returns (ExtensiveDistributionParameters[] memory searchDistributions) {\n (searchDistributions, ) = _getPoolDistributionsBetweenEpochs(\n uniV3Pool,\n _getRoundedEpoch(epochStart),\n _getRoundedEpoch(epochEnd),\n 0,\n type(uint32).max\n );\n }\n\n /// @notice Similar to `getPoolDistributionsBetweenEpochs(address uniV3Pool,uint32 epochStart, uint32 epochEnd)` with additional parameters to prevent out of gas error\n /// @param skip Disregard distibutions with a global index lower than `skip`\n /// @param first Limit the length of the returned array to `first`\n /// @return searchDistributions Eligible distributions\n /// @return lastIndexDistribution Index of the last distribution assessed in the list of all distributions\n /// For pagniation purpose, in case of out of gas, you can call back the same function but with `skip` set to `lastIndexDistribution`\n function getPoolDistributionsBetweenEpochs(\n address uniV3Pool,\n uint32 epochStart,\n uint32 epochEnd,\n uint32 skip,\n uint32 first\n ) external view returns (ExtensiveDistributionParameters[] memory, uint256 lastIndexDistribution) {\n return\n _getPoolDistributionsBetweenEpochs(\n uniV3Pool,\n _getRoundedEpoch(epochStart),\n _getRoundedEpoch(epochEnd),\n skip,\n first\n );\n }\n\n /// @notice Returns the list of all distributions that were or will be live after `epochStart` (included)\n /// for a specific pool\n function getPoolDistributionsAfterEpoch(\n address uniV3Pool,\n uint32 epochStart\n ) external view returns (ExtensiveDistributionParameters[] memory searchDistributions) {\n (searchDistributions, ) = _getPoolDistributionsBetweenEpochs(\n uniV3Pool,\n _getRoundedEpoch(epochStart),\n type(uint32).max,\n 0,\n type(uint32).max\n );\n }\n\n /// @notice Similar to `getPoolDistributionsAfterEpoch(address uniV3Pool,uint32 epochStart)` with additional parameters to prevent out of gas error\n /// @param skip Disregard distibutions with a global index lower than `skip`\n /// @param first Limit the length of the returned array to `first`\n /// @return searchDistributions Eligible distributions\n /// @return lastIndexDistribution Index of the last distribution assessed in the list of all distributions\n /// For pagniation purpose, in case of out of gas, you can call back the same function but with `skip` set to `lastIndexDistribution`\n function getPoolDistributionsAfterEpoch(\n address uniV3Pool,\n uint32 epochStart,\n uint32 skip,\n uint32 first\n ) external view returns (ExtensiveDistributionParameters[] memory, uint256 lastIndexDistribution) {\n return\n _getPoolDistributionsBetweenEpochs(uniV3Pool, _getRoundedEpoch(epochStart), type(uint32).max, skip, first);\n }\n\n // ============================ GOVERNANCE FUNCTIONS ===========================\n\n /// @notice Sets a new `distributor` to which rewards should be distributed\n function setNewDistributor(address _distributor) external onlyGovernorOrGuardian {\n if (_distributor == address(0)) revert InvalidParam();\n distributor = _distributor;\n emit DistributorUpdated(_distributor);\n }\n\n /// @notice Sets the fees on deposit\n function setFees(uint256 _fees) external onlyGovernorOrGuardian {\n if (_fees >= BASE_9) revert InvalidParam();\n fees = _fees;\n emit FeesSet(_fees);\n }\n\n /// @notice Sets fee rebates for a given user\n function setUserFeeRebate(address user, uint256 userFeeRebate) external onlyGovernorOrGuardian {\n feeRebate[user] = userFeeRebate;\n emit FeeRebateUpdated(user, userFeeRebate);\n }\n\n /// @notice Toggles the fee whitelist for `token`\n function toggleTokenWhitelist(address token) external onlyGovernorOrGuardian {\n uint256 toggleStatus = 1 - isWhitelistedToken[token];\n isWhitelistedToken[token] = toggleStatus;\n emit TokenWhitelistToggled(token, toggleStatus);\n }\n\n /// @notice Recovers fees accrued on the contract for a list of `tokens`\n function recoverFees(IERC20[] calldata tokens, address to) external onlyGovernorOrGuardian {\n uint256 tokensLength = tokens.length;\n for (uint256 i; i < tokensLength; ) {\n tokens[i].safeTransfer(to, tokens[i].balanceOf(address(this)));\n unchecked {\n ++i;\n }\n }\n }\n\n /// @notice Sets the minimum amounts per distribution epoch for different reward tokens\n function setRewardTokenMinAmounts(\n address[] calldata tokens,\n uint256[] calldata amounts\n ) external onlyGovernorOrGuardian {\n uint256 tokensLength = tokens.length;\n if (tokensLength != amounts.length) revert InvalidLengths();\n for (uint256 i; i < tokensLength; ++i) {\n uint256 amount = amounts[i];\n // Basic logic check to make sure there are no duplicates in the `rewardTokens` table. If a token is\n // removed then re-added, it will appear as a duplicate in the list\n if (amount > 0 && rewardTokenMinAmounts[tokens[i]] == 0) rewardTokens.push(tokens[i]);\n rewardTokenMinAmounts[tokens[i]] = amount;\n emit RewardTokenMinimumAmountUpdated(tokens[i], amount);\n }\n }\n\n /// @notice Sets a new address to receive fees\n function setFeeRecipient(address _feeRecipient) external onlyGovernorOrGuardian {\n feeRecipient = _feeRecipient;\n emit FeeRecipientUpdated(_feeRecipient);\n }\n\n /// @notice Sets the message that needs to be signed by users before posting rewards\n function setMessage(string memory _message) external onlyGovernorOrGuardian {\n message = _message;\n bytes32 _messageHash = ECDSA.toEthSignedMessageHash(bytes(_message));\n messageHash = _messageHash;\n emit MessageUpdated(_messageHash);\n }\n\n /// @notice Toggles the whitelist status for `user` when it comes to signing messages before depositing rewards.\n function toggleSigningWhitelist(address user) external onlyGovernorOrGuardian {\n uint256 whitelistStatus = 1 - userSignatureWhitelist[user];\n userSignatureWhitelist[user] = whitelistStatus;\n emit UserSigningWhitelistToggled(user, whitelistStatus);\n }\n\n // ============================== INTERNAL HELPERS =============================\n\n /// @notice Rounds an `epoch` timestamp to the start of the corresponding period\n function _getRoundedEpoch(uint32 epoch) internal pure returns (uint32) {\n return (epoch / EPOCH_DURATION) * EPOCH_DURATION;\n }\n\n /// @notice Checks whether `distribution` was live between `roundedEpochStart` and `roundedEpochEnd`\n function _isDistributionLiveBetweenEpochs(\n DistributionParameters memory distribution,\n uint32 roundedEpochStart,\n uint32 roundedEpochEnd\n ) internal pure returns (bool) {\n uint256 distributionEpochStart = distribution.epochStart;\n return (distributionEpochStart + distribution.numEpoch * EPOCH_DURATION > roundedEpochStart &&\n distributionEpochStart < roundedEpochEnd);\n }\n\n /// @notice Fetches data for `token` on the Uniswap `pool`\n function _getUniswapTokenData(\n IERC20Metadata token,\n address pool\n ) internal view returns (UniswapTokenData memory data) {\n data.add = address(token);\n data.decimals = token.decimals();\n data.symbol = token.symbol();\n data.poolBalance = token.balanceOf(pool);\n }\n\n /// @notice Fetches extra data about the parameters in a distribution\n function getExtensiveDistributionParameters(\n DistributionParameters memory distribution\n ) external view returns (ExtensiveDistributionParameters memory extensiveParams) {\n extensiveParams.base = distribution;\n try IUniswapV3Pool(distribution.uniV3Pool).fee() returns (uint24 fee) {\n extensiveParams.poolFee = fee;\n } catch {\n extensiveParams.poolFee = 0;\n }\n extensiveParams.token0 = _getUniswapTokenData(\n IERC20Metadata(IUniswapV3Pool(distribution.uniV3Pool).token0()),\n distribution.uniV3Pool\n );\n extensiveParams.token1 = _getUniswapTokenData(\n IERC20Metadata(IUniswapV3Pool(distribution.uniV3Pool).token1()),\n distribution.uniV3Pool\n );\n extensiveParams.rewardTokenSymbol = IERC20Metadata(distribution.rewardToken).symbol();\n extensiveParams.rewardTokenDecimals = IERC20Metadata(distribution.rewardToken).decimals();\n }\n\n /// @notice Tries to fetch extra data about the parameters in a distribution\n function tryGetExtensiveDistributionParameters(\n DistributionParameters memory distribution\n ) external returns (bool success, ExtensiveDistributionParameters memory extensiveParams) {\n (bool callSuccess, bytes memory returndata) = address(this).delegatecall(\n abi.encodeWithSelector(DistributionCreator.getExtensiveDistributionParameters.selector, distribution)\n );\n success = callSuccess;\n if (success) {\n extensiveParams = abi.decode(returndata, (ExtensiveDistributionParameters));\n }\n return (success, extensiveParams);\n }\n\n /// @notice Gets the list of all the distributions for `uniV3Pool` that have been active between `epochStart` and `epochEnd` (excluded)\n /// @dev If the `uniV3Pool` parameter is equal to 0, then this function will return the distributions for all pools\n function _getPoolDistributionsBetweenEpochs(\n address uniV3Pool,\n uint32 epochStart,\n uint32 epochEnd,\n uint32 skip,\n uint32 first\n ) internal view returns (ExtensiveDistributionParameters[] memory, uint256) {\n uint256 length;\n uint256 distributionListLength = distributionList.length;\n uint256 returnSize = first > distributionListLength ? distributionListLength : first;\n ExtensiveDistributionParameters[] memory activeRewards = new ExtensiveDistributionParameters[](returnSize);\n uint32 i = skip;\n while (i < distributionListLength) {\n DistributionParameters memory distribution = distributionList[i];\n if (\n _isDistributionLiveBetweenEpochs(distribution, epochStart, epochEnd) &&\n (uniV3Pool == address(0) || distribution.uniV3Pool == uniV3Pool)\n ) {\n (bool success, ExtensiveDistributionParameters memory extensiveParams) = IDistributionCreator(\n address(this)\n ).tryGetExtensiveDistributionParameters(distribution);\n if (success) {\n activeRewards[length] = extensiveParams;\n length += 1;\n }\n }\n unchecked {\n ++i;\n }\n if (length == returnSize) break;\n }\n assembly {\n mstore(activeRewards, length)\n }\n return (activeRewards, i);\n }\n}\n" + }, + "contracts/Distributor.sol": { + "content": "// SPDX-License-Identifier: BUSL-1.1\n\n/*\n * █ \n ***** ▓▓▓ \n * ▓▓▓▓▓▓▓ \n * ///. ▓▓▓▓▓▓▓▓▓▓▓▓▓ \n ***** //////// ▓▓▓▓▓▓▓ \n * ///////////// ▓▓▓ \n ▓▓ ////////////////// █ ▓▓ \n ▓▓ ▓▓ /////////////////////// ▓▓ ▓▓ \n ▓▓ ▓▓ //////////////////////////// ▓▓ ▓▓ \n ▓▓ ▓▓ /////////▓▓▓///////▓▓▓///////// ▓▓ ▓▓ \n ▓▓ ,////////////////////////////////////// ▓▓ ▓▓ \n ▓▓ ////////////////////////////////////////// ▓▓ \n ▓▓ //////////////////////▓▓▓▓///////////////////// \n ,//////////////////////////////////////////////////// \n .////////////////////////////////////////////////////////// \n .//////////////////////////██.,//////////////////////////█ \n .//////////////////////████..,./////////////////////██ \n ...////////////////███████.....,.////////////////███ \n ,.,////////////████████ ........,///////////████ \n .,.,//////█████████ ,.......///////████ \n ,..//████████ ........./████ \n ..,██████ .....,███ \n .██ ,.,█ \n \n \n \n ▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓ ▓▓▓▓▓▓▓▓▓▓ \n ▓▓▓▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓ ▓▓ ▓▓▓▓ \n ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓ ▓▓▓▓▓ \n ▓▓▓ ▓▓ ▓▓▓ ▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ \n*/\n\npragma solidity ^0.8.17;\n\nimport { IERC20 } from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport { SafeERC20 } from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport { SafeCast } from \"@openzeppelin/contracts/utils/math/SafeCast.sol\";\n\nimport \"./utils/UUPSHelper.sol\";\n\nstruct MerkleTree {\n // Root of a Merkle tree which leaves are `(address user, address token, uint amount)`\n // representing an amount of tokens accumulated by `user`.\n // The Merkle tree is assumed to have only increasing amounts: that is to say if a user can claim 1,\n // then after the amount associated in the Merkle tree for this token should be x > 1\n bytes32 merkleRoot;\n // Ipfs hash of the tree data\n bytes32 ipfsHash;\n}\n\nstruct Claim {\n uint208 amount;\n uint48 timestamp;\n bytes32 merkleRoot;\n}\n\n/// @title Distributor\n/// @notice Allows LPs on AMMs with concentrated liquidity to claim the rewards that were distributed to them\n/// @author Angle Labs. Inc\ncontract Distributor is UUPSHelper {\n using SafeERC20 for IERC20;\n\n /// @notice Epoch duration\n uint32 internal constant _EPOCH_DURATION = 3600;\n\n // ================================= VARIABLES =================================\n\n /// @notice Tree of claimable tokens through this contract\n MerkleTree public tree;\n\n /// @notice Tree that was in place in the contract before the last `tree` update\n MerkleTree public lastTree;\n\n /// @notice Token to deposit to freeze the roots update\n IERC20 public disputeToken;\n\n /// @notice `Core` contract handling access control\n ICore public core;\n\n /// @notice Address which created the dispute\n /// @dev Used to store if there is an ongoing dispute\n address public disputer;\n\n /// @notice When the current tree will become valid\n uint48 public endOfDisputePeriod;\n\n /// @notice Time after which a change in a tree becomes effective, in EPOCH_DURATION\n uint48 public disputePeriod;\n\n /// @notice Amount to deposit to freeze the roots update\n uint256 public disputeAmount;\n\n /// @notice Mapping user -> token -> amount to track claimed amounts\n mapping(address => mapping(address => Claim)) public claimed;\n\n /// @notice Trusted EOAs to update the Merkle root\n mapping(address => uint256) public canUpdateMerkleRoot;\n\n /// @notice Whether or not to disable permissionless claiming\n mapping(address => uint256) public onlyOperatorCanClaim;\n\n /// @notice user -> operator -> authorisation to claim\n mapping(address => mapping(address => uint256)) public operators;\n\n uint256[38] private __gap;\n\n // =================================== EVENTS ==================================\n\n event Claimed(address indexed user, address indexed token, uint256 amount);\n event DisputeAmountUpdated(uint256 _disputeAmount);\n event Disputed(string reason);\n event DisputePeriodUpdated(uint48 _disputePeriod);\n event DisputeResolved(bool valid);\n event DisputeTokenUpdated(address indexed _disputeToken);\n event OperatorClaimingToggled(address indexed user, bool isEnabled);\n event OperatorToggled(address indexed user, address indexed operator, bool isWhitelisted);\n event Recovered(address indexed token, address indexed to, uint256 amount);\n event Revoked(); // With this event an indexer could maintain a table (timestamp, merkleRootUpdate)\n event TreeUpdated(bytes32 merkleRoot, bytes32 ipfsHash, uint48 endOfDisputePeriod);\n event TrustedToggled(address indexed eoa, bool trust);\n\n // ================================= MODIFIERS =================================\n\n /// @notice Checks whether the `msg.sender` has the governor role or the guardian role\n modifier onlyGovernorOrGuardian() {\n if (!core.isGovernorOrGuardian(msg.sender)) revert NotGovernorOrGuardian();\n _;\n }\n\n /// @notice Checks whether the `msg.sender` is the `user` address or is a trusted address\n modifier onlyTrustedOrUser(address user) {\n if (user != msg.sender && canUpdateMerkleRoot[msg.sender] != 1 && !core.isGovernorOrGuardian(msg.sender))\n revert NotTrusted();\n _;\n }\n\n // ================================ CONSTRUCTOR ================================\n\n constructor() initializer {}\n\n function initialize(ICore _core) external initializer {\n if (address(_core) == address(0)) revert ZeroAddress();\n core = _core;\n }\n\n /// @inheritdoc UUPSUpgradeable\n function _authorizeUpgrade(address) internal view override onlyGuardianUpgrader(core) {}\n\n // =============================== MAIN FUNCTION ===============================\n\n /// @notice Claims rewards for a given set of users\n /// @dev Anyone may call this function for anyone else, funds go to destination regardless, it's just a question of\n /// who provides the proof and pays the gas: `msg.sender` is used only for addresses that require a trusted operator\n /// @param users Recipient of tokens\n /// @param tokens ERC20 claimed\n /// @param amounts Amount of tokens that will be sent to the corresponding users\n /// @param proofs Array of hashes bridging from a leaf `(hash of user | token | amount)` to the Merkle root\n function claim(\n address[] calldata users,\n address[] calldata tokens,\n uint256[] calldata amounts,\n bytes32[][] calldata proofs\n ) external {\n uint256 usersLength = users.length;\n if (\n usersLength == 0 ||\n usersLength != tokens.length ||\n usersLength != amounts.length ||\n usersLength != proofs.length\n ) revert InvalidLengths();\n\n for (uint256 i; i < usersLength; ) {\n address user = users[i];\n address token = tokens[i];\n uint256 amount = amounts[i];\n\n // Checking if only an approved operator can claim for `user`\n if (onlyOperatorCanClaim[user] == 1 && operators[user][msg.sender] == 0) revert NotWhitelisted();\n\n // Verifying proof\n bytes32 leaf = keccak256(abi.encode(user, token, amount));\n if (!_verifyProof(leaf, proofs[i])) revert InvalidProof();\n\n // Closing reentrancy gate here\n uint256 toSend = amount - claimed[user][token].amount;\n claimed[user][token] = Claim(SafeCast.toUint208(amount), uint48(block.timestamp), getMerkleRoot());\n\n IERC20(token).safeTransfer(user, toSend);\n emit Claimed(user, token, toSend);\n unchecked {\n ++i;\n }\n }\n }\n\n /// @notice Returns the MerkleRoot that is currently live for the contract\n function getMerkleRoot() public view returns (bytes32) {\n if (block.timestamp >= endOfDisputePeriod && disputer == address(0)) return tree.merkleRoot;\n else return lastTree.merkleRoot;\n }\n\n // ============================ GOVERNANCE FUNCTIONS ===========================\n\n /// @notice Adds or removes EOAs which are trusted to update the Merkle root\n function toggleTrusted(address eoa) external onlyGovernorOrGuardian {\n uint256 trustedStatus = 1 - canUpdateMerkleRoot[eoa];\n canUpdateMerkleRoot[eoa] = trustedStatus;\n emit TrustedToggled(eoa, trustedStatus == 1);\n }\n\n /// @notice Updates Merkle Tree\n function updateTree(MerkleTree calldata _tree) external {\n if (\n disputer != address(0) ||\n // A trusted address cannot update a tree right after a precedent tree update otherwise it can de facto\n // validate a tree which has not passed the dispute period\n ((canUpdateMerkleRoot[msg.sender] != 1 || block.timestamp < endOfDisputePeriod) &&\n !core.isGovernorOrGuardian(msg.sender))\n ) revert NotTrusted();\n MerkleTree memory _lastTree = tree;\n tree = _tree;\n lastTree = _lastTree;\n\n uint48 _endOfPeriod = _endOfDisputePeriod(uint48(block.timestamp));\n endOfDisputePeriod = _endOfPeriod;\n emit TreeUpdated(_tree.merkleRoot, _tree.ipfsHash, _endOfPeriod);\n }\n\n /// @notice Freezes the Merkle tree update until the dispute is resolved\n /// @dev Requires a deposit of `disputeToken` that'll be slashed if the dispute is not accepted\n /// @dev It is only possible to create a dispute within `disputePeriod` after each tree update\n function disputeTree(string memory reason) external {\n if (disputer != address(0)) revert UnresolvedDispute();\n if (block.timestamp >= endOfDisputePeriod) revert InvalidDispute();\n IERC20(disputeToken).safeTransferFrom(msg.sender, address(this), disputeAmount);\n disputer = msg.sender;\n emit Disputed(reason);\n }\n\n /// @notice Resolve the ongoing dispute, if any\n /// @param valid Whether the dispute was valid\n function resolveDispute(bool valid) external onlyGovernorOrGuardian {\n if (disputer == address(0)) revert NoDispute();\n if (valid) {\n IERC20(disputeToken).safeTransfer(disputer, disputeAmount);\n // If a dispute is valid, the contract falls back to the last tree that was updated\n _revokeTree();\n } else {\n IERC20(disputeToken).safeTransfer(msg.sender, disputeAmount);\n endOfDisputePeriod = _endOfDisputePeriod(uint48(block.timestamp));\n }\n disputer = address(0);\n emit DisputeResolved(valid);\n }\n\n /// @notice Allows the governor or the guardian of this contract to fallback to the last version of the tree\n /// immediately\n function revokeTree() external onlyGovernorOrGuardian {\n if (disputer != address(0)) revert UnresolvedDispute();\n _revokeTree();\n }\n\n /// @notice Toggles permissioned claiming for a given user\n function toggleOnlyOperatorCanClaim(address user) external onlyTrustedOrUser(user) {\n uint256 oldValue = onlyOperatorCanClaim[user];\n onlyOperatorCanClaim[user] = 1 - oldValue;\n emit OperatorClaimingToggled(user, oldValue == 0);\n }\n\n /// @notice Toggles whitelisting for a given user and a given operator\n function toggleOperator(address user, address operator) external onlyTrustedOrUser(user) {\n uint256 oldValue = operators[user][operator];\n operators[user][operator] = 1 - oldValue;\n emit OperatorToggled(user, operator, oldValue == 0);\n }\n\n /// @notice Recovers any ERC20 token\n function recoverERC20(address tokenAddress, address to, uint256 amountToRecover) external onlyGovernorOrGuardian {\n IERC20(tokenAddress).safeTransfer(to, amountToRecover);\n emit Recovered(tokenAddress, to, amountToRecover);\n }\n\n /// @notice Sets the dispute period after which a tree update becomes effective\n function setDisputePeriod(uint48 _disputePeriod) external onlyGovernorOrGuardian {\n disputePeriod = uint48(_disputePeriod);\n emit DisputePeriodUpdated(_disputePeriod);\n }\n\n /// @notice Sets the token used as a caution during disputes\n function setDisputeToken(IERC20 _disputeToken) external onlyGovernorOrGuardian {\n if (disputer != address(0)) revert UnresolvedDispute();\n disputeToken = _disputeToken;\n emit DisputeTokenUpdated(address(_disputeToken));\n }\n\n /// @notice Sets the amount of `disputeToken` used as a caution during disputes\n function setDisputeAmount(uint256 _disputeAmount) external onlyGovernorOrGuardian {\n if (disputer != address(0)) revert UnresolvedDispute();\n disputeAmount = _disputeAmount;\n emit DisputeAmountUpdated(_disputeAmount);\n }\n\n // ============================= INTERNAL FUNCTIONS ============================\n\n /// @notice Fallback to the last version of the tree\n function _revokeTree() internal {\n MerkleTree memory _tree = lastTree;\n endOfDisputePeriod = 0;\n tree = _tree;\n emit Revoked();\n emit TreeUpdated(\n _tree.merkleRoot,\n _tree.ipfsHash,\n (uint48(block.timestamp) / _EPOCH_DURATION) * (_EPOCH_DURATION) // Last hour\n );\n }\n\n /// @notice Returns the end of the dispute period\n /// @dev treeUpdate is rounded up to next hour and then `disputePeriod` hours are added\n function _endOfDisputePeriod(uint48 treeUpdate) internal view returns (uint48) {\n return ((treeUpdate - 1) / _EPOCH_DURATION + 1 + disputePeriod) * (_EPOCH_DURATION);\n }\n\n /// @notice Checks the validity of a proof\n /// @param leaf Hashed leaf data, the starting point of the proof\n /// @param proof Array of hashes forming a hash chain from leaf to root\n /// @return true If proof is correct, else false\n function _verifyProof(bytes32 leaf, bytes32[] memory proof) internal view returns (bool) {\n bytes32 currentHash = leaf;\n uint256 proofLength = proof.length;\n for (uint256 i; i < proofLength; ) {\n if (currentHash < proof[i]) {\n currentHash = keccak256(abi.encode(currentHash, proof[i]));\n } else {\n currentHash = keccak256(abi.encode(proof[i], currentHash));\n }\n unchecked {\n ++i;\n }\n }\n bytes32 root = getMerkleRoot();\n if (root == bytes32(0)) revert InvalidUninitializedRoot();\n return currentHash == root;\n }\n}\n" + }, + "contracts/interfaces/external/uniswap/IUniswapV3Pool.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity >=0.5.0;\n\n/// @title Pool state that never changes\n/// @notice These parameters are fixed for a pool forever, i.e., the methods will always return the same values\ninterface IUniswapV3Pool {\n /// @notice The first of the two tokens of the pool, sorted by address\n /// @return The token contract address\n function token0() external view returns (address);\n\n /// @notice The second of the two tokens of the pool, sorted by address\n /// @return The token contract address\n function token1() external view returns (address);\n\n /// @notice The pool's fee in hundredths of a bip, i.e. 1e-6\n /// @return The fee\n function fee() external view returns (uint24);\n}\n" + }, + "contracts/interfaces/IAgToken.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport { IERC20Upgradeable } from \"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\";\n\n/// @title IAgToken\n/// @author Angle Core Team\n/// @notice Interface for the stablecoins `AgToken` contracts\n/// @dev This interface only contains functions of the `AgToken` contract which are called by other contracts\n/// of this module or of the first module of the Angle Protocol\ninterface IAgToken is IERC20Upgradeable {\n // ======================= Minter Role Only Functions ===========================\n\n /// @notice Lets the `StableMaster` contract or another whitelisted contract mint agTokens\n /// @param account Address to mint to\n /// @param amount Amount to mint\n /// @dev The contracts allowed to issue agTokens are the `StableMaster` contract, `VaultManager` contracts\n /// associated to this stablecoin as well as the flash loan module (if activated) and potentially contracts\n /// whitelisted by governance\n function mint(address account, uint256 amount) external;\n\n /// @notice Burns `amount` tokens from a `burner` address after being asked to by `sender`\n /// @param amount Amount of tokens to burn\n /// @param burner Address to burn from\n /// @param sender Address which requested the burn from `burner`\n /// @dev This method is to be called by a contract with the minter right after being requested\n /// to do so by a `sender` address willing to burn tokens from another `burner` address\n /// @dev The method checks the allowance between the `sender` and the `burner`\n function burnFrom(uint256 amount, address burner, address sender) external;\n\n /// @notice Burns `amount` tokens from a `burner` address\n /// @param amount Amount of tokens to burn\n /// @param burner Address to burn from\n /// @dev This method is to be called by a contract with a minter right on the AgToken after being\n /// requested to do so by an address willing to burn tokens from its address\n function burnSelf(uint256 amount, address burner) external;\n\n // ========================= Treasury Only Functions ===========================\n\n /// @notice Adds a minter in the contract\n /// @param minter Minter address to add\n /// @dev Zero address checks are performed directly in the `Treasury` contract\n function addMinter(address minter) external;\n\n /// @notice Removes a minter from the contract\n /// @param minter Minter address to remove\n /// @dev This function can also be called by a minter wishing to revoke itself\n function removeMinter(address minter) external;\n\n /// @notice Sets a new treasury contract\n /// @param _treasury New treasury address\n function setTreasury(address _treasury) external;\n\n // ========================= External functions ================================\n\n /// @notice Checks whether an address has the right to mint agTokens\n /// @param minter Address for which the minting right should be checked\n /// @return Whether the address has the right to mint agTokens or not\n function isMinter(address minter) external view returns (bool);\n}\n" + }, + "contracts/interfaces/ICore.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\n/// @title ICore\n/// @author Angle Labs, Inc.\n/// @notice Interface for the `Core` contracts of smart contract modules used in Angle Labs contracts\ninterface ICore {\n /// @notice Checks whether an address is governor\n /// @param admin Address to check\n /// @return Whether the address has the `GOVERNOR_ROLE` or not\n function isGovernor(address admin) external view returns (bool);\n\n /// @notice Checks whether an address is a governor or a guardian of a module\n /// @param admin Address to check\n /// @return Whether the address has the `GUARDIAN_ROLE` or not\n /// @dev Governance should make sure when adding a governor to also give this governor the guardian\n /// role by calling the `addGovernor` function\n function isGovernorOrGuardian(address admin) external view returns (bool);\n}\n" + }, + "contracts/interfaces/ITreasury.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport { IAgToken } from \"./IAgToken.sol\";\nimport { ICore } from \"./ICore.sol\";\n\n/// @title ITreasury\n/// @author Angle Core Team\n/// @notice Interface for the `Treasury` contract\n/// @dev This interface only contains functions of the `Treasury` which are called by other contracts\n/// of this module\ninterface ITreasury {\n /// @notice Stablecoin handled by this `treasury` contract\n function stablecoin() external view returns (IAgToken);\n\n /// @notice Checks whether a given address has the governor role\n /// @param admin Address to check\n /// @return Whether the address has the governor role\n /// @dev Access control is only kept in the `CoreBorrow` contract\n function isGovernor(address admin) external view returns (bool);\n\n /// @notice Checks whether a given address has the guardian or the governor role\n /// @param admin Address to check\n /// @return Whether the address has the guardian or the governor role\n /// @dev Access control is only kept in the `CoreBorrow` contract which means that this function\n /// queries the `CoreBorrow` contract\n function isGovernorOrGuardian(address admin) external view returns (bool);\n}\n" + }, + "contracts/middleman/MerklGaugeMiddleman.sol": { + "content": "// SPDX-License-Identifier: BUSL-1.1\n\n/*\n * █ \n ***** ▓▓▓ \n * ▓▓▓▓▓▓▓ \n * ///. ▓▓▓▓▓▓▓▓▓▓▓▓▓ \n ***** //////// ▓▓▓▓▓▓▓ \n * ///////////// ▓▓▓ \n ▓▓ ////////////////// █ ▓▓ \n ▓▓ ▓▓ /////////////////////// ▓▓ ▓▓ \n ▓▓ ▓▓ //////////////////////////// ▓▓ ▓▓ \n ▓▓ ▓▓ /////////▓▓▓///////▓▓▓///////// ▓▓ ▓▓ \n ▓▓ ,////////////////////////////////////// ▓▓ ▓▓ \n ▓▓ ////////////////////////////////////////// ▓▓ \n ▓▓ //////////////////////▓▓▓▓///////////////////// \n ,//////////////////////////////////////////////////// \n .////////////////////////////////////////////////////////// \n .//////////////////////////██.,//////////////////////////█ \n .//////////////////////████..,./////////////////////██ \n ...////////////////███████.....,.////////////////███ \n ,.,////////////████████ ........,///////////████ \n .,.,//////█████████ ,.......///////████ \n ,..//████████ ........./████ \n ..,██████ .....,███ \n .██ ,.,█ \n \n \n \n ▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓ ▓▓▓▓▓▓▓▓▓▓ \n ▓▓▓▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓ ▓▓ ▓▓▓▓ \n ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓ ▓▓▓▓▓ \n ▓▓▓ ▓▓ ▓▓▓ ▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ \n*/\n\npragma solidity ^0.8.17;\n\nimport { IERC20 } from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport { SafeERC20 } from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\n\nimport \"../DistributionCreator.sol\";\n\n/// @title MerklGaugeMiddleman\n/// @author Angle Labs, Inc.\n/// @notice Manages the transfer of ANGLE rewards to the `DistributionCreator` contract\n/// @dev This contract is built under the assumption that the `DistributionCreator` contract has already whitelisted\n/// this contract for it to distribute rewards without having to sign a message\n/// @dev Transient funds left in this contract after a call may be exploited\ncontract MerklGaugeMiddleman {\n using SafeERC20 for IERC20;\n\n // ================================= PARAMETERS ================================\n\n /// @notice Contract handling access control\n ICore public accessControlManager;\n\n /// @notice Maps a gauge to its reward parameters\n mapping(address => DistributionParameters) public gaugeParams;\n\n // =================================== EVENT ===================================\n\n event GaugeSet(address indexed gauge);\n\n constructor(ICore _accessControlManager) {\n if (address(_accessControlManager) == address(0)) revert ZeroAddress();\n accessControlManager = _accessControlManager;\n IERC20 _angle = angle();\n // Condition left here for testing purposes\n if (address(_angle) != address(0))\n _angle.safeIncreaseAllowance(address(merklDistributionCreator()), type(uint256).max);\n }\n\n // ================================= REFERENCES ================================\n\n /// @notice Address of the ANGLE token\n function angle() public view virtual returns (IERC20) {\n return IERC20(0x31429d1856aD1377A8A0079410B297e1a9e214c2);\n }\n\n /// @notice Address of the Merkl contract managing rewards to be distributed\n /// @dev Address is the same across the different chains on which it is deployed\n function merklDistributionCreator() public view virtual returns (DistributionCreator) {\n return DistributionCreator(0x8BB4C975Ff3c250e0ceEA271728547f3802B36Fd);\n }\n\n // ============================= EXTERNAL FUNCTIONS ============================\n\n /// @notice Restores the allowance for the ANGLE token to the `DistributionCreator` contract\n function setAngleAllowance() external {\n IERC20 _angle = angle();\n address manager = address(merklDistributionCreator());\n uint256 currentAllowance = _angle.allowance(address(this), manager);\n if (currentAllowance < type(uint256).max)\n _angle.safeIncreaseAllowance(manager, type(uint256).max - currentAllowance);\n }\n\n /// @notice Specifies the reward distribution parameters for `gauge`\n function setGauge(address gauge, DistributionParameters memory params) external {\n if (!accessControlManager.isGovernorOrGuardian(msg.sender)) revert NotGovernorOrGuardian();\n DistributionCreator manager = merklDistributionCreator();\n if (\n gauge == address(0) ||\n params.rewardToken != address(angle()) ||\n (manager.isWhitelistedToken(IUniswapV3Pool(params.uniV3Pool).token0()) == 0 &&\n manager.isWhitelistedToken(IUniswapV3Pool(params.uniV3Pool).token1()) == 0)\n ) revert InvalidParams();\n gaugeParams[gauge] = params;\n emit GaugeSet(gauge);\n }\n\n /// @notice Transmits rewards from the `AngleDistributor` to the `DistributionCreator` with the correct\n /// parameters\n /// @dev Callable by any contract\n /// @dev This method can be used to recover leftover ANGLE tokens in the contract\n function notifyReward(address gauge, uint256 amount) public {\n DistributionParameters memory params = gaugeParams[gauge];\n if (params.uniV3Pool == address(0)) revert InvalidParams();\n if (amount == 0) amount = angle().balanceOf(address(this));\n params.epochStart = uint32(block.timestamp);\n params.amount = amount;\n DistributionCreator creator = merklDistributionCreator();\n if (amount > 0) {\n // Need to deal with minimum distribution amounts\n if (amount > creator.rewardTokenMinAmounts(address(angle())) * params.numEpoch) {\n merklDistributionCreator().createDistribution(params);\n } else {\n // Sending leftover ANGLE tokens to the `msg.sender`\n angle().safeTransfer(msg.sender, amount);\n }\n }\n }\n\n /// @notice Fetches tokens and transmits rewards in the same transaction\n function notifyRewardWithTransfer(address gauge, uint256 amount) external {\n angle().safeTransferFrom(msg.sender, address(this), amount);\n notifyReward(gauge, amount);\n }\n}\n" + }, + "contracts/middleman/MerklGaugeMiddlemanPolygon.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"./MerklGaugeMiddleman.sol\";\n\n/// @title MerklGaugeMiddlemanPolygon\n/// @author Angle Labs, Inc.\ncontract MerklGaugeMiddlemanPolygon is MerklGaugeMiddleman {\n constructor(ICore _accessControlManager) MerklGaugeMiddleman(_accessControlManager) {}\n\n function angle() public pure override returns (IERC20) {\n return IERC20(0x900F717EA076E1E7a484ad9DD2dB81CEEc60eBF1);\n }\n}\n" + }, + "contracts/mock/MockMerklGaugeMiddleman.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"../middleman/MerklGaugeMiddleman.sol\";\n\ncontract MockMerklGaugeMiddleman is MerklGaugeMiddleman {\n address public angleDistributorAddress;\n IERC20 public angleAddress;\n DistributionCreator public manager;\n\n constructor(ICore _coreBorrow) MerklGaugeMiddleman(_coreBorrow) {}\n\n function angle() public view override returns (IERC20) {\n return angleAddress;\n }\n\n function merklDistributionCreator() public view override returns (DistributionCreator) {\n return manager;\n }\n\n function setAddresses(\n address _angleDistributorAddress,\n IERC20 _angleAddress,\n DistributionCreator _manager\n ) external {\n angleDistributorAddress = _angleDistributorAddress;\n angleAddress = _angleAddress;\n manager = _manager;\n }\n}\n" + }, + "contracts/struct/DistributionParameters.sol": { + "content": "// SPDX-License-Identifier: BUSL-1.1\n\npragma solidity ^0.8.17;\n\nstruct DistributionParameters {\n // ID of the reward (populated once created)\n bytes32 rewardId;\n // Address of the UniswapV3 pool that needs to be incentivized\n address uniV3Pool;\n // Address of the reward token for the incentives\n address rewardToken;\n // Amount of `rewardToken` to distribute across all the epochs\n // Amount distributed per epoch is `amount/numEpoch`\n uint256 amount;\n // List of all position wrappers to consider or not for this contract. Some wrappers like Gamma or Arrakis\n // are automatically detected and so there is no need to specify them here. Check out the docs to find out\n // which need to be specified and which are not automatically detected.\n address[] positionWrappers;\n // Type (Arrakis, Gamma, Blacklist, ...) encoded as a `uint32` for each wrapper in the list above. Mapping between\n // wrapper types and their corresponding `uint32` value can be found in Angle Docs\n uint32[] wrapperTypes;\n // In the incentivization formula, how much of the fees should go to holders of token0\n // in base 10**4\n uint32 propToken0;\n // Proportion for holding token1 (in base 10**4)\n uint32 propToken1;\n // Proportion for providing a useful liquidity (in base 10**4) that generates fees\n uint32 propFees;\n // Timestamp at which the incentivization should start\n uint32 epochStart;\n // Amount of epochs for which incentivization should last\n uint32 numEpoch;\n // Whether out of range liquidity should still be incentivized or not\n // This should be equal to 1 if out of range liquidity should still be incentivized\n // and 0 otherwise\n uint32 isOutOfRangeIncentivized;\n // How much more addresses with a maximum boost can get with respect to addresses\n // which do not have a boost (in base 4). In the case of Curve where addresses get 2.5x more\n // this would be 25000\n uint32 boostedReward;\n // Address of the token which dictates who gets boosted rewards or not. This is optional\n // and if the zero address is given no boost will be taken into account\n address boostingAddress;\n // Additional data passed when distributing rewards. This parameter may be used in case\n // the reward distribution script needs to look into other parameters beyond the ones above.\n bytes additionalData;\n}\n" + }, + "contracts/struct/ExtensiveDistributionParameters.sol": { + "content": "// SPDX-License-Identifier: BUSL-1.1\n\npragma solidity ^0.8.17;\n\nimport { DistributionParameters } from \"./DistributionParameters.sol\";\n\nstruct UniswapTokenData {\n address add;\n uint8 decimals;\n string symbol;\n uint256 poolBalance;\n}\n\nstruct ExtensiveDistributionParameters {\n DistributionParameters base;\n // Uniswap pool data\n uint24 poolFee;\n UniswapTokenData token0;\n UniswapTokenData token1;\n // rewardToken data\n string rewardTokenSymbol;\n uint8 rewardTokenDecimals;\n}\n" + }, + "contracts/struct/RewardTokenAmounts.sol": { + "content": "// SPDX-License-Identifier: BUSL-1.1\n\npragma solidity ^0.8.17;\n\nstruct RewardTokenAmounts {\n address token;\n uint256 minimumAmountPerEpoch;\n}\n" + }, + "contracts/utils/Errors.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nerror InvalidDispute();\nerror InvalidLengths();\nerror InvalidParam();\nerror InvalidParams();\nerror InvalidProof();\nerror InvalidUninitializedRoot();\nerror InvalidReward();\nerror InvalidSignature();\nerror NoDispute();\nerror NotGovernor();\nerror NotGovernorOrGuardian();\nerror NotSigned();\nerror NotTrusted();\nerror NotWhitelisted();\nerror UnresolvedDispute();\nerror ZeroAddress();\n" + }, + "contracts/utils/UUPSHelper.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\n/*\n * █ \n ***** ▓▓▓ \n * ▓▓▓▓▓▓▓ \n * ///. ▓▓▓▓▓▓▓▓▓▓▓▓▓ \n ***** //////// ▓▓▓▓▓▓▓ \n * ///////////// ▓▓▓ \n ▓▓ ////////////////// █ ▓▓ \n ▓▓ ▓▓ /////////////////////// ▓▓ ▓▓ \n ▓▓ ▓▓ //////////////////////////// ▓▓ ▓▓ \n ▓▓ ▓▓ /////////▓▓▓///////▓▓▓///////// ▓▓ ▓▓ \n ▓▓ ,////////////////////////////////////// ▓▓ ▓▓ \n ▓▓ ////////////////////////////////////////// ▓▓ \n ▓▓ //////////////////////▓▓▓▓///////////////////// \n ,//////////////////////////////////////////////////// \n .////////////////////////////////////////////////////////// \n .//////////////////////////██.,//////////////////////////█ \n .//////////////////////████..,./////////////////////██ \n ...////////////////███████.....,.////////////////███ \n ,.,////////////████████ ........,///////////████ \n .,.,//////█████████ ,.......///////████ \n ,..//████████ ........./████ \n ..,██████ .....,███ \n .██ ,.,█ \n \n \n \n ▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓ ▓▓▓▓▓▓▓▓▓▓ \n ▓▓▓▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓ ▓▓ ▓▓▓▓ \n ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓ ▓▓▓▓▓ \n ▓▓▓ ▓▓ ▓▓▓ ▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ \n*/\n\npragma solidity ^0.8.17;\n\nimport { UUPSUpgradeable } from \"@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol\";\n\nimport { ICore } from \"../interfaces/ICore.sol\";\nimport \"../utils/Errors.sol\";\n\n/// @title UUPSHelper\n/// @notice Helper contract for UUPSUpgradeable contracts where the upgradeability is controlled by a specific address\n/// @author Angle Labs., Inc\n/// @dev The 0 address check in the modifier allows the use of these modifiers during initialization\nabstract contract UUPSHelper is UUPSUpgradeable {\n modifier onlyGuardianUpgrader(ICore _core) {\n if (address(_core) != address(0) && !_core.isGovernorOrGuardian(msg.sender)) revert NotGovernorOrGuardian();\n _;\n }\n\n modifier onlyGovernorUpgrader(ICore _core) {\n if (address(_core) != address(0) && !_core.isGovernor(msg.sender)) revert NotGovernor();\n _;\n }\n\n constructor() initializer {}\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 100000 + }, + "viaIR": false, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + } + } +} \ No newline at end of file diff --git a/deployments/filecoin/solcInputs/69984a2380fa2fad0c3afbbb08b5652b.json b/deployments/filecoin/solcInputs/69984a2380fa2fad0c3afbbb08b5652b.json new file mode 100644 index 0000000..a42b1be --- /dev/null +++ b/deployments/filecoin/solcInputs/69984a2380fa2fad0c3afbbb08b5652b.json @@ -0,0 +1,98 @@ +{ + "language": "Solidity", + "sources": { + "@openzeppelin/contracts-upgradeable/interfaces/draft-IERC1822Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\n * proxy whose upgrades are fully controlled by the current implementation.\n */\ninterface IERC1822ProxiableUpgradeable {\n /**\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\n * address.\n *\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\n * function revert if invoked through a proxy.\n */\n function proxiableUUID() external view returns (bytes32);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/proxy/beacon/IBeaconUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\n */\ninterface IBeaconUpgradeable {\n /**\n * @dev Must return an address that can be used as a delegate call target.\n *\n * {BeaconProxy} will check that this address is a contract.\n */\n function implementation() external view returns (address);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/proxy/ERC1967/ERC1967UpgradeUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (proxy/ERC1967/ERC1967Upgrade.sol)\n\npragma solidity ^0.8.2;\n\nimport \"../beacon/IBeaconUpgradeable.sol\";\nimport \"../../interfaces/draft-IERC1822Upgradeable.sol\";\nimport \"../../utils/AddressUpgradeable.sol\";\nimport \"../../utils/StorageSlotUpgradeable.sol\";\nimport \"../utils/Initializable.sol\";\n\n/**\n * @dev This abstract contract provides getters and event emitting update functions for\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\n *\n * _Available since v4.1._\n *\n * @custom:oz-upgrades-unsafe-allow delegatecall\n */\nabstract contract ERC1967UpgradeUpgradeable is Initializable {\n function __ERC1967Upgrade_init() internal onlyInitializing {\n }\n\n function __ERC1967Upgrade_init_unchained() internal onlyInitializing {\n }\n // This is the keccak-256 hash of \"eip1967.proxy.rollback\" subtracted by 1\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\n\n /**\n * @dev Storage slot with the address of the current implementation.\n * This is the keccak-256 hash of \"eip1967.proxy.implementation\" subtracted by 1, and is\n * validated in the constructor.\n */\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n\n /**\n * @dev Emitted when the implementation is upgraded.\n */\n event Upgraded(address indexed implementation);\n\n /**\n * @dev Returns the current implementation address.\n */\n function _getImplementation() internal view returns (address) {\n return StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value;\n }\n\n /**\n * @dev Stores a new address in the EIP1967 implementation slot.\n */\n function _setImplementation(address newImplementation) private {\n require(AddressUpgradeable.isContract(newImplementation), \"ERC1967: new implementation is not a contract\");\n StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\n }\n\n /**\n * @dev Perform implementation upgrade\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeTo(address newImplementation) internal {\n _setImplementation(newImplementation);\n emit Upgraded(newImplementation);\n }\n\n /**\n * @dev Perform implementation upgrade with additional setup call.\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeToAndCall(\n address newImplementation,\n bytes memory data,\n bool forceCall\n ) internal {\n _upgradeTo(newImplementation);\n if (data.length > 0 || forceCall) {\n _functionDelegateCall(newImplementation, data);\n }\n }\n\n /**\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeToAndCallUUPS(\n address newImplementation,\n bytes memory data,\n bool forceCall\n ) internal {\n // Upgrades from old implementations will perform a rollback test. This test requires the new\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\n // this special case will break upgrade paths from old UUPS implementation to new ones.\n if (StorageSlotUpgradeable.getBooleanSlot(_ROLLBACK_SLOT).value) {\n _setImplementation(newImplementation);\n } else {\n try IERC1822ProxiableUpgradeable(newImplementation).proxiableUUID() returns (bytes32 slot) {\n require(slot == _IMPLEMENTATION_SLOT, \"ERC1967Upgrade: unsupported proxiableUUID\");\n } catch {\n revert(\"ERC1967Upgrade: new implementation is not UUPS\");\n }\n _upgradeToAndCall(newImplementation, data, forceCall);\n }\n }\n\n /**\n * @dev Storage slot with the admin of the contract.\n * This is the keccak-256 hash of \"eip1967.proxy.admin\" subtracted by 1, and is\n * validated in the constructor.\n */\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\n\n /**\n * @dev Emitted when the admin account has changed.\n */\n event AdminChanged(address previousAdmin, address newAdmin);\n\n /**\n * @dev Returns the current admin.\n */\n function _getAdmin() internal view returns (address) {\n return StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value;\n }\n\n /**\n * @dev Stores a new address in the EIP1967 admin slot.\n */\n function _setAdmin(address newAdmin) private {\n require(newAdmin != address(0), \"ERC1967: new admin is the zero address\");\n StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\n }\n\n /**\n * @dev Changes the admin of the proxy.\n *\n * Emits an {AdminChanged} event.\n */\n function _changeAdmin(address newAdmin) internal {\n emit AdminChanged(_getAdmin(), newAdmin);\n _setAdmin(newAdmin);\n }\n\n /**\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\n */\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\n\n /**\n * @dev Emitted when the beacon is upgraded.\n */\n event BeaconUpgraded(address indexed beacon);\n\n /**\n * @dev Returns the current beacon.\n */\n function _getBeacon() internal view returns (address) {\n return StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value;\n }\n\n /**\n * @dev Stores a new beacon in the EIP1967 beacon slot.\n */\n function _setBeacon(address newBeacon) private {\n require(AddressUpgradeable.isContract(newBeacon), \"ERC1967: new beacon is not a contract\");\n require(\n AddressUpgradeable.isContract(IBeaconUpgradeable(newBeacon).implementation()),\n \"ERC1967: beacon implementation is not a contract\"\n );\n StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value = newBeacon;\n }\n\n /**\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\n *\n * Emits a {BeaconUpgraded} event.\n */\n function _upgradeBeaconToAndCall(\n address newBeacon,\n bytes memory data,\n bool forceCall\n ) internal {\n _setBeacon(newBeacon);\n emit BeaconUpgraded(newBeacon);\n if (data.length > 0 || forceCall) {\n _functionDelegateCall(IBeaconUpgradeable(newBeacon).implementation(), data);\n }\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function _functionDelegateCall(address target, bytes memory data) private returns (bytes memory) {\n require(AddressUpgradeable.isContract(target), \"Address: delegate call to non-contract\");\n\n // solhint-disable-next-line avoid-low-level-calls\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return AddressUpgradeable.verifyCallResult(success, returndata, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.1) (proxy/utils/Initializable.sol)\n\npragma solidity ^0.8.2;\n\nimport \"../../utils/AddressUpgradeable.sol\";\n\n/**\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\n *\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\n * reused. This mechanism prevents re-execution of each \"step\" but allows the creation of new initialization steps in\n * case an upgrade adds a module that needs to be initialized.\n *\n * For example:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * contract MyToken is ERC20Upgradeable {\n * function initialize() initializer public {\n * __ERC20_init(\"MyToken\", \"MTK\");\n * }\n * }\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\n * function initializeV2() reinitializer(2) public {\n * __ERC20Permit_init(\"MyToken\");\n * }\n * }\n * ```\n *\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\n *\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\n *\n * [CAUTION]\n * ====\n * Avoid leaving a contract uninitialized.\n *\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * /// @custom:oz-upgrades-unsafe-allow constructor\n * constructor() {\n * _disableInitializers();\n * }\n * ```\n * ====\n */\nabstract contract Initializable {\n /**\n * @dev Indicates that the contract has been initialized.\n * @custom:oz-retyped-from bool\n */\n uint8 private _initialized;\n\n /**\n * @dev Indicates that the contract is in the process of being initialized.\n */\n bool private _initializing;\n\n /**\n * @dev Triggered when the contract has been initialized or reinitialized.\n */\n event Initialized(uint8 version);\n\n /**\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\n * `onlyInitializing` functions can be used to initialize parent contracts.\n *\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\n * constructor.\n *\n * Emits an {Initialized} event.\n */\n modifier initializer() {\n bool isTopLevelCall = !_initializing;\n require(\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\n \"Initializable: contract is already initialized\"\n );\n _initialized = 1;\n if (isTopLevelCall) {\n _initializing = true;\n }\n _;\n if (isTopLevelCall) {\n _initializing = false;\n emit Initialized(1);\n }\n }\n\n /**\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\n * used to initialize parent contracts.\n *\n * A reinitializer may be used after the original initialization step. This is essential to configure modules that\n * are added through upgrades and that require initialization.\n *\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\n * cannot be nested. If one is invoked in the context of another, execution will revert.\n *\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\n * a contract, executing them in the right order is up to the developer or operator.\n *\n * WARNING: setting the version to 255 will prevent any future reinitialization.\n *\n * Emits an {Initialized} event.\n */\n modifier reinitializer(uint8 version) {\n require(!_initializing && _initialized < version, \"Initializable: contract is already initialized\");\n _initialized = version;\n _initializing = true;\n _;\n _initializing = false;\n emit Initialized(version);\n }\n\n /**\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\n */\n modifier onlyInitializing() {\n require(_initializing, \"Initializable: contract is not initializing\");\n _;\n }\n\n /**\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\n * through proxies.\n *\n * Emits an {Initialized} event the first time it is successfully executed.\n */\n function _disableInitializers() internal virtual {\n require(!_initializing, \"Initializable: contract is initializing\");\n if (_initialized < type(uint8).max) {\n _initialized = type(uint8).max;\n emit Initialized(type(uint8).max);\n }\n }\n\n /**\n * @dev Returns the highest version that has been initialized. See {reinitializer}.\n */\n function _getInitializedVersion() internal view returns (uint8) {\n return _initialized;\n }\n\n /**\n * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.\n */\n function _isInitializing() internal view returns (bool) {\n return _initializing;\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (proxy/utils/UUPSUpgradeable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../interfaces/draft-IERC1822Upgradeable.sol\";\nimport \"../ERC1967/ERC1967UpgradeUpgradeable.sol\";\nimport \"./Initializable.sol\";\n\n/**\n * @dev An upgradeability mechanism designed for UUPS proxies. The functions included here can perform an upgrade of an\n * {ERC1967Proxy}, when this contract is set as the implementation behind such a proxy.\n *\n * A security mechanism ensures that an upgrade does not turn off upgradeability accidentally, although this risk is\n * reinstated if the upgrade retains upgradeability but removes the security mechanism, e.g. by replacing\n * `UUPSUpgradeable` with a custom implementation of upgrades.\n *\n * The {_authorizeUpgrade} function must be overridden to include access restriction to the upgrade mechanism.\n *\n * _Available since v4.1._\n */\nabstract contract UUPSUpgradeable is Initializable, IERC1822ProxiableUpgradeable, ERC1967UpgradeUpgradeable {\n function __UUPSUpgradeable_init() internal onlyInitializing {\n }\n\n function __UUPSUpgradeable_init_unchained() internal onlyInitializing {\n }\n /// @custom:oz-upgrades-unsafe-allow state-variable-immutable state-variable-assignment\n address private immutable __self = address(this);\n\n /**\n * @dev Check that the execution is being performed through a delegatecall call and that the execution context is\n * a proxy contract with an implementation (as defined in ERC1967) pointing to self. This should only be the case\n * for UUPS and transparent proxies that are using the current contract as their implementation. Execution of a\n * function through ERC1167 minimal proxies (clones) would not normally pass this test, but is not guaranteed to\n * fail.\n */\n modifier onlyProxy() {\n require(address(this) != __self, \"Function must be called through delegatecall\");\n require(_getImplementation() == __self, \"Function must be called through active proxy\");\n _;\n }\n\n /**\n * @dev Check that the execution is not being performed through a delegate call. This allows a function to be\n * callable on the implementing contract but not through proxies.\n */\n modifier notDelegated() {\n require(address(this) == __self, \"UUPSUpgradeable: must not be called through delegatecall\");\n _;\n }\n\n /**\n * @dev Implementation of the ERC1822 {proxiableUUID} function. This returns the storage slot used by the\n * implementation. It is used to validate the implementation's compatibility when performing an upgrade.\n *\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\n * function revert if invoked through a proxy. This is guaranteed by the `notDelegated` modifier.\n */\n function proxiableUUID() external view virtual override notDelegated returns (bytes32) {\n return _IMPLEMENTATION_SLOT;\n }\n\n /**\n * @dev Upgrade the implementation of the proxy to `newImplementation`.\n *\n * Calls {_authorizeUpgrade}.\n *\n * Emits an {Upgraded} event.\n */\n function upgradeTo(address newImplementation) external virtual onlyProxy {\n _authorizeUpgrade(newImplementation);\n _upgradeToAndCallUUPS(newImplementation, new bytes(0), false);\n }\n\n /**\n * @dev Upgrade the implementation of the proxy to `newImplementation`, and subsequently execute the function call\n * encoded in `data`.\n *\n * Calls {_authorizeUpgrade}.\n *\n * Emits an {Upgraded} event.\n */\n function upgradeToAndCall(address newImplementation, bytes memory data) external payable virtual onlyProxy {\n _authorizeUpgrade(newImplementation);\n _upgradeToAndCallUUPS(newImplementation, data, true);\n }\n\n /**\n * @dev Function that should revert when `msg.sender` is not authorized to upgrade the contract. Called by\n * {upgradeTo} and {upgradeToAndCall}.\n *\n * Normally, this function will use an xref:access.adoc[access control] modifier such as {Ownable-onlyOwner}.\n *\n * ```solidity\n * function _authorizeUpgrade(address) internal override onlyOwner {}\n * ```\n */\n function _authorizeUpgrade(address newImplementation) internal virtual;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (security/ReentrancyGuard.sol)\n\npragma solidity ^0.8.0;\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Contract module that helps prevent reentrant calls to a function.\n *\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\n * available, which can be applied to functions to make sure there are no nested\n * (reentrant) calls to them.\n *\n * Note that because there is a single `nonReentrant` guard, functions marked as\n * `nonReentrant` may not call one another. This can be worked around by making\n * those functions `private`, and then adding `external` `nonReentrant` entry\n * points to them.\n *\n * TIP: If you would like to learn more about reentrancy and alternative ways\n * to protect against it, check out our blog post\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\n */\nabstract contract ReentrancyGuardUpgradeable is Initializable {\n // Booleans are more expensive than uint256 or any type that takes up a full\n // word because each write operation emits an extra SLOAD to first read the\n // slot's contents, replace the bits taken up by the boolean, and then write\n // back. This is the compiler's defense against contract upgrades and\n // pointer aliasing, and it cannot be disabled.\n\n // The values being non-zero value makes deployment a bit more expensive,\n // but in exchange the refund on every call to nonReentrant will be lower in\n // amount. Since refunds are capped to a percentage of the total\n // transaction's gas, it is best to keep them low in cases like this one, to\n // increase the likelihood of the full refund coming into effect.\n uint256 private constant _NOT_ENTERED = 1;\n uint256 private constant _ENTERED = 2;\n\n uint256 private _status;\n\n function __ReentrancyGuard_init() internal onlyInitializing {\n __ReentrancyGuard_init_unchained();\n }\n\n function __ReentrancyGuard_init_unchained() internal onlyInitializing {\n _status = _NOT_ENTERED;\n }\n\n /**\n * @dev Prevents a contract from calling itself, directly or indirectly.\n * Calling a `nonReentrant` function from another `nonReentrant`\n * function is not supported. It is possible to prevent this from happening\n * by making the `nonReentrant` function external, and making it call a\n * `private` function that does the actual work.\n */\n modifier nonReentrant() {\n _nonReentrantBefore();\n _;\n _nonReentrantAfter();\n }\n\n function _nonReentrantBefore() private {\n // On the first call to nonReentrant, _status will be _NOT_ENTERED\n require(_status != _ENTERED, \"ReentrancyGuard: reentrant call\");\n\n // Any calls to nonReentrant after this point will fail\n _status = _ENTERED;\n }\n\n function _nonReentrantAfter() private {\n // By storing the original value once again, a refund is triggered (see\n // https://eips.ethereum.org/EIPS/eip-2200)\n _status = _NOT_ENTERED;\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[49] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary AddressUpgradeable {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/StorageSlotUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/StorageSlot.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Library for reading and writing primitive types to specific storage slots.\n *\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\n * This library helps with reading and writing to such slots without the need for inline assembly.\n *\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\n *\n * Example usage to set ERC1967 implementation slot:\n * ```\n * contract ERC1967 {\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n *\n * function _getImplementation() internal view returns (address) {\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\n * }\n *\n * function _setImplementation(address newImplementation) internal {\n * require(Address.isContract(newImplementation), \"ERC1967: new implementation is not a contract\");\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\n * }\n * }\n * ```\n *\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\n */\nlibrary StorageSlotUpgradeable {\n struct AddressSlot {\n address value;\n }\n\n struct BooleanSlot {\n bool value;\n }\n\n struct Bytes32Slot {\n bytes32 value;\n }\n\n struct Uint256Slot {\n uint256 value;\n }\n\n /**\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\n */\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\n */\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\n */\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\n */\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n */\ninterface IERC20Permit {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also apply here.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `deadline` must be a timestamp in the future.\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\n * over the EIP712-formatted function arguments.\n * - the signature must use ``owner``'s current nonce (see {nonces}).\n *\n * For more information on the signature format, see the\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\n * section].\n */\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n\n /**\n * @dev Returns the current nonce for `owner`. This value must be\n * included whenever a signature is generated for {permit}.\n *\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\n * prevents a signature from being used multiple times.\n */\n function nonces(address owner) external view returns (uint256);\n\n /**\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\n */\n // solhint-disable-next-line func-name-mixedcase\n function DOMAIN_SEPARATOR() external view returns (bytes32);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20Metadata is IERC20 {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/IERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\nimport \"../extensions/draft-IERC20Permit.sol\";\nimport \"../../../utils/Address.sol\";\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n using Address for address;\n\n function safeTransfer(\n IERC20 token,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n function safeTransferFrom(\n IERC20 token,\n address from,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\n }\n\n /**\n * @dev Deprecated. This function has issues similar to the ones found in\n * {IERC20-approve}, and its usage is discouraged.\n *\n * Whenever possible, use {safeIncreaseAllowance} and\n * {safeDecreaseAllowance} instead.\n */\n function safeApprove(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n // safeApprove should only be called when setting an initial allowance,\n // or when resetting it to zero. To increase and decrease it, use\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\n require(\n (value == 0) || (token.allowance(address(this), spender) == 0),\n \"SafeERC20: approve from non-zero to non-zero allowance\"\n );\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\n }\n\n function safeIncreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n uint256 newAllowance = token.allowance(address(this), spender) + value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n\n function safeDecreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n unchecked {\n uint256 oldAllowance = token.allowance(address(this), spender);\n require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\n uint256 newAllowance = oldAllowance - value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n }\n\n function safePermit(\n IERC20Permit token,\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal {\n uint256 nonceBefore = token.nonces(owner);\n token.permit(owner, spender, value, deadline, v, r, s);\n uint256 nonceAfter = token.nonces(owner);\n require(nonceAfter == nonceBefore + 1, \"SafeERC20: permit did not succeed\");\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data, \"SafeERC20: low-level call failed\");\n if (returndata.length > 0) {\n // Return data is optional\n require(abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Address.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/cryptography/ECDSA.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/ECDSA.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../Strings.sol\";\n\n/**\n * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.\n *\n * These functions can be used to verify that a message was signed by the holder\n * of the private keys of a given address.\n */\nlibrary ECDSA {\n enum RecoverError {\n NoError,\n InvalidSignature,\n InvalidSignatureLength,\n InvalidSignatureS,\n InvalidSignatureV // Deprecated in v4.8\n }\n\n function _throwError(RecoverError error) private pure {\n if (error == RecoverError.NoError) {\n return; // no error: do nothing\n } else if (error == RecoverError.InvalidSignature) {\n revert(\"ECDSA: invalid signature\");\n } else if (error == RecoverError.InvalidSignatureLength) {\n revert(\"ECDSA: invalid signature length\");\n } else if (error == RecoverError.InvalidSignatureS) {\n revert(\"ECDSA: invalid signature 's' value\");\n }\n }\n\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with\n * `signature` or error string. This address can then be used for verification purposes.\n *\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {toEthSignedMessageHash} on it.\n *\n * Documentation for signature generation:\n * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]\n * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]\n *\n * _Available since v4.3._\n */\n function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {\n if (signature.length == 65) {\n bytes32 r;\n bytes32 s;\n uint8 v;\n // ecrecover takes the signature parameters, and the only way to get them\n // currently is to use assembly.\n /// @solidity memory-safe-assembly\n assembly {\n r := mload(add(signature, 0x20))\n s := mload(add(signature, 0x40))\n v := byte(0, mload(add(signature, 0x60)))\n }\n return tryRecover(hash, v, r, s);\n } else {\n return (address(0), RecoverError.InvalidSignatureLength);\n }\n }\n\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with\n * `signature`. This address can then be used for verification purposes.\n *\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {toEthSignedMessageHash} on it.\n */\n function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, signature);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.\n *\n * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]\n *\n * _Available since v4.3._\n */\n function tryRecover(\n bytes32 hash,\n bytes32 r,\n bytes32 vs\n ) internal pure returns (address, RecoverError) {\n bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);\n uint8 v = uint8((uint256(vs) >> 255) + 27);\n return tryRecover(hash, v, r, s);\n }\n\n /**\n * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.\n *\n * _Available since v4.2._\n */\n function recover(\n bytes32 hash,\n bytes32 r,\n bytes32 vs\n ) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, r, vs);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Overload of {ECDSA-tryRecover} that receives the `v`,\n * `r` and `s` signature fields separately.\n *\n * _Available since v4.3._\n */\n function tryRecover(\n bytes32 hash,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal pure returns (address, RecoverError) {\n // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature\n // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines\n // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most\n // signatures from current libraries generate a unique signature with an s-value in the lower half order.\n //\n // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value\n // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or\n // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept\n // these malleable signatures as well.\n if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {\n return (address(0), RecoverError.InvalidSignatureS);\n }\n\n // If the signature is valid (and not malleable), return the signer address\n address signer = ecrecover(hash, v, r, s);\n if (signer == address(0)) {\n return (address(0), RecoverError.InvalidSignature);\n }\n\n return (signer, RecoverError.NoError);\n }\n\n /**\n * @dev Overload of {ECDSA-recover} that receives the `v`,\n * `r` and `s` signature fields separately.\n */\n function recover(\n bytes32 hash,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, v, r, s);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Returns an Ethereum Signed Message, created from a `hash`. This\n * produces hash corresponding to the one signed with the\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n * JSON-RPC method as part of EIP-191.\n *\n * See {recover}.\n */\n function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {\n // 32 is the length in bytes of hash,\n // enforced by the type signature above\n return keccak256(abi.encodePacked(\"\\x19Ethereum Signed Message:\\n32\", hash));\n }\n\n /**\n * @dev Returns an Ethereum Signed Message, created from `s`. This\n * produces hash corresponding to the one signed with the\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n * JSON-RPC method as part of EIP-191.\n *\n * See {recover}.\n */\n function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(\"\\x19Ethereum Signed Message:\\n\", Strings.toString(s.length), s));\n }\n\n /**\n * @dev Returns an Ethereum Signed Typed Data, created from a\n * `domainSeparator` and a `structHash`. This produces hash corresponding\n * to the one signed with the\n * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]\n * JSON-RPC method as part of EIP-712.\n *\n * See {recover}.\n */\n function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(\"\\x19\\x01\", domainSeparator, structHash));\n }\n}\n" + }, + "@openzeppelin/contracts/utils/math/Math.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary Math {\n enum Rounding {\n Down, // Toward negative infinity\n Up, // Toward infinity\n Zero // Toward zero\n }\n\n /**\n * @dev Returns the largest of two numbers.\n */\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two numbers.\n */\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two numbers. The result is rounded towards\n * zero.\n */\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b) / 2 can overflow.\n return (a & b) + (a ^ b) / 2;\n }\n\n /**\n * @dev Returns the ceiling of the division of two numbers.\n *\n * This differs from standard division with `/` in that it rounds up instead\n * of rounding down.\n */\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b - 1) / b can overflow on addition, so we distribute.\n return a == 0 ? 0 : (a - 1) / b + 1;\n }\n\n /**\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\n * with further edits by Uniswap Labs also under MIT license.\n */\n function mulDiv(\n uint256 x,\n uint256 y,\n uint256 denominator\n ) internal pure returns (uint256 result) {\n unchecked {\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\n // variables such that product = prod1 * 2^256 + prod0.\n uint256 prod0; // Least significant 256 bits of the product\n uint256 prod1; // Most significant 256 bits of the product\n assembly {\n let mm := mulmod(x, y, not(0))\n prod0 := mul(x, y)\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n }\n\n // Handle non-overflow cases, 256 by 256 division.\n if (prod1 == 0) {\n return prod0 / denominator;\n }\n\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\n require(denominator > prod1);\n\n ///////////////////////////////////////////////\n // 512 by 256 division.\n ///////////////////////////////////////////////\n\n // Make division exact by subtracting the remainder from [prod1 prod0].\n uint256 remainder;\n assembly {\n // Compute remainder using mulmod.\n remainder := mulmod(x, y, denominator)\n\n // Subtract 256 bit number from 512 bit number.\n prod1 := sub(prod1, gt(remainder, prod0))\n prod0 := sub(prod0, remainder)\n }\n\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\n // See https://cs.stackexchange.com/q/138556/92363.\n\n // Does not overflow because the denominator cannot be zero at this stage in the function.\n uint256 twos = denominator & (~denominator + 1);\n assembly {\n // Divide denominator by twos.\n denominator := div(denominator, twos)\n\n // Divide [prod1 prod0] by twos.\n prod0 := div(prod0, twos)\n\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\n twos := add(div(sub(0, twos), twos), 1)\n }\n\n // Shift in bits from prod1 into prod0.\n prod0 |= prod1 * twos;\n\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\n // four bits. That is, denominator * inv = 1 mod 2^4.\n uint256 inverse = (3 * denominator) ^ 2;\n\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\n // in modular arithmetic, doubling the correct bits in each step.\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\n\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\n // is no longer required.\n result = prod0 * inverse;\n return result;\n }\n }\n\n /**\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\n */\n function mulDiv(\n uint256 x,\n uint256 y,\n uint256 denominator,\n Rounding rounding\n ) internal pure returns (uint256) {\n uint256 result = mulDiv(x, y, denominator);\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\n result += 1;\n }\n return result;\n }\n\n /**\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\n *\n * Inspired by Henry S. Warren, Jr.'s \"Hacker's Delight\" (Chapter 11).\n */\n function sqrt(uint256 a) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\n //\n // We know that the \"msb\" (most significant bit) of our target number `a` is a power of 2 such that we have\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\n //\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\n // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\n // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\n //\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\n uint256 result = 1 << (log2(a) >> 1);\n\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\n // into the expected uint128 result.\n unchecked {\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n return min(result, a / result);\n }\n }\n\n /**\n * @notice Calculates sqrt(a), following the selected rounding direction.\n */\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = sqrt(a);\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 2, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 128;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 64;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 32;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 16;\n }\n if (value >> 8 > 0) {\n value >>= 8;\n result += 8;\n }\n if (value >> 4 > 0) {\n value >>= 4;\n result += 4;\n }\n if (value >> 2 > 0) {\n value >>= 2;\n result += 2;\n }\n if (value >> 1 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log2(value);\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 10, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >= 10**64) {\n value /= 10**64;\n result += 64;\n }\n if (value >= 10**32) {\n value /= 10**32;\n result += 32;\n }\n if (value >= 10**16) {\n value /= 10**16;\n result += 16;\n }\n if (value >= 10**8) {\n value /= 10**8;\n result += 8;\n }\n if (value >= 10**4) {\n value /= 10**4;\n result += 4;\n }\n if (value >= 10**2) {\n value /= 10**2;\n result += 2;\n }\n if (value >= 10**1) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log10(value);\n return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 256, rounded down, of a positive value.\n * Returns 0 if given 0.\n *\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\n */\n function log256(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 16;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 8;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 4;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 2;\n }\n if (value >> 8 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log256(value);\n return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Strings.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./math/Math.sol\";\n\n/**\n * @dev String operations.\n */\nlibrary Strings {\n bytes16 private constant _SYMBOLS = \"0123456789abcdef\";\n uint8 private constant _ADDRESS_LENGTH = 20;\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n */\n function toString(uint256 value) internal pure returns (string memory) {\n unchecked {\n uint256 length = Math.log10(value) + 1;\n string memory buffer = new string(length);\n uint256 ptr;\n /// @solidity memory-safe-assembly\n assembly {\n ptr := add(buffer, add(32, length))\n }\n while (true) {\n ptr--;\n /// @solidity memory-safe-assembly\n assembly {\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\n }\n value /= 10;\n if (value == 0) break;\n }\n return buffer;\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n */\n function toHexString(uint256 value) internal pure returns (string memory) {\n unchecked {\n return toHexString(value, Math.log256(value) + 1);\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n */\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n bytes memory buffer = new bytes(2 * length + 2);\n buffer[0] = \"0\";\n buffer[1] = \"x\";\n for (uint256 i = 2 * length + 1; i > 1; --i) {\n buffer[i] = _SYMBOLS[value & 0xf];\n value >>= 4;\n }\n require(value == 0, \"Strings: hex length insufficient\");\n return string(buffer);\n }\n\n /**\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\n */\n function toHexString(address addr) internal pure returns (string memory) {\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\n }\n}\n" + }, + "contracts/DistributionCreator.sol": { + "content": "// SPDX-License-Identifier: BUSL-1.1\n\n/*\n * █ \n ***** ▓▓▓ \n * ▓▓▓▓▓▓▓ \n * ///. ▓▓▓▓▓▓▓▓▓▓▓▓▓ \n ***** //////// ▓▓▓▓▓▓▓ \n * ///////////// ▓▓▓ \n ▓▓ ////////////////// █ ▓▓ \n ▓▓ ▓▓ /////////////////////// ▓▓ ▓▓ \n ▓▓ ▓▓ //////////////////////////// ▓▓ ▓▓ \n ▓▓ ▓▓ /////////▓▓▓///////▓▓▓///////// ▓▓ ▓▓ \n ▓▓ ,////////////////////////////////////// ▓▓ ▓▓ \n ▓▓ ////////////////////////////////////////// ▓▓ \n ▓▓ //////////////////////▓▓▓▓///////////////////// \n ,//////////////////////////////////////////////////// \n .////////////////////////////////////////////////////////// \n .//////////////////////////██.,//////////////////////////█ \n .//////////////////////████..,./////////////////////██ \n ...////////////////███████.....,.////////////////███ \n ,.,////////////████████ ........,///////////████ \n .,.,//////█████████ ,.......///////████ \n ,..//████████ ........./████ \n ..,██████ .....,███ \n .██ ,.,█ \n \n \n \n ▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓ ▓▓▓▓▓▓▓▓▓▓ \n ▓▓▓▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓ ▓▓ ▓▓▓▓ \n ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓ ▓▓▓▓▓ \n ▓▓▓ ▓▓ ▓▓▓ ▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ \n*/\n\npragma solidity ^0.8.17;\n\nimport { ReentrancyGuardUpgradeable } from \"@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol\";\nimport { IERC20, IERC20Metadata } from \"@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol\";\nimport { SafeERC20 } from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport { ECDSA } from \"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\";\n\nimport { IUniswapV3Pool } from \"./interfaces/external/uniswap/IUniswapV3Pool.sol\";\n\nimport \"./utils/UUPSHelper.sol\";\nimport { DistributionParameters } from \"./struct/DistributionParameters.sol\";\nimport { UniswapTokenData, ExtensiveDistributionParameters } from \"./struct/ExtensiveDistributionParameters.sol\";\nimport { RewardTokenAmounts } from \"./struct/RewardTokenAmounts.sol\";\n\ninterface IDistributionCreator {\n function tryGetExtensiveDistributionParameters(\n DistributionParameters memory distribution\n ) external view returns (bool success, ExtensiveDistributionParameters memory extensiveParams);\n}\n\n/// @title DistributionCreator\n/// @author Angle Labs, Inc.\n/// @notice Manages the distribution of rewards across different pools with concentrated liquidity (like on Uniswap V3)\n/// @dev This contract is mostly a helper for APIs built on top of Merkl\n/// @dev People depositing rewards must have signed a `message` with the conditions for using the\n/// product\n//solhint-disable\ncontract DistributionCreator is UUPSHelper, ReentrancyGuardUpgradeable {\n using SafeERC20 for IERC20;\n\n // =========================== CONSTANTS / VARIABLES ===========================\n\n /// @notice Epoch duration\n uint32 public constant EPOCH_DURATION = 3600;\n\n /// @notice Base for fee computation\n uint256 public constant BASE_9 = 1e9;\n\n /// @notice `Core` contract handling access control\n ICore public core;\n\n /// @notice User contract for distributing rewards\n address public distributor;\n\n /// @notice Address to which fees are forwarded\n address public feeRecipient;\n\n /// @notice Value (in base 10**9) of the fees taken when creating a distribution for a pool which do not\n /// have a whitelisted token in it\n uint256 public fees;\n\n /// @notice Message that needs to be acknowledged by users creating a distribution\n string public message;\n\n /// @notice Hash of the message that needs to be signed\n bytes32 public messageHash;\n\n /// @notice List of all rewards ever distributed or to be distributed in the contract\n /// @dev An attacker could try to populate this list. It shouldn't be an issue as only view functions\n /// iterate on it\n DistributionParameters[] public distributionList;\n\n /// @notice Maps an address to its fee rebate\n mapping(address => uint256) public feeRebate;\n\n /// @notice Maps a token to whether it is whitelisted or not. No fees are to be paid for incentives given\n /// on pools with whitelisted tokens\n mapping(address => uint256) public isWhitelistedToken;\n\n /// @notice Maps an address to its nonce for creating a distribution\n mapping(address => uint256) public nonces;\n\n /// @notice Maps an address to the last valid hash signed\n mapping(address => bytes32) public userSignatures;\n\n /// @notice Maps a user to whether it is whitelisted for not signing\n mapping(address => uint256) public userSignatureWhitelist;\n\n /// @notice Maps a token to the minimum amount that must be sent per epoch for a distribution to be valid\n /// @dev If `rewardTokenMinAmounts[token] == 0`, then `token` cannot be used as a reward\n mapping(address => uint256) public rewardTokenMinAmounts;\n\n /// @notice List of all reward tokens that have at some point been accepted\n address[] public rewardTokens;\n\n uint256[36] private __gap;\n\n // =================================== EVENTS ==================================\n\n event DistributorUpdated(address indexed _distributor);\n event FeeRebateUpdated(address indexed user, uint256 userFeeRebate);\n event FeeRecipientUpdated(address indexed _feeRecipient);\n event FeesSet(uint256 _fees);\n event MessageUpdated(bytes32 _messageHash);\n event NewDistribution(DistributionParameters distribution, address indexed sender);\n event RewardTokenMinimumAmountUpdated(address indexed token, uint256 amount);\n event TokenWhitelistToggled(address indexed token, uint256 toggleStatus);\n event UserSigned(bytes32 messageHash, address indexed user);\n event UserSigningWhitelistToggled(address indexed user, uint256 toggleStatus);\n\n // ================================= MODIFIERS =================================\n\n /// @notice Checks whether the `msg.sender` has the governor role or the guardian role\n modifier onlyGovernorOrGuardian() {\n if (!core.isGovernorOrGuardian(msg.sender)) revert NotGovernorOrGuardian();\n _;\n }\n\n /// @notice Checks whether an address has signed the message or not\n modifier hasSigned() {\n if (\n userSignatureWhitelist[msg.sender] == 0 &&\n userSignatures[msg.sender] != messageHash &&\n userSignatureWhitelist[tx.origin] == 0 &&\n userSignatures[tx.origin] != messageHash\n ) revert NotSigned();\n _;\n }\n\n // ================================ CONSTRUCTOR ================================\n\n function initialize(ICore _core, address _distributor, uint256 _fees) external initializer {\n if (address(_core) == address(0) || _distributor == address(0)) revert ZeroAddress();\n if (_fees >= BASE_9) revert InvalidParam();\n distributor = _distributor;\n core = _core;\n fees = _fees;\n }\n\n constructor() initializer {}\n\n /// @inheritdoc UUPSUpgradeable\n function _authorizeUpgrade(address) internal view override onlyGuardianUpgrader(core) {}\n\n // ============================== DEPOSIT FUNCTION =============================\n\n /// @notice Creates a `distribution` to incentivize a given pool for a specific period of time\n /// @return distributionAmount How many reward tokens are actually taken into consideration in the contract\n /// @dev If the address specified as a UniV3 pool is not effectively a pool, it will not be handled by the\n /// distribution script and rewards may be lost\n /// @dev Reward tokens sent as part of distributions must have been whitelisted before and amounts\n /// sent should be bigger than a minimum amount specific to each token\n /// @dev The `positionWrappers` specified in the `distribution` struct need to be supported by the script\n /// List of supported `positionWrappers` can be found in the docs.\n /// @dev If the pool incentivized contains one whitelisted token, then no fees are taken on the rewards\n /// @dev This function reverts if the sender has not signed the message `messageHash` once through one of\n /// the functions enabling to sign\n function createDistribution(\n DistributionParameters memory distribution\n ) external hasSigned returns (uint256 distributionAmount) {\n return _createDistribution(distribution);\n }\n\n /// @notice Same as the function above but for multiple distributions at once\n /// @return List of all the distribution amounts actually deposited for each `distribution` in the `distributions` list\n function createDistributions(\n DistributionParameters[] memory distributions\n ) external hasSigned returns (uint256[] memory) {\n uint256 distributionsLength = distributions.length;\n uint256[] memory distributionAmounts = new uint256[](distributionsLength);\n for (uint256 i; i < distributionsLength; ) {\n distributionAmounts[i] = _createDistribution(distributions[i]);\n unchecked {\n ++i;\n }\n }\n return distributionAmounts;\n }\n\n /// @notice Checks whether the `msg.sender`'s `signature` is compatible with the message\n /// to sign and stores the signature\n /// @dev If you signed the message once, and the message has not been modified, then you do not\n /// need to sign again\n function sign(bytes calldata signature) external {\n _sign(signature);\n }\n\n /// @notice Combines signing the message and creating a distribution\n function signAndCreateDistribution(\n DistributionParameters memory distribution,\n bytes calldata signature\n ) external returns (uint256 distributionAmount) {\n _sign(signature);\n return _createDistribution(distribution);\n }\n\n /// @notice Internal version of `createDistribution`\n function _createDistribution(\n DistributionParameters memory distribution\n ) internal nonReentrant returns (uint256 distributionAmount) {\n uint32 epochStart = _getRoundedEpoch(distribution.epochStart);\n uint256 minDistributionAmount = rewardTokenMinAmounts[distribution.rewardToken];\n distribution.epochStart = epochStart;\n // Reward are not accepted in the following conditions:\n if (\n // if epoch parameters lead to a past distribution\n epochStart + EPOCH_DURATION < block.timestamp ||\n // if the amount of epochs for which this distribution should last is zero\n distribution.numEpoch == 0 ||\n // if the distribution parameters are not correctly specified\n distribution.propFees + distribution.propToken0 + distribution.propToken1 != 1e4 ||\n // if boosted addresses get less than non-boosted addresses in case of\n (distribution.boostingAddress != address(0) && distribution.boostedReward < 1e4) ||\n // if the type of the position wrappers is not well specified\n distribution.positionWrappers.length != distribution.wrapperTypes.length ||\n // if the reward token is not whitelisted as an incentive token\n minDistributionAmount == 0 ||\n // if the amount distributed is too small with respect to what is allowed\n distribution.amount / distribution.numEpoch < minDistributionAmount\n ) revert InvalidReward();\n distributionAmount = distribution.amount;\n // Computing fees: these are waived for whitelisted addresses and if there is a whitelisted token in a pool\n uint256 userFeeRebate = feeRebate[msg.sender];\n if (\n userFeeRebate < BASE_9 &&\n // Algebra pools also have these `token0` and `token1` parameters\n isWhitelistedToken[IUniswapV3Pool(distribution.uniV3Pool).token0()] == 0 &&\n isWhitelistedToken[IUniswapV3Pool(distribution.uniV3Pool).token1()] == 0\n ) {\n uint256 _fees = (fees * (BASE_9 - userFeeRebate)) / BASE_9;\n uint256 distributionAmountMinusFees = (distributionAmount * (BASE_9 - _fees)) / BASE_9;\n address _feeRecipient = feeRecipient;\n _feeRecipient = _feeRecipient == address(0) ? address(this) : _feeRecipient;\n IERC20(distribution.rewardToken).safeTransferFrom(\n msg.sender,\n _feeRecipient,\n distributionAmount - distributionAmountMinusFees\n );\n distributionAmount = distributionAmountMinusFees;\n distribution.amount = distributionAmount;\n }\n\n IERC20(distribution.rewardToken).safeTransferFrom(msg.sender, distributor, distributionAmount);\n uint256 senderNonce = nonces[msg.sender];\n nonces[msg.sender] = senderNonce + 1;\n distribution.rewardId = bytes32(keccak256(abi.encodePacked(msg.sender, senderNonce)));\n distributionList.push(distribution);\n emit NewDistribution(distribution, msg.sender);\n }\n\n /// @notice Internal version of the `sign` function\n function _sign(bytes calldata signature) internal {\n bytes32 _messageHash = messageHash;\n if (ECDSA.recover(_messageHash, signature) != msg.sender) revert InvalidSignature();\n userSignatures[msg.sender] = _messageHash;\n emit UserSigned(_messageHash, msg.sender);\n }\n\n // ================================= UI HELPERS ================================\n // These functions are not to be queried on-chain and hence are not optimized for gas consumption\n\n /// @notice Returns the list of all distributions ever made or to be done in the future\n function getAllDistributions() external view returns (DistributionParameters[] memory) {\n return distributionList;\n }\n\n /// @notice Returns the list of all currently active distributions on pools of supported AMMs (like Uniswap V3)\n function getActiveDistributions()\n external\n view\n returns (ExtensiveDistributionParameters[] memory searchDistributions)\n {\n uint32 roundedEpoch = _getRoundedEpoch(uint32(block.timestamp));\n (searchDistributions, ) = _getPoolDistributionsBetweenEpochs(\n address(0),\n roundedEpoch,\n roundedEpoch + EPOCH_DURATION,\n 0,\n type(uint32).max\n );\n }\n\n /// @notice Similar to `getActiveDistributions()` with additional parameters to prevent out of gas error\n /// @param skip Disregard distibutions with a global index lower than `skip`\n /// @param first Limit the length of the returned array to `first`\n /// @return searchDistributions Eligible distributions\n /// @return lastIndexDistribution Index of the last distribution assessed in the list of all distributions\n /// For pagniation purpose, in case of out of gas, you can call back the same function but with `skip` set to `lastIndexDistribution`\n function getActiveDistributions(\n uint32 skip,\n uint32 first\n )\n external\n view\n returns (ExtensiveDistributionParameters[] memory searchDistributions, uint256 lastIndexDistribution)\n {\n uint32 roundedEpoch = _getRoundedEpoch(uint32(block.timestamp));\n return _getPoolDistributionsBetweenEpochs(address(0), roundedEpoch, roundedEpoch + EPOCH_DURATION, skip, first);\n }\n\n /// @notice Returns the list of all the reward tokens supported as well as their minimum amounts\n function getValidRewardTokens() external view returns (RewardTokenAmounts[] memory) {\n uint256 length;\n uint256 rewardTokenListLength = rewardTokens.length;\n RewardTokenAmounts[] memory validRewardTokens = new RewardTokenAmounts[](rewardTokenListLength);\n for (uint32 i; i < rewardTokenListLength; ) {\n address token = rewardTokens[i];\n uint256 minAmount = rewardTokenMinAmounts[token];\n if (minAmount > 0) {\n validRewardTokens[length] = RewardTokenAmounts(token, minAmount);\n length += 1;\n }\n unchecked {\n ++i;\n }\n }\n assembly {\n mstore(validRewardTokens, length)\n }\n return validRewardTokens;\n }\n\n /// @notice Returns the list of all the distributions that were or that are going to be live at\n /// a specific epoch\n function getDistributionsForEpoch(\n uint32 epoch\n ) external view returns (ExtensiveDistributionParameters[] memory searchDistributions) {\n uint32 roundedEpoch = _getRoundedEpoch(epoch);\n (searchDistributions, ) = _getPoolDistributionsBetweenEpochs(\n address(0),\n roundedEpoch,\n roundedEpoch + EPOCH_DURATION,\n 0,\n type(uint32).max\n );\n }\n\n /// @notice Similar to `getDistributionsForEpoch(uint256 epoch)` with additional parameters to prevent out of gas error\n /// @param skip Disregard distibutions with a global index lower than `skip`\n /// @param first Limit the length of the returned array to `first`\n /// @return searchDistributions Eligible distributions\n /// @return lastIndexDistribution Index of the last distribution assessed in the list of all distributions\n /// For pagniation purpose, in case of out of gas, you can call back the same function but with `skip` set to `lastIndexDistribution`\n function getDistributionsForEpoch(\n uint32 epoch,\n uint32 skip,\n uint32 first\n ) external view returns (ExtensiveDistributionParameters[] memory, uint256 lastIndexDistribution) {\n uint32 roundedEpoch = _getRoundedEpoch(epoch);\n return _getPoolDistributionsBetweenEpochs(address(0), roundedEpoch, roundedEpoch + EPOCH_DURATION, skip, first);\n }\n\n /// @notice Gets the distributions that were or will be live at some point between `epochStart` (included) and `epochEnd` (excluded)\n /// @dev If a distribution starts during `epochEnd`, it is not be returned by this function\n /// @dev Conversely, if a distribution starts after `epochStart` and ends before `epochEnd`, it is returned by this function\n function getDistributionsBetweenEpochs(\n uint32 epochStart,\n uint32 epochEnd\n ) external view returns (ExtensiveDistributionParameters[] memory searchDistributions) {\n (searchDistributions, ) = _getPoolDistributionsBetweenEpochs(\n address(0),\n _getRoundedEpoch(epochStart),\n _getRoundedEpoch(epochEnd),\n 0,\n type(uint32).max\n );\n }\n\n /// @notice Similar to `getDistributionsBetweenEpochs(uint256 epochStart, uint256 epochEnd)` with additional parameters to prevent out of gas error\n /// @param skip Disregard distibutions with a global index lower than `skip`\n /// @param first Limit the length of the returned array to `first`\n /// @return searchDistributions Eligible distributions\n /// @return lastIndexDistribution Index of the last distribution assessed in the list of all distributions\n /// For pagniation purpose, in case of out of gas, you can call back the same function but with `skip` set to `lastIndexDistribution`\n function getDistributionsBetweenEpochs(\n uint32 epochStart,\n uint32 epochEnd,\n uint32 skip,\n uint32 first\n ) external view returns (ExtensiveDistributionParameters[] memory, uint256 lastIndexDistribution) {\n return\n _getPoolDistributionsBetweenEpochs(\n address(0),\n _getRoundedEpoch(epochStart),\n _getRoundedEpoch(epochEnd),\n skip,\n first\n );\n }\n\n /// @notice Returns the list of all distributions that were or will be live after `epochStart` (included)\n function getDistributionsAfterEpoch(\n uint32 epochStart\n ) external view returns (ExtensiveDistributionParameters[] memory searchDistributions) {\n (searchDistributions, ) = _getPoolDistributionsBetweenEpochs(\n address(0),\n _getRoundedEpoch(epochStart),\n type(uint32).max,\n 0,\n type(uint32).max\n );\n }\n\n /// @notice Similar to `getDistributionsAfterEpoch(uint256 epochStart)` with additional parameters to prevent out of gas error\n /// @param skip Disregard distibutions with a global index lower than `skip`\n /// @param first Limit the length of the returned array to `first`\n /// @return searchDistributions Eligible distributions\n /// @return lastIndexDistribution Index of the last distribution assessed in the list of all distributions\n /// For pagniation purpose, in case of out of gas, you can call back the same function but with `skip` set to `lastIndexDistribution`\n function getDistributionsAfterEpoch(\n uint32 epochStart,\n uint32 skip,\n uint32 first\n ) external view returns (ExtensiveDistributionParameters[] memory, uint256 lastIndexDistribution) {\n return\n _getPoolDistributionsBetweenEpochs(address(0), _getRoundedEpoch(epochStart), type(uint32).max, skip, first);\n }\n\n /// @notice Returns the list of all currently active distributions for a specific UniswapV3 pool\n function getActivePoolDistributions(\n address uniV3Pool\n ) external view returns (ExtensiveDistributionParameters[] memory searchDistributions) {\n uint32 roundedEpoch = _getRoundedEpoch(uint32(block.timestamp));\n (searchDistributions, ) = _getPoolDistributionsBetweenEpochs(\n uniV3Pool,\n roundedEpoch,\n roundedEpoch + EPOCH_DURATION,\n 0,\n type(uint32).max\n );\n }\n\n /// @notice Similar to `getActivePoolDistributions(address uniV3Pool)` with additional parameters to prevent out of gas error\n /// @param skip Disregard distibutions with a global index lower than `skip`\n /// @param first Limit the length of the returned array to `first`\n /// @return searchDistributions Eligible distributions\n /// @return lastIndexDistribution Index of the last distribution assessed in the list of all distributions\n /// For pagniation purpose, in case of out of gas, you can call back the same function but with `skip` set to `lastIndexDistribution`\n function getActivePoolDistributions(\n address uniV3Pool,\n uint32 skip,\n uint32 first\n ) external view returns (ExtensiveDistributionParameters[] memory, uint256 lastIndexDistribution) {\n uint32 roundedEpoch = _getRoundedEpoch(uint32(block.timestamp));\n return _getPoolDistributionsBetweenEpochs(uniV3Pool, roundedEpoch, roundedEpoch + EPOCH_DURATION, skip, first);\n }\n\n /// @notice Returns the list of all the distributions that were or that are going to be live at a\n /// specific epoch and for a specific pool\n function getPoolDistributionsForEpoch(\n address uniV3Pool,\n uint32 epoch\n ) external view returns (ExtensiveDistributionParameters[] memory searchDistributions) {\n uint32 roundedEpoch = _getRoundedEpoch(epoch);\n (searchDistributions, ) = _getPoolDistributionsBetweenEpochs(\n uniV3Pool,\n roundedEpoch,\n roundedEpoch + EPOCH_DURATION,\n 0,\n type(uint32).max\n );\n }\n\n /// @notice Similar to `getPoolDistributionsForEpoch(address uniV3Pool,uint32 epoch)` with additional parameters to prevent out of gas error\n /// @param skip Disregard distibutions with a global index lower than `skip`\n /// @param first Limit the length of the returned array to `first`\n /// @return searchDistributions Eligible distributions\n /// @return lastIndexDistribution Index of the last distribution assessed in the list of all distributions\n /// For pagniation purpose, in case of out of gas, you can call back the same function but with `skip` set to `lastIndexDistribution`\n function getPoolDistributionsForEpoch(\n address uniV3Pool,\n uint32 epoch,\n uint32 skip,\n uint32 first\n ) external view returns (ExtensiveDistributionParameters[] memory, uint256 lastIndexDistribution) {\n uint32 roundedEpoch = _getRoundedEpoch(epoch);\n return _getPoolDistributionsBetweenEpochs(uniV3Pool, roundedEpoch, roundedEpoch + EPOCH_DURATION, skip, first);\n }\n\n /// @notice Returns the list of all distributions that were or will be live at some point between\n /// `epochStart` (included) and `epochEnd` (excluded) for a specific pool\n function getPoolDistributionsBetweenEpochs(\n address uniV3Pool,\n uint32 epochStart,\n uint32 epochEnd\n ) external view returns (ExtensiveDistributionParameters[] memory searchDistributions) {\n (searchDistributions, ) = _getPoolDistributionsBetweenEpochs(\n uniV3Pool,\n _getRoundedEpoch(epochStart),\n _getRoundedEpoch(epochEnd),\n 0,\n type(uint32).max\n );\n }\n\n /// @notice Similar to `getPoolDistributionsBetweenEpochs(address uniV3Pool,uint32 epochStart, uint32 epochEnd)` with additional parameters to prevent out of gas error\n /// @param skip Disregard distibutions with a global index lower than `skip`\n /// @param first Limit the length of the returned array to `first`\n /// @return searchDistributions Eligible distributions\n /// @return lastIndexDistribution Index of the last distribution assessed in the list of all distributions\n /// For pagniation purpose, in case of out of gas, you can call back the same function but with `skip` set to `lastIndexDistribution`\n function getPoolDistributionsBetweenEpochs(\n address uniV3Pool,\n uint32 epochStart,\n uint32 epochEnd,\n uint32 skip,\n uint32 first\n ) external view returns (ExtensiveDistributionParameters[] memory, uint256 lastIndexDistribution) {\n return\n _getPoolDistributionsBetweenEpochs(\n uniV3Pool,\n _getRoundedEpoch(epochStart),\n _getRoundedEpoch(epochEnd),\n skip,\n first\n );\n }\n\n /// @notice Returns the list of all distributions that were or will be live after `epochStart` (included)\n /// for a specific pool\n function getPoolDistributionsAfterEpoch(\n address uniV3Pool,\n uint32 epochStart\n ) external view returns (ExtensiveDistributionParameters[] memory searchDistributions) {\n (searchDistributions, ) = _getPoolDistributionsBetweenEpochs(\n uniV3Pool,\n _getRoundedEpoch(epochStart),\n type(uint32).max,\n 0,\n type(uint32).max\n );\n }\n\n /// @notice Similar to `getPoolDistributionsAfterEpoch(address uniV3Pool,uint32 epochStart)` with additional parameters to prevent out of gas error\n /// @param skip Disregard distibutions with a global index lower than `skip`\n /// @param first Limit the length of the returned array to `first`\n /// @return searchDistributions Eligible distributions\n /// @return lastIndexDistribution Index of the last distribution assessed in the list of all distributions\n /// For pagniation purpose, in case of out of gas, you can call back the same function but with `skip` set to `lastIndexDistribution`\n function getPoolDistributionsAfterEpoch(\n address uniV3Pool,\n uint32 epochStart,\n uint32 skip,\n uint32 first\n ) external view returns (ExtensiveDistributionParameters[] memory, uint256 lastIndexDistribution) {\n return\n _getPoolDistributionsBetweenEpochs(uniV3Pool, _getRoundedEpoch(epochStart), type(uint32).max, skip, first);\n }\n\n // ============================ GOVERNANCE FUNCTIONS ===========================\n\n /// @notice Sets a new `distributor` to which rewards should be distributed\n function setNewDistributor(address _distributor) external onlyGovernorOrGuardian {\n if (_distributor == address(0)) revert InvalidParam();\n distributor = _distributor;\n emit DistributorUpdated(_distributor);\n }\n\n /// @notice Sets the fees on deposit\n function setFees(uint256 _fees) external onlyGovernorOrGuardian {\n if (_fees >= BASE_9) revert InvalidParam();\n fees = _fees;\n emit FeesSet(_fees);\n }\n\n /// @notice Sets fee rebates for a given user\n function setUserFeeRebate(address user, uint256 userFeeRebate) external onlyGovernorOrGuardian {\n feeRebate[user] = userFeeRebate;\n emit FeeRebateUpdated(user, userFeeRebate);\n }\n\n /// @notice Toggles the fee whitelist for `token`\n function toggleTokenWhitelist(address token) external onlyGovernorOrGuardian {\n uint256 toggleStatus = 1 - isWhitelistedToken[token];\n isWhitelistedToken[token] = toggleStatus;\n emit TokenWhitelistToggled(token, toggleStatus);\n }\n\n /// @notice Recovers fees accrued on the contract for a list of `tokens`\n function recoverFees(IERC20[] calldata tokens, address to) external onlyGovernorOrGuardian {\n uint256 tokensLength = tokens.length;\n for (uint256 i; i < tokensLength; ) {\n tokens[i].safeTransfer(to, tokens[i].balanceOf(address(this)));\n unchecked {\n ++i;\n }\n }\n }\n\n /// @notice Sets the minimum amounts per distribution epoch for different reward tokens\n function setRewardTokenMinAmounts(\n address[] calldata tokens,\n uint256[] calldata amounts\n ) external onlyGovernorOrGuardian {\n uint256 tokensLength = tokens.length;\n if (tokensLength != amounts.length) revert InvalidLengths();\n for (uint256 i; i < tokensLength; ++i) {\n uint256 amount = amounts[i];\n // Basic logic check to make sure there are no duplicates in the `rewardTokens` table. If a token is\n // removed then re-added, it will appear as a duplicate in the list\n if (amount > 0 && rewardTokenMinAmounts[tokens[i]] == 0) rewardTokens.push(tokens[i]);\n rewardTokenMinAmounts[tokens[i]] = amount;\n emit RewardTokenMinimumAmountUpdated(tokens[i], amount);\n }\n }\n\n /// @notice Sets a new address to receive fees\n function setFeeRecipient(address _feeRecipient) external onlyGovernorOrGuardian {\n feeRecipient = _feeRecipient;\n emit FeeRecipientUpdated(_feeRecipient);\n }\n\n /// @notice Sets the message that needs to be signed by users before posting rewards\n function setMessage(string memory _message) external onlyGovernorOrGuardian {\n message = _message;\n bytes32 _messageHash = ECDSA.toEthSignedMessageHash(bytes(_message));\n messageHash = _messageHash;\n emit MessageUpdated(_messageHash);\n }\n\n /// @notice Toggles the whitelist status for `user` when it comes to signing messages before depositing rewards.\n function toggleSigningWhitelist(address user) external onlyGovernorOrGuardian {\n uint256 whitelistStatus = 1 - userSignatureWhitelist[user];\n userSignatureWhitelist[user] = whitelistStatus;\n emit UserSigningWhitelistToggled(user, whitelistStatus);\n }\n\n // ============================== INTERNAL HELPERS =============================\n\n /// @notice Rounds an `epoch` timestamp to the start of the corresponding period\n function _getRoundedEpoch(uint32 epoch) internal pure returns (uint32) {\n return (epoch / EPOCH_DURATION) * EPOCH_DURATION;\n }\n\n /// @notice Checks whether `distribution` was live between `roundedEpochStart` and `roundedEpochEnd`\n function _isDistributionLiveBetweenEpochs(\n DistributionParameters memory distribution,\n uint32 roundedEpochStart,\n uint32 roundedEpochEnd\n ) internal pure returns (bool) {\n uint256 distributionEpochStart = distribution.epochStart;\n return (distributionEpochStart + distribution.numEpoch * EPOCH_DURATION > roundedEpochStart &&\n distributionEpochStart < roundedEpochEnd);\n }\n\n /// @notice Fetches data for `token` on the Uniswap `pool`\n function _getUniswapTokenData(\n IERC20Metadata token,\n address pool\n ) internal view returns (UniswapTokenData memory data) {\n data.add = address(token);\n data.decimals = token.decimals();\n data.symbol = token.symbol();\n data.poolBalance = token.balanceOf(pool);\n }\n\n /// @notice Fetches extra data about the parameters in a distribution\n function getExtensiveDistributionParameters(\n DistributionParameters memory distribution\n ) external view returns (ExtensiveDistributionParameters memory extensiveParams) {\n extensiveParams.base = distribution;\n try IUniswapV3Pool(distribution.uniV3Pool).fee() returns (uint24 fee) {\n extensiveParams.poolFee = fee;\n } catch {\n extensiveParams.poolFee = 0;\n }\n extensiveParams.token0 = _getUniswapTokenData(\n IERC20Metadata(IUniswapV3Pool(distribution.uniV3Pool).token0()),\n distribution.uniV3Pool\n );\n extensiveParams.token1 = _getUniswapTokenData(\n IERC20Metadata(IUniswapV3Pool(distribution.uniV3Pool).token1()),\n distribution.uniV3Pool\n );\n extensiveParams.rewardTokenSymbol = IERC20Metadata(distribution.rewardToken).symbol();\n extensiveParams.rewardTokenDecimals = IERC20Metadata(distribution.rewardToken).decimals();\n }\n\n /// @notice Tries to fetch extra data about the parameters in a distribution\n function tryGetExtensiveDistributionParameters(\n DistributionParameters memory distribution\n ) external returns (bool success, ExtensiveDistributionParameters memory extensiveParams) {\n (bool callSuccess, bytes memory returndata) = address(this).delegatecall(\n abi.encodeWithSelector(DistributionCreator.getExtensiveDistributionParameters.selector, distribution)\n );\n success = callSuccess;\n if (success) {\n extensiveParams = abi.decode(returndata, (ExtensiveDistributionParameters));\n }\n return (success, extensiveParams);\n }\n\n /// @notice Gets the list of all the distributions for `uniV3Pool` that have been active between `epochStart` and `epochEnd` (excluded)\n /// @dev If the `uniV3Pool` parameter is equal to 0, then this function will return the distributions for all pools\n function _getPoolDistributionsBetweenEpochs(\n address uniV3Pool,\n uint32 epochStart,\n uint32 epochEnd,\n uint32 skip,\n uint32 first\n ) internal view returns (ExtensiveDistributionParameters[] memory, uint256) {\n uint256 length;\n uint256 distributionListLength = distributionList.length;\n uint256 returnSize = first > distributionListLength ? distributionListLength : first;\n ExtensiveDistributionParameters[] memory activeRewards = new ExtensiveDistributionParameters[](returnSize);\n uint32 i = skip;\n while (i < distributionListLength) {\n DistributionParameters memory distribution = distributionList[i];\n if (\n _isDistributionLiveBetweenEpochs(distribution, epochStart, epochEnd) &&\n (uniV3Pool == address(0) || distribution.uniV3Pool == uniV3Pool)\n ) {\n (bool success, ExtensiveDistributionParameters memory extensiveParams) = IDistributionCreator(\n address(this)\n ).tryGetExtensiveDistributionParameters(distribution);\n if (success) {\n activeRewards[length] = extensiveParams;\n length += 1;\n }\n }\n unchecked {\n ++i;\n }\n if (length == returnSize) break;\n }\n assembly {\n mstore(activeRewards, length)\n }\n return (activeRewards, i);\n }\n}\n" + }, + "contracts/interfaces/external/uniswap/IUniswapV3Pool.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity >=0.5.0;\n\n/// @title Pool state that never changes\n/// @notice These parameters are fixed for a pool forever, i.e., the methods will always return the same values\ninterface IUniswapV3Pool {\n /// @notice The first of the two tokens of the pool, sorted by address\n /// @return The token contract address\n function token0() external view returns (address);\n\n /// @notice The second of the two tokens of the pool, sorted by address\n /// @return The token contract address\n function token1() external view returns (address);\n\n /// @notice The pool's fee in hundredths of a bip, i.e. 1e-6\n /// @return The fee\n function fee() external view returns (uint24);\n}\n" + }, + "contracts/interfaces/ICore.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\n/// @title ICore\n/// @author Angle Labs, Inc.\n/// @notice Interface for the `Core` contracts of smart contract modules used in Angle Labs contracts\ninterface ICore {\n /// @notice Checks whether an address is governor\n /// @param admin Address to check\n /// @return Whether the address has the `GOVERNOR_ROLE` or not\n function isGovernor(address admin) external view returns (bool);\n\n /// @notice Checks whether an address is a governor or a guardian of a module\n /// @param admin Address to check\n /// @return Whether the address has the `GUARDIAN_ROLE` or not\n /// @dev Governance should make sure when adding a governor to also give this governor the guardian\n /// role by calling the `addGovernor` function\n function isGovernorOrGuardian(address admin) external view returns (bool);\n}\n" + }, + "contracts/struct/DistributionParameters.sol": { + "content": "// SPDX-License-Identifier: BUSL-1.1\n\npragma solidity ^0.8.17;\n\nstruct DistributionParameters {\n // ID of the reward (populated once created)\n bytes32 rewardId;\n // Address of the UniswapV3 pool that needs to be incentivized\n address uniV3Pool;\n // Address of the reward token for the incentives\n address rewardToken;\n // Amount of `rewardToken` to distribute across all the epochs\n // Amount distributed per epoch is `amount/numEpoch`\n uint256 amount;\n // List of all position wrappers to consider or not for this contract. Some wrappers like Gamma or Arrakis\n // are automatically detected and so there is no need to specify them here. Check out the docs to find out\n // which need to be specified and which are not automatically detected.\n address[] positionWrappers;\n // Type (Arrakis, Gamma, Blacklist, ...) encoded as a `uint32` for each wrapper in the list above. Mapping between\n // wrapper types and their corresponding `uint32` value can be found in Angle Docs\n uint32[] wrapperTypes;\n // In the incentivization formula, how much of the fees should go to holders of token0\n // in base 10**4\n uint32 propToken0;\n // Proportion for holding token1 (in base 10**4)\n uint32 propToken1;\n // Proportion for providing a useful liquidity (in base 10**4) that generates fees\n uint32 propFees;\n // Timestamp at which the incentivization should start\n uint32 epochStart;\n // Amount of epochs for which incentivization should last\n uint32 numEpoch;\n // Whether out of range liquidity should still be incentivized or not\n // This should be equal to 1 if out of range liquidity should still be incentivized\n // and 0 otherwise\n uint32 isOutOfRangeIncentivized;\n // How much more addresses with a maximum boost can get with respect to addresses\n // which do not have a boost (in base 4). In the case of Curve where addresses get 2.5x more\n // this would be 25000\n uint32 boostedReward;\n // Address of the token which dictates who gets boosted rewards or not. This is optional\n // and if the zero address is given no boost will be taken into account\n address boostingAddress;\n // Additional data passed when distributing rewards. This parameter may be used in case\n // the reward distribution script needs to look into other parameters beyond the ones above.\n bytes additionalData;\n}\n" + }, + "contracts/struct/ExtensiveDistributionParameters.sol": { + "content": "// SPDX-License-Identifier: BUSL-1.1\n\npragma solidity ^0.8.17;\n\nimport { DistributionParameters } from \"./DistributionParameters.sol\";\n\nstruct UniswapTokenData {\n address add;\n uint8 decimals;\n string symbol;\n uint256 poolBalance;\n}\n\nstruct ExtensiveDistributionParameters {\n DistributionParameters base;\n // Uniswap pool data\n uint24 poolFee;\n UniswapTokenData token0;\n UniswapTokenData token1;\n // rewardToken data\n string rewardTokenSymbol;\n uint8 rewardTokenDecimals;\n}\n" + }, + "contracts/struct/RewardTokenAmounts.sol": { + "content": "// SPDX-License-Identifier: BUSL-1.1\n\npragma solidity ^0.8.17;\n\nstruct RewardTokenAmounts {\n address token;\n uint256 minimumAmountPerEpoch;\n}\n" + }, + "contracts/utils/Errors.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nerror InvalidDispute();\nerror InvalidLengths();\nerror InvalidParam();\nerror InvalidParams();\nerror InvalidProof();\nerror InvalidUninitializedRoot();\nerror InvalidReward();\nerror InvalidSignature();\nerror NoDispute();\nerror NotGovernor();\nerror NotGovernorOrGuardian();\nerror NotSigned();\nerror NotTrusted();\nerror NotWhitelisted();\nerror UnresolvedDispute();\nerror ZeroAddress();\n" + }, + "contracts/utils/UUPSHelper.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\n/*\n * █ \n ***** ▓▓▓ \n * ▓▓▓▓▓▓▓ \n * ///. ▓▓▓▓▓▓▓▓▓▓▓▓▓ \n ***** //////// ▓▓▓▓▓▓▓ \n * ///////////// ▓▓▓ \n ▓▓ ////////////////// █ ▓▓ \n ▓▓ ▓▓ /////////////////////// ▓▓ ▓▓ \n ▓▓ ▓▓ //////////////////////////// ▓▓ ▓▓ \n ▓▓ ▓▓ /////////▓▓▓///////▓▓▓///////// ▓▓ ▓▓ \n ▓▓ ,////////////////////////////////////// ▓▓ ▓▓ \n ▓▓ ////////////////////////////////////////// ▓▓ \n ▓▓ //////////////////////▓▓▓▓///////////////////// \n ,//////////////////////////////////////////////////// \n .////////////////////////////////////////////////////////// \n .//////////////////////////██.,//////////////////////////█ \n .//////////////////////████..,./////////////////////██ \n ...////////////////███████.....,.////////////////███ \n ,.,////////////████████ ........,///////////████ \n .,.,//////█████████ ,.......///////████ \n ,..//████████ ........./████ \n ..,██████ .....,███ \n .██ ,.,█ \n \n \n \n ▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓ ▓▓▓▓▓▓▓▓▓▓ \n ▓▓▓▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓ ▓▓ ▓▓▓▓ \n ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓ ▓▓▓▓▓ \n ▓▓▓ ▓▓ ▓▓▓ ▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ \n*/\n\npragma solidity ^0.8.17;\n\nimport { UUPSUpgradeable } from \"@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol\";\n\nimport { ICore } from \"../interfaces/ICore.sol\";\nimport \"../utils/Errors.sol\";\n\n/// @title UUPSHelper\n/// @notice Helper contract for UUPSUpgradeable contracts where the upgradeability is controlled by a specific address\n/// @author Angle Labs., Inc\n/// @dev The 0 address check in the modifier allows the use of these modifiers during initialization\nabstract contract UUPSHelper is UUPSUpgradeable {\n modifier onlyGuardianUpgrader(ICore _core) {\n if (address(_core) != address(0) && !_core.isGovernorOrGuardian(msg.sender)) revert NotGovernorOrGuardian();\n _;\n }\n\n modifier onlyGovernorUpgrader(ICore _core) {\n if (address(_core) != address(0) && !_core.isGovernor(msg.sender)) revert NotGovernor();\n _;\n }\n\n constructor() initializer {}\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 100 + }, + "viaIR": false, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata" + ], + "": [ + "ast" + ] + } + } + } +} \ No newline at end of file diff --git a/deployments/filecoin/solcInputs/e77f17fbb4334e4df730b35bdfde2517.json b/deployments/filecoin/solcInputs/e77f17fbb4334e4df730b35bdfde2517.json new file mode 100644 index 0000000..00dbd19 --- /dev/null +++ b/deployments/filecoin/solcInputs/e77f17fbb4334e4df730b35bdfde2517.json @@ -0,0 +1,213 @@ +{ + "language": "Solidity", + "sources": { + "@openzeppelin/contracts-upgradeable/interfaces/draft-IERC1822Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\n * proxy whose upgrades are fully controlled by the current implementation.\n */\ninterface IERC1822ProxiableUpgradeable {\n /**\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\n * address.\n *\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\n * function revert if invoked through a proxy.\n */\n function proxiableUUID() external view returns (bytes32);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/proxy/beacon/IBeaconUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\n */\ninterface IBeaconUpgradeable {\n /**\n * @dev Must return an address that can be used as a delegate call target.\n *\n * {BeaconProxy} will check that this address is a contract.\n */\n function implementation() external view returns (address);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/proxy/ERC1967/ERC1967UpgradeUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (proxy/ERC1967/ERC1967Upgrade.sol)\n\npragma solidity ^0.8.2;\n\nimport \"../beacon/IBeaconUpgradeable.sol\";\nimport \"../../interfaces/draft-IERC1822Upgradeable.sol\";\nimport \"../../utils/AddressUpgradeable.sol\";\nimport \"../../utils/StorageSlotUpgradeable.sol\";\nimport \"../utils/Initializable.sol\";\n\n/**\n * @dev This abstract contract provides getters and event emitting update functions for\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\n *\n * _Available since v4.1._\n *\n * @custom:oz-upgrades-unsafe-allow delegatecall\n */\nabstract contract ERC1967UpgradeUpgradeable is Initializable {\n function __ERC1967Upgrade_init() internal onlyInitializing {\n }\n\n function __ERC1967Upgrade_init_unchained() internal onlyInitializing {\n }\n // This is the keccak-256 hash of \"eip1967.proxy.rollback\" subtracted by 1\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\n\n /**\n * @dev Storage slot with the address of the current implementation.\n * This is the keccak-256 hash of \"eip1967.proxy.implementation\" subtracted by 1, and is\n * validated in the constructor.\n */\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n\n /**\n * @dev Emitted when the implementation is upgraded.\n */\n event Upgraded(address indexed implementation);\n\n /**\n * @dev Returns the current implementation address.\n */\n function _getImplementation() internal view returns (address) {\n return StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value;\n }\n\n /**\n * @dev Stores a new address in the EIP1967 implementation slot.\n */\n function _setImplementation(address newImplementation) private {\n require(AddressUpgradeable.isContract(newImplementation), \"ERC1967: new implementation is not a contract\");\n StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\n }\n\n /**\n * @dev Perform implementation upgrade\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeTo(address newImplementation) internal {\n _setImplementation(newImplementation);\n emit Upgraded(newImplementation);\n }\n\n /**\n * @dev Perform implementation upgrade with additional setup call.\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeToAndCall(\n address newImplementation,\n bytes memory data,\n bool forceCall\n ) internal {\n _upgradeTo(newImplementation);\n if (data.length > 0 || forceCall) {\n _functionDelegateCall(newImplementation, data);\n }\n }\n\n /**\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeToAndCallUUPS(\n address newImplementation,\n bytes memory data,\n bool forceCall\n ) internal {\n // Upgrades from old implementations will perform a rollback test. This test requires the new\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\n // this special case will break upgrade paths from old UUPS implementation to new ones.\n if (StorageSlotUpgradeable.getBooleanSlot(_ROLLBACK_SLOT).value) {\n _setImplementation(newImplementation);\n } else {\n try IERC1822ProxiableUpgradeable(newImplementation).proxiableUUID() returns (bytes32 slot) {\n require(slot == _IMPLEMENTATION_SLOT, \"ERC1967Upgrade: unsupported proxiableUUID\");\n } catch {\n revert(\"ERC1967Upgrade: new implementation is not UUPS\");\n }\n _upgradeToAndCall(newImplementation, data, forceCall);\n }\n }\n\n /**\n * @dev Storage slot with the admin of the contract.\n * This is the keccak-256 hash of \"eip1967.proxy.admin\" subtracted by 1, and is\n * validated in the constructor.\n */\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\n\n /**\n * @dev Emitted when the admin account has changed.\n */\n event AdminChanged(address previousAdmin, address newAdmin);\n\n /**\n * @dev Returns the current admin.\n */\n function _getAdmin() internal view returns (address) {\n return StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value;\n }\n\n /**\n * @dev Stores a new address in the EIP1967 admin slot.\n */\n function _setAdmin(address newAdmin) private {\n require(newAdmin != address(0), \"ERC1967: new admin is the zero address\");\n StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\n }\n\n /**\n * @dev Changes the admin of the proxy.\n *\n * Emits an {AdminChanged} event.\n */\n function _changeAdmin(address newAdmin) internal {\n emit AdminChanged(_getAdmin(), newAdmin);\n _setAdmin(newAdmin);\n }\n\n /**\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\n */\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\n\n /**\n * @dev Emitted when the beacon is upgraded.\n */\n event BeaconUpgraded(address indexed beacon);\n\n /**\n * @dev Returns the current beacon.\n */\n function _getBeacon() internal view returns (address) {\n return StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value;\n }\n\n /**\n * @dev Stores a new beacon in the EIP1967 beacon slot.\n */\n function _setBeacon(address newBeacon) private {\n require(AddressUpgradeable.isContract(newBeacon), \"ERC1967: new beacon is not a contract\");\n require(\n AddressUpgradeable.isContract(IBeaconUpgradeable(newBeacon).implementation()),\n \"ERC1967: beacon implementation is not a contract\"\n );\n StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value = newBeacon;\n }\n\n /**\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\n *\n * Emits a {BeaconUpgraded} event.\n */\n function _upgradeBeaconToAndCall(\n address newBeacon,\n bytes memory data,\n bool forceCall\n ) internal {\n _setBeacon(newBeacon);\n emit BeaconUpgraded(newBeacon);\n if (data.length > 0 || forceCall) {\n _functionDelegateCall(IBeaconUpgradeable(newBeacon).implementation(), data);\n }\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function _functionDelegateCall(address target, bytes memory data) private returns (bytes memory) {\n require(AddressUpgradeable.isContract(target), \"Address: delegate call to non-contract\");\n\n // solhint-disable-next-line avoid-low-level-calls\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return AddressUpgradeable.verifyCallResult(success, returndata, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.1) (proxy/utils/Initializable.sol)\n\npragma solidity ^0.8.2;\n\nimport \"../../utils/AddressUpgradeable.sol\";\n\n/**\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\n *\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\n * reused. This mechanism prevents re-execution of each \"step\" but allows the creation of new initialization steps in\n * case an upgrade adds a module that needs to be initialized.\n *\n * For example:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * contract MyToken is ERC20Upgradeable {\n * function initialize() initializer public {\n * __ERC20_init(\"MyToken\", \"MTK\");\n * }\n * }\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\n * function initializeV2() reinitializer(2) public {\n * __ERC20Permit_init(\"MyToken\");\n * }\n * }\n * ```\n *\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\n *\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\n *\n * [CAUTION]\n * ====\n * Avoid leaving a contract uninitialized.\n *\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * /// @custom:oz-upgrades-unsafe-allow constructor\n * constructor() {\n * _disableInitializers();\n * }\n * ```\n * ====\n */\nabstract contract Initializable {\n /**\n * @dev Indicates that the contract has been initialized.\n * @custom:oz-retyped-from bool\n */\n uint8 private _initialized;\n\n /**\n * @dev Indicates that the contract is in the process of being initialized.\n */\n bool private _initializing;\n\n /**\n * @dev Triggered when the contract has been initialized or reinitialized.\n */\n event Initialized(uint8 version);\n\n /**\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\n * `onlyInitializing` functions can be used to initialize parent contracts.\n *\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\n * constructor.\n *\n * Emits an {Initialized} event.\n */\n modifier initializer() {\n bool isTopLevelCall = !_initializing;\n require(\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\n \"Initializable: contract is already initialized\"\n );\n _initialized = 1;\n if (isTopLevelCall) {\n _initializing = true;\n }\n _;\n if (isTopLevelCall) {\n _initializing = false;\n emit Initialized(1);\n }\n }\n\n /**\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\n * used to initialize parent contracts.\n *\n * A reinitializer may be used after the original initialization step. This is essential to configure modules that\n * are added through upgrades and that require initialization.\n *\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\n * cannot be nested. If one is invoked in the context of another, execution will revert.\n *\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\n * a contract, executing them in the right order is up to the developer or operator.\n *\n * WARNING: setting the version to 255 will prevent any future reinitialization.\n *\n * Emits an {Initialized} event.\n */\n modifier reinitializer(uint8 version) {\n require(!_initializing && _initialized < version, \"Initializable: contract is already initialized\");\n _initialized = version;\n _initializing = true;\n _;\n _initializing = false;\n emit Initialized(version);\n }\n\n /**\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\n */\n modifier onlyInitializing() {\n require(_initializing, \"Initializable: contract is not initializing\");\n _;\n }\n\n /**\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\n * through proxies.\n *\n * Emits an {Initialized} event the first time it is successfully executed.\n */\n function _disableInitializers() internal virtual {\n require(!_initializing, \"Initializable: contract is initializing\");\n if (_initialized < type(uint8).max) {\n _initialized = type(uint8).max;\n emit Initialized(type(uint8).max);\n }\n }\n\n /**\n * @dev Returns the highest version that has been initialized. See {reinitializer}.\n */\n function _getInitializedVersion() internal view returns (uint8) {\n return _initialized;\n }\n\n /**\n * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.\n */\n function _isInitializing() internal view returns (bool) {\n return _initializing;\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (proxy/utils/UUPSUpgradeable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../interfaces/draft-IERC1822Upgradeable.sol\";\nimport \"../ERC1967/ERC1967UpgradeUpgradeable.sol\";\nimport \"./Initializable.sol\";\n\n/**\n * @dev An upgradeability mechanism designed for UUPS proxies. The functions included here can perform an upgrade of an\n * {ERC1967Proxy}, when this contract is set as the implementation behind such a proxy.\n *\n * A security mechanism ensures that an upgrade does not turn off upgradeability accidentally, although this risk is\n * reinstated if the upgrade retains upgradeability but removes the security mechanism, e.g. by replacing\n * `UUPSUpgradeable` with a custom implementation of upgrades.\n *\n * The {_authorizeUpgrade} function must be overridden to include access restriction to the upgrade mechanism.\n *\n * _Available since v4.1._\n */\nabstract contract UUPSUpgradeable is Initializable, IERC1822ProxiableUpgradeable, ERC1967UpgradeUpgradeable {\n function __UUPSUpgradeable_init() internal onlyInitializing {\n }\n\n function __UUPSUpgradeable_init_unchained() internal onlyInitializing {\n }\n /// @custom:oz-upgrades-unsafe-allow state-variable-immutable state-variable-assignment\n address private immutable __self = address(this);\n\n /**\n * @dev Check that the execution is being performed through a delegatecall call and that the execution context is\n * a proxy contract with an implementation (as defined in ERC1967) pointing to self. This should only be the case\n * for UUPS and transparent proxies that are using the current contract as their implementation. Execution of a\n * function through ERC1167 minimal proxies (clones) would not normally pass this test, but is not guaranteed to\n * fail.\n */\n modifier onlyProxy() {\n require(address(this) != __self, \"Function must be called through delegatecall\");\n require(_getImplementation() == __self, \"Function must be called through active proxy\");\n _;\n }\n\n /**\n * @dev Check that the execution is not being performed through a delegate call. This allows a function to be\n * callable on the implementing contract but not through proxies.\n */\n modifier notDelegated() {\n require(address(this) == __self, \"UUPSUpgradeable: must not be called through delegatecall\");\n _;\n }\n\n /**\n * @dev Implementation of the ERC1822 {proxiableUUID} function. This returns the storage slot used by the\n * implementation. It is used to validate the implementation's compatibility when performing an upgrade.\n *\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\n * function revert if invoked through a proxy. This is guaranteed by the `notDelegated` modifier.\n */\n function proxiableUUID() external view virtual override notDelegated returns (bytes32) {\n return _IMPLEMENTATION_SLOT;\n }\n\n /**\n * @dev Upgrade the implementation of the proxy to `newImplementation`.\n *\n * Calls {_authorizeUpgrade}.\n *\n * Emits an {Upgraded} event.\n */\n function upgradeTo(address newImplementation) external virtual onlyProxy {\n _authorizeUpgrade(newImplementation);\n _upgradeToAndCallUUPS(newImplementation, new bytes(0), false);\n }\n\n /**\n * @dev Upgrade the implementation of the proxy to `newImplementation`, and subsequently execute the function call\n * encoded in `data`.\n *\n * Calls {_authorizeUpgrade}.\n *\n * Emits an {Upgraded} event.\n */\n function upgradeToAndCall(address newImplementation, bytes memory data) external payable virtual onlyProxy {\n _authorizeUpgrade(newImplementation);\n _upgradeToAndCallUUPS(newImplementation, data, true);\n }\n\n /**\n * @dev Function that should revert when `msg.sender` is not authorized to upgrade the contract. Called by\n * {upgradeTo} and {upgradeToAndCall}.\n *\n * Normally, this function will use an xref:access.adoc[access control] modifier such as {Ownable-onlyOwner}.\n *\n * ```solidity\n * function _authorizeUpgrade(address) internal override onlyOwner {}\n * ```\n */\n function _authorizeUpgrade(address newImplementation) internal virtual;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (security/ReentrancyGuard.sol)\n\npragma solidity ^0.8.0;\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Contract module that helps prevent reentrant calls to a function.\n *\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\n * available, which can be applied to functions to make sure there are no nested\n * (reentrant) calls to them.\n *\n * Note that because there is a single `nonReentrant` guard, functions marked as\n * `nonReentrant` may not call one another. This can be worked around by making\n * those functions `private`, and then adding `external` `nonReentrant` entry\n * points to them.\n *\n * TIP: If you would like to learn more about reentrancy and alternative ways\n * to protect against it, check out our blog post\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\n */\nabstract contract ReentrancyGuardUpgradeable is Initializable {\n // Booleans are more expensive than uint256 or any type that takes up a full\n // word because each write operation emits an extra SLOAD to first read the\n // slot's contents, replace the bits taken up by the boolean, and then write\n // back. This is the compiler's defense against contract upgrades and\n // pointer aliasing, and it cannot be disabled.\n\n // The values being non-zero value makes deployment a bit more expensive,\n // but in exchange the refund on every call to nonReentrant will be lower in\n // amount. Since refunds are capped to a percentage of the total\n // transaction's gas, it is best to keep them low in cases like this one, to\n // increase the likelihood of the full refund coming into effect.\n uint256 private constant _NOT_ENTERED = 1;\n uint256 private constant _ENTERED = 2;\n\n uint256 private _status;\n\n function __ReentrancyGuard_init() internal onlyInitializing {\n __ReentrancyGuard_init_unchained();\n }\n\n function __ReentrancyGuard_init_unchained() internal onlyInitializing {\n _status = _NOT_ENTERED;\n }\n\n /**\n * @dev Prevents a contract from calling itself, directly or indirectly.\n * Calling a `nonReentrant` function from another `nonReentrant`\n * function is not supported. It is possible to prevent this from happening\n * by making the `nonReentrant` function external, and making it call a\n * `private` function that does the actual work.\n */\n modifier nonReentrant() {\n _nonReentrantBefore();\n _;\n _nonReentrantAfter();\n }\n\n function _nonReentrantBefore() private {\n // On the first call to nonReentrant, _status will be _NOT_ENTERED\n require(_status != _ENTERED, \"ReentrancyGuard: reentrant call\");\n\n // Any calls to nonReentrant after this point will fail\n _status = _ENTERED;\n }\n\n function _nonReentrantAfter() private {\n // By storing the original value once again, a refund is triggered (see\n // https://eips.ethereum.org/EIPS/eip-2200)\n _status = _NOT_ENTERED;\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[49] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20Upgradeable {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary AddressUpgradeable {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/math/MathUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary MathUpgradeable {\n enum Rounding {\n Down, // Toward negative infinity\n Up, // Toward infinity\n Zero // Toward zero\n }\n\n /**\n * @dev Returns the largest of two numbers.\n */\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two numbers.\n */\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two numbers. The result is rounded towards\n * zero.\n */\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b) / 2 can overflow.\n return (a & b) + (a ^ b) / 2;\n }\n\n /**\n * @dev Returns the ceiling of the division of two numbers.\n *\n * This differs from standard division with `/` in that it rounds up instead\n * of rounding down.\n */\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b - 1) / b can overflow on addition, so we distribute.\n return a == 0 ? 0 : (a - 1) / b + 1;\n }\n\n /**\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\n * with further edits by Uniswap Labs also under MIT license.\n */\n function mulDiv(\n uint256 x,\n uint256 y,\n uint256 denominator\n ) internal pure returns (uint256 result) {\n unchecked {\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\n // variables such that product = prod1 * 2^256 + prod0.\n uint256 prod0; // Least significant 256 bits of the product\n uint256 prod1; // Most significant 256 bits of the product\n assembly {\n let mm := mulmod(x, y, not(0))\n prod0 := mul(x, y)\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n }\n\n // Handle non-overflow cases, 256 by 256 division.\n if (prod1 == 0) {\n return prod0 / denominator;\n }\n\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\n require(denominator > prod1);\n\n ///////////////////////////////////////////////\n // 512 by 256 division.\n ///////////////////////////////////////////////\n\n // Make division exact by subtracting the remainder from [prod1 prod0].\n uint256 remainder;\n assembly {\n // Compute remainder using mulmod.\n remainder := mulmod(x, y, denominator)\n\n // Subtract 256 bit number from 512 bit number.\n prod1 := sub(prod1, gt(remainder, prod0))\n prod0 := sub(prod0, remainder)\n }\n\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\n // See https://cs.stackexchange.com/q/138556/92363.\n\n // Does not overflow because the denominator cannot be zero at this stage in the function.\n uint256 twos = denominator & (~denominator + 1);\n assembly {\n // Divide denominator by twos.\n denominator := div(denominator, twos)\n\n // Divide [prod1 prod0] by twos.\n prod0 := div(prod0, twos)\n\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\n twos := add(div(sub(0, twos), twos), 1)\n }\n\n // Shift in bits from prod1 into prod0.\n prod0 |= prod1 * twos;\n\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\n // four bits. That is, denominator * inv = 1 mod 2^4.\n uint256 inverse = (3 * denominator) ^ 2;\n\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\n // in modular arithmetic, doubling the correct bits in each step.\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\n\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\n // is no longer required.\n result = prod0 * inverse;\n return result;\n }\n }\n\n /**\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\n */\n function mulDiv(\n uint256 x,\n uint256 y,\n uint256 denominator,\n Rounding rounding\n ) internal pure returns (uint256) {\n uint256 result = mulDiv(x, y, denominator);\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\n result += 1;\n }\n return result;\n }\n\n /**\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\n *\n * Inspired by Henry S. Warren, Jr.'s \"Hacker's Delight\" (Chapter 11).\n */\n function sqrt(uint256 a) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\n //\n // We know that the \"msb\" (most significant bit) of our target number `a` is a power of 2 such that we have\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\n //\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\n // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\n // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\n //\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\n uint256 result = 1 << (log2(a) >> 1);\n\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\n // into the expected uint128 result.\n unchecked {\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n return min(result, a / result);\n }\n }\n\n /**\n * @notice Calculates sqrt(a), following the selected rounding direction.\n */\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = sqrt(a);\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 2, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 128;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 64;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 32;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 16;\n }\n if (value >> 8 > 0) {\n value >>= 8;\n result += 8;\n }\n if (value >> 4 > 0) {\n value >>= 4;\n result += 4;\n }\n if (value >> 2 > 0) {\n value >>= 2;\n result += 2;\n }\n if (value >> 1 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log2(value);\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 10, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >= 10**64) {\n value /= 10**64;\n result += 64;\n }\n if (value >= 10**32) {\n value /= 10**32;\n result += 32;\n }\n if (value >= 10**16) {\n value /= 10**16;\n result += 16;\n }\n if (value >= 10**8) {\n value /= 10**8;\n result += 8;\n }\n if (value >= 10**4) {\n value /= 10**4;\n result += 4;\n }\n if (value >= 10**2) {\n value /= 10**2;\n result += 2;\n }\n if (value >= 10**1) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log10(value);\n return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 256, rounded down, of a positive value.\n * Returns 0 if given 0.\n *\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\n */\n function log256(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 16;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 8;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 4;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 2;\n }\n if (value >> 8 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log256(value);\n return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0);\n }\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/StorageSlotUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/StorageSlot.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Library for reading and writing primitive types to specific storage slots.\n *\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\n * This library helps with reading and writing to such slots without the need for inline assembly.\n *\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\n *\n * Example usage to set ERC1967 implementation slot:\n * ```\n * contract ERC1967 {\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n *\n * function _getImplementation() internal view returns (address) {\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\n * }\n *\n * function _setImplementation(address newImplementation) internal {\n * require(Address.isContract(newImplementation), \"ERC1967: new implementation is not a contract\");\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\n * }\n * }\n * ```\n *\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\n */\nlibrary StorageSlotUpgradeable {\n struct AddressSlot {\n address value;\n }\n\n struct BooleanSlot {\n bool value;\n }\n\n struct Bytes32Slot {\n bytes32 value;\n }\n\n struct Uint256Slot {\n uint256 value;\n }\n\n /**\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\n */\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\n */\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\n */\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\n */\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./math/MathUpgradeable.sol\";\n\n/**\n * @dev String operations.\n */\nlibrary StringsUpgradeable {\n bytes16 private constant _SYMBOLS = \"0123456789abcdef\";\n uint8 private constant _ADDRESS_LENGTH = 20;\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n */\n function toString(uint256 value) internal pure returns (string memory) {\n unchecked {\n uint256 length = MathUpgradeable.log10(value) + 1;\n string memory buffer = new string(length);\n uint256 ptr;\n /// @solidity memory-safe-assembly\n assembly {\n ptr := add(buffer, add(32, length))\n }\n while (true) {\n ptr--;\n /// @solidity memory-safe-assembly\n assembly {\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\n }\n value /= 10;\n if (value == 0) break;\n }\n return buffer;\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n */\n function toHexString(uint256 value) internal pure returns (string memory) {\n unchecked {\n return toHexString(value, MathUpgradeable.log256(value) + 1);\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n */\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n bytes memory buffer = new bytes(2 * length + 2);\n buffer[0] = \"0\";\n buffer[1] = \"x\";\n for (uint256 i = 2 * length + 1; i > 1; --i) {\n buffer[i] = _SYMBOLS[value & 0xf];\n value >>= 4;\n }\n require(value == 0, \"Strings: hex length insufficient\");\n return string(buffer);\n }\n\n /**\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\n */\n function toHexString(address addr) internal pure returns (string memory) {\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\n }\n}\n" + }, + "@openzeppelin/contracts/access/Ownable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n constructor() {\n _transferOwnership(_msgSender());\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n _checkOwner();\n _;\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if the sender is not the owner.\n */\n function _checkOwner() internal view virtual {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions anymore. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby removing any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n" + }, + "@openzeppelin/contracts/interfaces/draft-IERC1822.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\n * proxy whose upgrades are fully controlled by the current implementation.\n */\ninterface IERC1822Proxiable {\n /**\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\n * address.\n *\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\n * function revert if invoked through a proxy.\n */\n function proxiableUUID() external view returns (bytes32);\n}\n" + }, + "@openzeppelin/contracts/proxy/beacon/IBeacon.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\n */\ninterface IBeacon {\n /**\n * @dev Must return an address that can be used as a delegate call target.\n *\n * {BeaconProxy} will check that this address is a contract.\n */\n function implementation() external view returns (address);\n}\n" + }, + "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/ERC1967/ERC1967Proxy.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../Proxy.sol\";\nimport \"./ERC1967Upgrade.sol\";\n\n/**\n * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an\n * implementation address that can be changed. This address is stored in storage in the location specified by\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the\n * implementation behind the proxy.\n */\ncontract ERC1967Proxy is Proxy, ERC1967Upgrade {\n /**\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.\n *\n * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded\n * function call, and allows initializing the storage of the proxy like a Solidity constructor.\n */\n constructor(address _logic, bytes memory _data) payable {\n _upgradeToAndCall(_logic, _data, false);\n }\n\n /**\n * @dev Returns the current implementation address.\n */\n function _implementation() internal view virtual override returns (address impl) {\n return ERC1967Upgrade._getImplementation();\n }\n}\n" + }, + "@openzeppelin/contracts/proxy/ERC1967/ERC1967Upgrade.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (proxy/ERC1967/ERC1967Upgrade.sol)\n\npragma solidity ^0.8.2;\n\nimport \"../beacon/IBeacon.sol\";\nimport \"../../interfaces/draft-IERC1822.sol\";\nimport \"../../utils/Address.sol\";\nimport \"../../utils/StorageSlot.sol\";\n\n/**\n * @dev This abstract contract provides getters and event emitting update functions for\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\n *\n * _Available since v4.1._\n *\n * @custom:oz-upgrades-unsafe-allow delegatecall\n */\nabstract contract ERC1967Upgrade {\n // This is the keccak-256 hash of \"eip1967.proxy.rollback\" subtracted by 1\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\n\n /**\n * @dev Storage slot with the address of the current implementation.\n * This is the keccak-256 hash of \"eip1967.proxy.implementation\" subtracted by 1, and is\n * validated in the constructor.\n */\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n\n /**\n * @dev Emitted when the implementation is upgraded.\n */\n event Upgraded(address indexed implementation);\n\n /**\n * @dev Returns the current implementation address.\n */\n function _getImplementation() internal view returns (address) {\n return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\n }\n\n /**\n * @dev Stores a new address in the EIP1967 implementation slot.\n */\n function _setImplementation(address newImplementation) private {\n require(Address.isContract(newImplementation), \"ERC1967: new implementation is not a contract\");\n StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\n }\n\n /**\n * @dev Perform implementation upgrade\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeTo(address newImplementation) internal {\n _setImplementation(newImplementation);\n emit Upgraded(newImplementation);\n }\n\n /**\n * @dev Perform implementation upgrade with additional setup call.\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeToAndCall(\n address newImplementation,\n bytes memory data,\n bool forceCall\n ) internal {\n _upgradeTo(newImplementation);\n if (data.length > 0 || forceCall) {\n Address.functionDelegateCall(newImplementation, data);\n }\n }\n\n /**\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeToAndCallUUPS(\n address newImplementation,\n bytes memory data,\n bool forceCall\n ) internal {\n // Upgrades from old implementations will perform a rollback test. This test requires the new\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\n // this special case will break upgrade paths from old UUPS implementation to new ones.\n if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) {\n _setImplementation(newImplementation);\n } else {\n try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {\n require(slot == _IMPLEMENTATION_SLOT, \"ERC1967Upgrade: unsupported proxiableUUID\");\n } catch {\n revert(\"ERC1967Upgrade: new implementation is not UUPS\");\n }\n _upgradeToAndCall(newImplementation, data, forceCall);\n }\n }\n\n /**\n * @dev Storage slot with the admin of the contract.\n * This is the keccak-256 hash of \"eip1967.proxy.admin\" subtracted by 1, and is\n * validated in the constructor.\n */\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\n\n /**\n * @dev Emitted when the admin account has changed.\n */\n event AdminChanged(address previousAdmin, address newAdmin);\n\n /**\n * @dev Returns the current admin.\n */\n function _getAdmin() internal view returns (address) {\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\n }\n\n /**\n * @dev Stores a new address in the EIP1967 admin slot.\n */\n function _setAdmin(address newAdmin) private {\n require(newAdmin != address(0), \"ERC1967: new admin is the zero address\");\n StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\n }\n\n /**\n * @dev Changes the admin of the proxy.\n *\n * Emits an {AdminChanged} event.\n */\n function _changeAdmin(address newAdmin) internal {\n emit AdminChanged(_getAdmin(), newAdmin);\n _setAdmin(newAdmin);\n }\n\n /**\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\n */\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\n\n /**\n * @dev Emitted when the beacon is upgraded.\n */\n event BeaconUpgraded(address indexed beacon);\n\n /**\n * @dev Returns the current beacon.\n */\n function _getBeacon() internal view returns (address) {\n return StorageSlot.getAddressSlot(_BEACON_SLOT).value;\n }\n\n /**\n * @dev Stores a new beacon in the EIP1967 beacon slot.\n */\n function _setBeacon(address newBeacon) private {\n require(Address.isContract(newBeacon), \"ERC1967: new beacon is not a contract\");\n require(\n Address.isContract(IBeacon(newBeacon).implementation()),\n \"ERC1967: beacon implementation is not a contract\"\n );\n StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon;\n }\n\n /**\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\n *\n * Emits a {BeaconUpgraded} event.\n */\n function _upgradeBeaconToAndCall(\n address newBeacon,\n bytes memory data,\n bool forceCall\n ) internal {\n _setBeacon(newBeacon);\n emit BeaconUpgraded(newBeacon);\n if (data.length > 0 || forceCall) {\n Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/proxy/Proxy.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (proxy/Proxy.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\n * be specified by overriding the virtual {_implementation} function.\n *\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\n * different contract through the {_delegate} function.\n *\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\n */\nabstract contract Proxy {\n /**\n * @dev Delegates the current call to `implementation`.\n *\n * This function does not return to its internal call site, it will return directly to the external caller.\n */\n function _delegate(address implementation) internal virtual {\n assembly {\n // Copy msg.data. We take full control of memory in this inline assembly\n // block because it will not return to Solidity code. We overwrite the\n // Solidity scratch pad at memory position 0.\n calldatacopy(0, 0, calldatasize())\n\n // Call the implementation.\n // out and outsize are 0 because we don't know the size yet.\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\n\n // Copy the returned data.\n returndatacopy(0, 0, returndatasize())\n\n switch result\n // delegatecall returns 0 on error.\n case 0 {\n revert(0, returndatasize())\n }\n default {\n return(0, returndatasize())\n }\n }\n }\n\n /**\n * @dev This is a virtual function that should be overridden so it returns the address to which the fallback function\n * and {_fallback} should delegate.\n */\n function _implementation() internal view virtual returns (address);\n\n /**\n * @dev Delegates the current call to the address returned by `_implementation()`.\n *\n * This function does not return to its internal call site, it will return directly to the external caller.\n */\n function _fallback() internal virtual {\n _beforeFallback();\n _delegate(_implementation());\n }\n\n /**\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\n * function in the contract matches the call data.\n */\n fallback() external payable virtual {\n _fallback();\n }\n\n /**\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data\n * is empty.\n */\n receive() external payable virtual {\n _fallback();\n }\n\n /**\n * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`\n * call, or as part of the Solidity `fallback` or `receive` functions.\n *\n * If overridden should call `super._beforeFallback()`.\n */\n function _beforeFallback() internal virtual {}\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/ERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/ERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC20.sol\";\nimport \"./extensions/IERC20Metadata.sol\";\nimport \"../../utils/Context.sol\";\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n * For a generic mechanism see {ERC20PresetMinterPauser}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\n * instead returning `false` on failure. This behavior is nonetheless\n * conventional and does not conflict with the expectations of ERC20\n * applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the EIP may not emit\n * these events, as it isn't required by the specification.\n *\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\n * functions have been added to mitigate the well-known issues around setting\n * allowances. See {IERC20-approve}.\n */\ncontract ERC20 is Context, IERC20, IERC20Metadata {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n\n /**\n * @dev Sets the values for {name} and {symbol}.\n *\n * The default value of {decimals} is 18. To select a different value for\n * {decimals} you should overload it.\n *\n * All two of these values are immutable: they can only be set once during\n * construction.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev Returns the name of the token.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev Returns the number of decimals used to get its user representation.\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\n *\n * Tokens usually opt for a value of 18, imitating the relationship between\n * Ether and Wei. This is the value {ERC20} uses, unless this function is\n * overridden;\n *\n * NOTE: This information is only used for _display_ purposes: it in\n * no way affects any of the arithmetic of the contract, including\n * {IERC20-balanceOf} and {IERC20-transfer}.\n */\n function decimals() public view virtual override returns (uint8) {\n return 18;\n }\n\n /**\n * @dev See {IERC20-totalSupply}.\n */\n function totalSupply() public view virtual override returns (uint256) {\n return _totalSupply;\n }\n\n /**\n * @dev See {IERC20-balanceOf}.\n */\n function balanceOf(address account) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n /**\n * @dev See {IERC20-transfer}.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - the caller must have a balance of at least `amount`.\n */\n function transfer(address to, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _transfer(owner, to, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-allowance}.\n */\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n /**\n * @dev See {IERC20-approve}.\n *\n * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on\n * `transferFrom`. This is semantically equivalent to an infinite approval.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-transferFrom}.\n *\n * Emits an {Approval} event indicating the updated allowance. This is not\n * required by the EIP. See the note at the beginning of {ERC20}.\n *\n * NOTE: Does not update the allowance if the current allowance\n * is the maximum `uint256`.\n *\n * Requirements:\n *\n * - `from` and `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n * - the caller must have allowance for ``from``'s tokens of at least\n * `amount`.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) public virtual override returns (bool) {\n address spender = _msgSender();\n _spendAllowance(from, spender, amount);\n _transfer(from, to, amount);\n return true;\n }\n\n /**\n * @dev Atomically increases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, allowance(owner, spender) + addedValue);\n return true;\n }\n\n /**\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `spender` must have allowance for the caller of at least\n * `subtractedValue`.\n */\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\n address owner = _msgSender();\n uint256 currentAllowance = allowance(owner, spender);\n require(currentAllowance >= subtractedValue, \"ERC20: decreased allowance below zero\");\n unchecked {\n _approve(owner, spender, currentAllowance - subtractedValue);\n }\n\n return true;\n }\n\n /**\n * @dev Moves `amount` of tokens from `from` to `to`.\n *\n * This internal function is equivalent to {transfer}, and can be used to\n * e.g. implement automatic token fees, slashing mechanisms, etc.\n *\n * Emits a {Transfer} event.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n */\n function _transfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, amount);\n\n uint256 fromBalance = _balances[from];\n require(fromBalance >= amount, \"ERC20: transfer amount exceeds balance\");\n unchecked {\n _balances[from] = fromBalance - amount;\n // Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by\n // decrementing then incrementing.\n _balances[to] += amount;\n }\n\n emit Transfer(from, to, amount);\n\n _afterTokenTransfer(from, to, amount);\n }\n\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\n * the total supply.\n *\n * Emits a {Transfer} event with `from` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _beforeTokenTransfer(address(0), account, amount);\n\n _totalSupply += amount;\n unchecked {\n // Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above.\n _balances[account] += amount;\n }\n emit Transfer(address(0), account, amount);\n\n _afterTokenTransfer(address(0), account, amount);\n }\n\n /**\n * @dev Destroys `amount` tokens from `account`, reducing the\n * total supply.\n *\n * Emits a {Transfer} event with `to` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n * - `account` must have at least `amount` tokens.\n */\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n _beforeTokenTransfer(account, address(0), amount);\n\n uint256 accountBalance = _balances[account];\n require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n unchecked {\n _balances[account] = accountBalance - amount;\n // Overflow not possible: amount <= accountBalance <= totalSupply.\n _totalSupply -= amount;\n }\n\n emit Transfer(account, address(0), amount);\n\n _afterTokenTransfer(account, address(0), amount);\n }\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\n *\n * This internal function is equivalent to `approve`, and can be used to\n * e.g. set automatic allowances for certain subsystems, etc.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `owner` cannot be the zero address.\n * - `spender` cannot be the zero address.\n */\n function _approve(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n emit Approval(owner, spender, amount);\n }\n\n /**\n * @dev Updates `owner` s allowance for `spender` based on spent `amount`.\n *\n * Does not update the allowance amount in case of infinite allowance.\n * Revert if not enough allowance is available.\n *\n * Might emit an {Approval} event.\n */\n function _spendAllowance(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n uint256 currentAllowance = allowance(owner, spender);\n if (currentAllowance != type(uint256).max) {\n require(currentAllowance >= amount, \"ERC20: insufficient allowance\");\n unchecked {\n _approve(owner, spender, currentAllowance - amount);\n }\n }\n }\n\n /**\n * @dev Hook that is called before any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * will be transferred to `to`.\n * - when `from` is zero, `amount` tokens will be minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n\n /**\n * @dev Hook that is called after any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * has been transferred to `to`.\n * - when `from` is zero, `amount` tokens have been minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens have been burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/draft-ERC20Permit.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/extensions/draft-ERC20Permit.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./draft-IERC20Permit.sol\";\nimport \"../ERC20.sol\";\nimport \"../../../utils/cryptography/ECDSA.sol\";\nimport \"../../../utils/cryptography/EIP712.sol\";\nimport \"../../../utils/Counters.sol\";\n\n/**\n * @dev Implementation of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on `{IERC20-approve}`, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n *\n * _Available since v3.4._\n */\nabstract contract ERC20Permit is ERC20, IERC20Permit, EIP712 {\n using Counters for Counters.Counter;\n\n mapping(address => Counters.Counter) private _nonces;\n\n // solhint-disable-next-line var-name-mixedcase\n bytes32 private constant _PERMIT_TYPEHASH =\n keccak256(\"Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)\");\n /**\n * @dev In previous versions `_PERMIT_TYPEHASH` was declared as `immutable`.\n * However, to ensure consistency with the upgradeable transpiler, we will continue\n * to reserve a slot.\n * @custom:oz-renamed-from _PERMIT_TYPEHASH\n */\n // solhint-disable-next-line var-name-mixedcase\n bytes32 private _PERMIT_TYPEHASH_DEPRECATED_SLOT;\n\n /**\n * @dev Initializes the {EIP712} domain separator using the `name` parameter, and setting `version` to `\"1\"`.\n *\n * It's a good idea to use the same `name` that is defined as the ERC20 token name.\n */\n constructor(string memory name) EIP712(name, \"1\") {}\n\n /**\n * @dev See {IERC20Permit-permit}.\n */\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) public virtual override {\n require(block.timestamp <= deadline, \"ERC20Permit: expired deadline\");\n\n bytes32 structHash = keccak256(abi.encode(_PERMIT_TYPEHASH, owner, spender, value, _useNonce(owner), deadline));\n\n bytes32 hash = _hashTypedDataV4(structHash);\n\n address signer = ECDSA.recover(hash, v, r, s);\n require(signer == owner, \"ERC20Permit: invalid signature\");\n\n _approve(owner, spender, value);\n }\n\n /**\n * @dev See {IERC20Permit-nonces}.\n */\n function nonces(address owner) public view virtual override returns (uint256) {\n return _nonces[owner].current();\n }\n\n /**\n * @dev See {IERC20Permit-DOMAIN_SEPARATOR}.\n */\n // solhint-disable-next-line func-name-mixedcase\n function DOMAIN_SEPARATOR() external view override returns (bytes32) {\n return _domainSeparatorV4();\n }\n\n /**\n * @dev \"Consume a nonce\": return the current value and increment.\n *\n * _Available since v4.1._\n */\n function _useNonce(address owner) internal virtual returns (uint256 current) {\n Counters.Counter storage nonce = _nonces[owner];\n current = nonce.current();\n nonce.increment();\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n */\ninterface IERC20Permit {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also apply here.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `deadline` must be a timestamp in the future.\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\n * over the EIP712-formatted function arguments.\n * - the signature must use ``owner``'s current nonce (see {nonces}).\n *\n * For more information on the signature format, see the\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\n * section].\n */\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n\n /**\n * @dev Returns the current nonce for `owner`. This value must be\n * included whenever a signature is generated for {permit}.\n *\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\n * prevents a signature from being used multiple times.\n */\n function nonces(address owner) external view returns (uint256);\n\n /**\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\n */\n // solhint-disable-next-line func-name-mixedcase\n function DOMAIN_SEPARATOR() external view returns (bytes32);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20Metadata is IERC20 {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/IERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\nimport \"../extensions/draft-IERC20Permit.sol\";\nimport \"../../../utils/Address.sol\";\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n using Address for address;\n\n function safeTransfer(\n IERC20 token,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n function safeTransferFrom(\n IERC20 token,\n address from,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\n }\n\n /**\n * @dev Deprecated. This function has issues similar to the ones found in\n * {IERC20-approve}, and its usage is discouraged.\n *\n * Whenever possible, use {safeIncreaseAllowance} and\n * {safeDecreaseAllowance} instead.\n */\n function safeApprove(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n // safeApprove should only be called when setting an initial allowance,\n // or when resetting it to zero. To increase and decrease it, use\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\n require(\n (value == 0) || (token.allowance(address(this), spender) == 0),\n \"SafeERC20: approve from non-zero to non-zero allowance\"\n );\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\n }\n\n function safeIncreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n uint256 newAllowance = token.allowance(address(this), spender) + value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n\n function safeDecreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n unchecked {\n uint256 oldAllowance = token.allowance(address(this), spender);\n require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\n uint256 newAllowance = oldAllowance - value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n }\n\n function safePermit(\n IERC20Permit token,\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal {\n uint256 nonceBefore = token.nonces(owner);\n token.permit(owner, spender, value, deadline, v, r, s);\n uint256 nonceAfter = token.nonces(owner);\n require(nonceAfter == nonceBefore + 1, \"SafeERC20: permit did not succeed\");\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data, \"SafeERC20: low-level call failed\");\n if (returndata.length > 0) {\n // Return data is optional\n require(abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Address.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Context.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Counters.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Counters.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @title Counters\n * @author Matt Condon (@shrugs)\n * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number\n * of elements in a mapping, issuing ERC721 ids, or counting request ids.\n *\n * Include with `using Counters for Counters.Counter;`\n */\nlibrary Counters {\n struct Counter {\n // This variable should never be directly accessed by users of the library: interactions must be restricted to\n // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add\n // this feature: see https://github.com/ethereum/solidity/issues/4637\n uint256 _value; // default: 0\n }\n\n function current(Counter storage counter) internal view returns (uint256) {\n return counter._value;\n }\n\n function increment(Counter storage counter) internal {\n unchecked {\n counter._value += 1;\n }\n }\n\n function decrement(Counter storage counter) internal {\n uint256 value = counter._value;\n require(value > 0, \"Counter: decrement overflow\");\n unchecked {\n counter._value = value - 1;\n }\n }\n\n function reset(Counter storage counter) internal {\n counter._value = 0;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/cryptography/ECDSA.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/ECDSA.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../Strings.sol\";\n\n/**\n * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.\n *\n * These functions can be used to verify that a message was signed by the holder\n * of the private keys of a given address.\n */\nlibrary ECDSA {\n enum RecoverError {\n NoError,\n InvalidSignature,\n InvalidSignatureLength,\n InvalidSignatureS,\n InvalidSignatureV // Deprecated in v4.8\n }\n\n function _throwError(RecoverError error) private pure {\n if (error == RecoverError.NoError) {\n return; // no error: do nothing\n } else if (error == RecoverError.InvalidSignature) {\n revert(\"ECDSA: invalid signature\");\n } else if (error == RecoverError.InvalidSignatureLength) {\n revert(\"ECDSA: invalid signature length\");\n } else if (error == RecoverError.InvalidSignatureS) {\n revert(\"ECDSA: invalid signature 's' value\");\n }\n }\n\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with\n * `signature` or error string. This address can then be used for verification purposes.\n *\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {toEthSignedMessageHash} on it.\n *\n * Documentation for signature generation:\n * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]\n * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]\n *\n * _Available since v4.3._\n */\n function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {\n if (signature.length == 65) {\n bytes32 r;\n bytes32 s;\n uint8 v;\n // ecrecover takes the signature parameters, and the only way to get them\n // currently is to use assembly.\n /// @solidity memory-safe-assembly\n assembly {\n r := mload(add(signature, 0x20))\n s := mload(add(signature, 0x40))\n v := byte(0, mload(add(signature, 0x60)))\n }\n return tryRecover(hash, v, r, s);\n } else {\n return (address(0), RecoverError.InvalidSignatureLength);\n }\n }\n\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with\n * `signature`. This address can then be used for verification purposes.\n *\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {toEthSignedMessageHash} on it.\n */\n function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, signature);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.\n *\n * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]\n *\n * _Available since v4.3._\n */\n function tryRecover(\n bytes32 hash,\n bytes32 r,\n bytes32 vs\n ) internal pure returns (address, RecoverError) {\n bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);\n uint8 v = uint8((uint256(vs) >> 255) + 27);\n return tryRecover(hash, v, r, s);\n }\n\n /**\n * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.\n *\n * _Available since v4.2._\n */\n function recover(\n bytes32 hash,\n bytes32 r,\n bytes32 vs\n ) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, r, vs);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Overload of {ECDSA-tryRecover} that receives the `v`,\n * `r` and `s` signature fields separately.\n *\n * _Available since v4.3._\n */\n function tryRecover(\n bytes32 hash,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal pure returns (address, RecoverError) {\n // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature\n // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines\n // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most\n // signatures from current libraries generate a unique signature with an s-value in the lower half order.\n //\n // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value\n // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or\n // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept\n // these malleable signatures as well.\n if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {\n return (address(0), RecoverError.InvalidSignatureS);\n }\n\n // If the signature is valid (and not malleable), return the signer address\n address signer = ecrecover(hash, v, r, s);\n if (signer == address(0)) {\n return (address(0), RecoverError.InvalidSignature);\n }\n\n return (signer, RecoverError.NoError);\n }\n\n /**\n * @dev Overload of {ECDSA-recover} that receives the `v`,\n * `r` and `s` signature fields separately.\n */\n function recover(\n bytes32 hash,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, v, r, s);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Returns an Ethereum Signed Message, created from a `hash`. This\n * produces hash corresponding to the one signed with the\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n * JSON-RPC method as part of EIP-191.\n *\n * See {recover}.\n */\n function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {\n // 32 is the length in bytes of hash,\n // enforced by the type signature above\n return keccak256(abi.encodePacked(\"\\x19Ethereum Signed Message:\\n32\", hash));\n }\n\n /**\n * @dev Returns an Ethereum Signed Message, created from `s`. This\n * produces hash corresponding to the one signed with the\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n * JSON-RPC method as part of EIP-191.\n *\n * See {recover}.\n */\n function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(\"\\x19Ethereum Signed Message:\\n\", Strings.toString(s.length), s));\n }\n\n /**\n * @dev Returns an Ethereum Signed Typed Data, created from a\n * `domainSeparator` and a `structHash`. This produces hash corresponding\n * to the one signed with the\n * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]\n * JSON-RPC method as part of EIP-712.\n *\n * See {recover}.\n */\n function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(\"\\x19\\x01\", domainSeparator, structHash));\n }\n}\n" + }, + "@openzeppelin/contracts/utils/cryptography/EIP712.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/EIP712.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./ECDSA.sol\";\n\n/**\n * @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data.\n *\n * The encoding specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible,\n * thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding\n * they need in their contracts using a combination of `abi.encode` and `keccak256`.\n *\n * This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding\n * scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA\n * ({_hashTypedDataV4}).\n *\n * The implementation of the domain separator was designed to be as efficient as possible while still properly updating\n * the chain id to protect against replay attacks on an eventual fork of the chain.\n *\n * NOTE: This contract implements the version of the encoding known as \"v4\", as implemented by the JSON RPC method\n * https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask].\n *\n * _Available since v3.4._\n */\nabstract contract EIP712 {\n /* solhint-disable var-name-mixedcase */\n // Cache the domain separator as an immutable value, but also store the chain id that it corresponds to, in order to\n // invalidate the cached domain separator if the chain id changes.\n bytes32 private immutable _CACHED_DOMAIN_SEPARATOR;\n uint256 private immutable _CACHED_CHAIN_ID;\n address private immutable _CACHED_THIS;\n\n bytes32 private immutable _HASHED_NAME;\n bytes32 private immutable _HASHED_VERSION;\n bytes32 private immutable _TYPE_HASH;\n\n /* solhint-enable var-name-mixedcase */\n\n /**\n * @dev Initializes the domain separator and parameter caches.\n *\n * The meaning of `name` and `version` is specified in\n * https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]:\n *\n * - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol.\n * - `version`: the current major version of the signing domain.\n *\n * NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart\n * contract upgrade].\n */\n constructor(string memory name, string memory version) {\n bytes32 hashedName = keccak256(bytes(name));\n bytes32 hashedVersion = keccak256(bytes(version));\n bytes32 typeHash = keccak256(\n \"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)\"\n );\n _HASHED_NAME = hashedName;\n _HASHED_VERSION = hashedVersion;\n _CACHED_CHAIN_ID = block.chainid;\n _CACHED_DOMAIN_SEPARATOR = _buildDomainSeparator(typeHash, hashedName, hashedVersion);\n _CACHED_THIS = address(this);\n _TYPE_HASH = typeHash;\n }\n\n /**\n * @dev Returns the domain separator for the current chain.\n */\n function _domainSeparatorV4() internal view returns (bytes32) {\n if (address(this) == _CACHED_THIS && block.chainid == _CACHED_CHAIN_ID) {\n return _CACHED_DOMAIN_SEPARATOR;\n } else {\n return _buildDomainSeparator(_TYPE_HASH, _HASHED_NAME, _HASHED_VERSION);\n }\n }\n\n function _buildDomainSeparator(\n bytes32 typeHash,\n bytes32 nameHash,\n bytes32 versionHash\n ) private view returns (bytes32) {\n return keccak256(abi.encode(typeHash, nameHash, versionHash, block.chainid, address(this)));\n }\n\n /**\n * @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this\n * function returns the hash of the fully encoded EIP712 message for this domain.\n *\n * This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example:\n *\n * ```solidity\n * bytes32 digest = _hashTypedDataV4(keccak256(abi.encode(\n * keccak256(\"Mail(address to,string contents)\"),\n * mailTo,\n * keccak256(bytes(mailContents))\n * )));\n * address signer = ECDSA.recover(digest, signature);\n * ```\n */\n function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) {\n return ECDSA.toTypedDataHash(_domainSeparatorV4(), structHash);\n }\n}\n" + }, + "@openzeppelin/contracts/utils/math/Math.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary Math {\n enum Rounding {\n Down, // Toward negative infinity\n Up, // Toward infinity\n Zero // Toward zero\n }\n\n /**\n * @dev Returns the largest of two numbers.\n */\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two numbers.\n */\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two numbers. The result is rounded towards\n * zero.\n */\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b) / 2 can overflow.\n return (a & b) + (a ^ b) / 2;\n }\n\n /**\n * @dev Returns the ceiling of the division of two numbers.\n *\n * This differs from standard division with `/` in that it rounds up instead\n * of rounding down.\n */\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b - 1) / b can overflow on addition, so we distribute.\n return a == 0 ? 0 : (a - 1) / b + 1;\n }\n\n /**\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\n * with further edits by Uniswap Labs also under MIT license.\n */\n function mulDiv(\n uint256 x,\n uint256 y,\n uint256 denominator\n ) internal pure returns (uint256 result) {\n unchecked {\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\n // variables such that product = prod1 * 2^256 + prod0.\n uint256 prod0; // Least significant 256 bits of the product\n uint256 prod1; // Most significant 256 bits of the product\n assembly {\n let mm := mulmod(x, y, not(0))\n prod0 := mul(x, y)\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n }\n\n // Handle non-overflow cases, 256 by 256 division.\n if (prod1 == 0) {\n return prod0 / denominator;\n }\n\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\n require(denominator > prod1);\n\n ///////////////////////////////////////////////\n // 512 by 256 division.\n ///////////////////////////////////////////////\n\n // Make division exact by subtracting the remainder from [prod1 prod0].\n uint256 remainder;\n assembly {\n // Compute remainder using mulmod.\n remainder := mulmod(x, y, denominator)\n\n // Subtract 256 bit number from 512 bit number.\n prod1 := sub(prod1, gt(remainder, prod0))\n prod0 := sub(prod0, remainder)\n }\n\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\n // See https://cs.stackexchange.com/q/138556/92363.\n\n // Does not overflow because the denominator cannot be zero at this stage in the function.\n uint256 twos = denominator & (~denominator + 1);\n assembly {\n // Divide denominator by twos.\n denominator := div(denominator, twos)\n\n // Divide [prod1 prod0] by twos.\n prod0 := div(prod0, twos)\n\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\n twos := add(div(sub(0, twos), twos), 1)\n }\n\n // Shift in bits from prod1 into prod0.\n prod0 |= prod1 * twos;\n\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\n // four bits. That is, denominator * inv = 1 mod 2^4.\n uint256 inverse = (3 * denominator) ^ 2;\n\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\n // in modular arithmetic, doubling the correct bits in each step.\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\n\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\n // is no longer required.\n result = prod0 * inverse;\n return result;\n }\n }\n\n /**\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\n */\n function mulDiv(\n uint256 x,\n uint256 y,\n uint256 denominator,\n Rounding rounding\n ) internal pure returns (uint256) {\n uint256 result = mulDiv(x, y, denominator);\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\n result += 1;\n }\n return result;\n }\n\n /**\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\n *\n * Inspired by Henry S. Warren, Jr.'s \"Hacker's Delight\" (Chapter 11).\n */\n function sqrt(uint256 a) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\n //\n // We know that the \"msb\" (most significant bit) of our target number `a` is a power of 2 such that we have\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\n //\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\n // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\n // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\n //\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\n uint256 result = 1 << (log2(a) >> 1);\n\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\n // into the expected uint128 result.\n unchecked {\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n return min(result, a / result);\n }\n }\n\n /**\n * @notice Calculates sqrt(a), following the selected rounding direction.\n */\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = sqrt(a);\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 2, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 128;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 64;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 32;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 16;\n }\n if (value >> 8 > 0) {\n value >>= 8;\n result += 8;\n }\n if (value >> 4 > 0) {\n value >>= 4;\n result += 4;\n }\n if (value >> 2 > 0) {\n value >>= 2;\n result += 2;\n }\n if (value >> 1 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log2(value);\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 10, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >= 10**64) {\n value /= 10**64;\n result += 64;\n }\n if (value >= 10**32) {\n value /= 10**32;\n result += 32;\n }\n if (value >= 10**16) {\n value /= 10**16;\n result += 16;\n }\n if (value >= 10**8) {\n value /= 10**8;\n result += 8;\n }\n if (value >= 10**4) {\n value /= 10**4;\n result += 4;\n }\n if (value >= 10**2) {\n value /= 10**2;\n result += 2;\n }\n if (value >= 10**1) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log10(value);\n return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 256, rounded down, of a positive value.\n * Returns 0 if given 0.\n *\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\n */\n function log256(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 16;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 8;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 4;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 2;\n }\n if (value >> 8 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log256(value);\n return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/math/SafeCast.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SafeCast.sol)\n// This file was procedurally generated from scripts/generate/templates/SafeCast.js.\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Wrappers over Solidity's uintXX/intXX casting operators with added overflow\n * checks.\n *\n * Downcasting from uint256/int256 in Solidity does not revert on overflow. This can\n * easily result in undesired exploitation or bugs, since developers usually\n * assume that overflows raise errors. `SafeCast` restores this intuition by\n * reverting the transaction when such an operation overflows.\n *\n * Using this library instead of the unchecked operations eliminates an entire\n * class of bugs, so it's recommended to use it always.\n *\n * Can be combined with {SafeMath} and {SignedSafeMath} to extend it to smaller types, by performing\n * all math on `uint256` and `int256` and then downcasting.\n */\nlibrary SafeCast {\n /**\n * @dev Returns the downcasted uint248 from uint256, reverting on\n * overflow (when the input is greater than largest uint248).\n *\n * Counterpart to Solidity's `uint248` operator.\n *\n * Requirements:\n *\n * - input must fit into 248 bits\n *\n * _Available since v4.7._\n */\n function toUint248(uint256 value) internal pure returns (uint248) {\n require(value <= type(uint248).max, \"SafeCast: value doesn't fit in 248 bits\");\n return uint248(value);\n }\n\n /**\n * @dev Returns the downcasted uint240 from uint256, reverting on\n * overflow (when the input is greater than largest uint240).\n *\n * Counterpart to Solidity's `uint240` operator.\n *\n * Requirements:\n *\n * - input must fit into 240 bits\n *\n * _Available since v4.7._\n */\n function toUint240(uint256 value) internal pure returns (uint240) {\n require(value <= type(uint240).max, \"SafeCast: value doesn't fit in 240 bits\");\n return uint240(value);\n }\n\n /**\n * @dev Returns the downcasted uint232 from uint256, reverting on\n * overflow (when the input is greater than largest uint232).\n *\n * Counterpart to Solidity's `uint232` operator.\n *\n * Requirements:\n *\n * - input must fit into 232 bits\n *\n * _Available since v4.7._\n */\n function toUint232(uint256 value) internal pure returns (uint232) {\n require(value <= type(uint232).max, \"SafeCast: value doesn't fit in 232 bits\");\n return uint232(value);\n }\n\n /**\n * @dev Returns the downcasted uint224 from uint256, reverting on\n * overflow (when the input is greater than largest uint224).\n *\n * Counterpart to Solidity's `uint224` operator.\n *\n * Requirements:\n *\n * - input must fit into 224 bits\n *\n * _Available since v4.2._\n */\n function toUint224(uint256 value) internal pure returns (uint224) {\n require(value <= type(uint224).max, \"SafeCast: value doesn't fit in 224 bits\");\n return uint224(value);\n }\n\n /**\n * @dev Returns the downcasted uint216 from uint256, reverting on\n * overflow (when the input is greater than largest uint216).\n *\n * Counterpart to Solidity's `uint216` operator.\n *\n * Requirements:\n *\n * - input must fit into 216 bits\n *\n * _Available since v4.7._\n */\n function toUint216(uint256 value) internal pure returns (uint216) {\n require(value <= type(uint216).max, \"SafeCast: value doesn't fit in 216 bits\");\n return uint216(value);\n }\n\n /**\n * @dev Returns the downcasted uint208 from uint256, reverting on\n * overflow (when the input is greater than largest uint208).\n *\n * Counterpart to Solidity's `uint208` operator.\n *\n * Requirements:\n *\n * - input must fit into 208 bits\n *\n * _Available since v4.7._\n */\n function toUint208(uint256 value) internal pure returns (uint208) {\n require(value <= type(uint208).max, \"SafeCast: value doesn't fit in 208 bits\");\n return uint208(value);\n }\n\n /**\n * @dev Returns the downcasted uint200 from uint256, reverting on\n * overflow (when the input is greater than largest uint200).\n *\n * Counterpart to Solidity's `uint200` operator.\n *\n * Requirements:\n *\n * - input must fit into 200 bits\n *\n * _Available since v4.7._\n */\n function toUint200(uint256 value) internal pure returns (uint200) {\n require(value <= type(uint200).max, \"SafeCast: value doesn't fit in 200 bits\");\n return uint200(value);\n }\n\n /**\n * @dev Returns the downcasted uint192 from uint256, reverting on\n * overflow (when the input is greater than largest uint192).\n *\n * Counterpart to Solidity's `uint192` operator.\n *\n * Requirements:\n *\n * - input must fit into 192 bits\n *\n * _Available since v4.7._\n */\n function toUint192(uint256 value) internal pure returns (uint192) {\n require(value <= type(uint192).max, \"SafeCast: value doesn't fit in 192 bits\");\n return uint192(value);\n }\n\n /**\n * @dev Returns the downcasted uint184 from uint256, reverting on\n * overflow (when the input is greater than largest uint184).\n *\n * Counterpart to Solidity's `uint184` operator.\n *\n * Requirements:\n *\n * - input must fit into 184 bits\n *\n * _Available since v4.7._\n */\n function toUint184(uint256 value) internal pure returns (uint184) {\n require(value <= type(uint184).max, \"SafeCast: value doesn't fit in 184 bits\");\n return uint184(value);\n }\n\n /**\n * @dev Returns the downcasted uint176 from uint256, reverting on\n * overflow (when the input is greater than largest uint176).\n *\n * Counterpart to Solidity's `uint176` operator.\n *\n * Requirements:\n *\n * - input must fit into 176 bits\n *\n * _Available since v4.7._\n */\n function toUint176(uint256 value) internal pure returns (uint176) {\n require(value <= type(uint176).max, \"SafeCast: value doesn't fit in 176 bits\");\n return uint176(value);\n }\n\n /**\n * @dev Returns the downcasted uint168 from uint256, reverting on\n * overflow (when the input is greater than largest uint168).\n *\n * Counterpart to Solidity's `uint168` operator.\n *\n * Requirements:\n *\n * - input must fit into 168 bits\n *\n * _Available since v4.7._\n */\n function toUint168(uint256 value) internal pure returns (uint168) {\n require(value <= type(uint168).max, \"SafeCast: value doesn't fit in 168 bits\");\n return uint168(value);\n }\n\n /**\n * @dev Returns the downcasted uint160 from uint256, reverting on\n * overflow (when the input is greater than largest uint160).\n *\n * Counterpart to Solidity's `uint160` operator.\n *\n * Requirements:\n *\n * - input must fit into 160 bits\n *\n * _Available since v4.7._\n */\n function toUint160(uint256 value) internal pure returns (uint160) {\n require(value <= type(uint160).max, \"SafeCast: value doesn't fit in 160 bits\");\n return uint160(value);\n }\n\n /**\n * @dev Returns the downcasted uint152 from uint256, reverting on\n * overflow (when the input is greater than largest uint152).\n *\n * Counterpart to Solidity's `uint152` operator.\n *\n * Requirements:\n *\n * - input must fit into 152 bits\n *\n * _Available since v4.7._\n */\n function toUint152(uint256 value) internal pure returns (uint152) {\n require(value <= type(uint152).max, \"SafeCast: value doesn't fit in 152 bits\");\n return uint152(value);\n }\n\n /**\n * @dev Returns the downcasted uint144 from uint256, reverting on\n * overflow (when the input is greater than largest uint144).\n *\n * Counterpart to Solidity's `uint144` operator.\n *\n * Requirements:\n *\n * - input must fit into 144 bits\n *\n * _Available since v4.7._\n */\n function toUint144(uint256 value) internal pure returns (uint144) {\n require(value <= type(uint144).max, \"SafeCast: value doesn't fit in 144 bits\");\n return uint144(value);\n }\n\n /**\n * @dev Returns the downcasted uint136 from uint256, reverting on\n * overflow (when the input is greater than largest uint136).\n *\n * Counterpart to Solidity's `uint136` operator.\n *\n * Requirements:\n *\n * - input must fit into 136 bits\n *\n * _Available since v4.7._\n */\n function toUint136(uint256 value) internal pure returns (uint136) {\n require(value <= type(uint136).max, \"SafeCast: value doesn't fit in 136 bits\");\n return uint136(value);\n }\n\n /**\n * @dev Returns the downcasted uint128 from uint256, reverting on\n * overflow (when the input is greater than largest uint128).\n *\n * Counterpart to Solidity's `uint128` operator.\n *\n * Requirements:\n *\n * - input must fit into 128 bits\n *\n * _Available since v2.5._\n */\n function toUint128(uint256 value) internal pure returns (uint128) {\n require(value <= type(uint128).max, \"SafeCast: value doesn't fit in 128 bits\");\n return uint128(value);\n }\n\n /**\n * @dev Returns the downcasted uint120 from uint256, reverting on\n * overflow (when the input is greater than largest uint120).\n *\n * Counterpart to Solidity's `uint120` operator.\n *\n * Requirements:\n *\n * - input must fit into 120 bits\n *\n * _Available since v4.7._\n */\n function toUint120(uint256 value) internal pure returns (uint120) {\n require(value <= type(uint120).max, \"SafeCast: value doesn't fit in 120 bits\");\n return uint120(value);\n }\n\n /**\n * @dev Returns the downcasted uint112 from uint256, reverting on\n * overflow (when the input is greater than largest uint112).\n *\n * Counterpart to Solidity's `uint112` operator.\n *\n * Requirements:\n *\n * - input must fit into 112 bits\n *\n * _Available since v4.7._\n */\n function toUint112(uint256 value) internal pure returns (uint112) {\n require(value <= type(uint112).max, \"SafeCast: value doesn't fit in 112 bits\");\n return uint112(value);\n }\n\n /**\n * @dev Returns the downcasted uint104 from uint256, reverting on\n * overflow (when the input is greater than largest uint104).\n *\n * Counterpart to Solidity's `uint104` operator.\n *\n * Requirements:\n *\n * - input must fit into 104 bits\n *\n * _Available since v4.7._\n */\n function toUint104(uint256 value) internal pure returns (uint104) {\n require(value <= type(uint104).max, \"SafeCast: value doesn't fit in 104 bits\");\n return uint104(value);\n }\n\n /**\n * @dev Returns the downcasted uint96 from uint256, reverting on\n * overflow (when the input is greater than largest uint96).\n *\n * Counterpart to Solidity's `uint96` operator.\n *\n * Requirements:\n *\n * - input must fit into 96 bits\n *\n * _Available since v4.2._\n */\n function toUint96(uint256 value) internal pure returns (uint96) {\n require(value <= type(uint96).max, \"SafeCast: value doesn't fit in 96 bits\");\n return uint96(value);\n }\n\n /**\n * @dev Returns the downcasted uint88 from uint256, reverting on\n * overflow (when the input is greater than largest uint88).\n *\n * Counterpart to Solidity's `uint88` operator.\n *\n * Requirements:\n *\n * - input must fit into 88 bits\n *\n * _Available since v4.7._\n */\n function toUint88(uint256 value) internal pure returns (uint88) {\n require(value <= type(uint88).max, \"SafeCast: value doesn't fit in 88 bits\");\n return uint88(value);\n }\n\n /**\n * @dev Returns the downcasted uint80 from uint256, reverting on\n * overflow (when the input is greater than largest uint80).\n *\n * Counterpart to Solidity's `uint80` operator.\n *\n * Requirements:\n *\n * - input must fit into 80 bits\n *\n * _Available since v4.7._\n */\n function toUint80(uint256 value) internal pure returns (uint80) {\n require(value <= type(uint80).max, \"SafeCast: value doesn't fit in 80 bits\");\n return uint80(value);\n }\n\n /**\n * @dev Returns the downcasted uint72 from uint256, reverting on\n * overflow (when the input is greater than largest uint72).\n *\n * Counterpart to Solidity's `uint72` operator.\n *\n * Requirements:\n *\n * - input must fit into 72 bits\n *\n * _Available since v4.7._\n */\n function toUint72(uint256 value) internal pure returns (uint72) {\n require(value <= type(uint72).max, \"SafeCast: value doesn't fit in 72 bits\");\n return uint72(value);\n }\n\n /**\n * @dev Returns the downcasted uint64 from uint256, reverting on\n * overflow (when the input is greater than largest uint64).\n *\n * Counterpart to Solidity's `uint64` operator.\n *\n * Requirements:\n *\n * - input must fit into 64 bits\n *\n * _Available since v2.5._\n */\n function toUint64(uint256 value) internal pure returns (uint64) {\n require(value <= type(uint64).max, \"SafeCast: value doesn't fit in 64 bits\");\n return uint64(value);\n }\n\n /**\n * @dev Returns the downcasted uint56 from uint256, reverting on\n * overflow (when the input is greater than largest uint56).\n *\n * Counterpart to Solidity's `uint56` operator.\n *\n * Requirements:\n *\n * - input must fit into 56 bits\n *\n * _Available since v4.7._\n */\n function toUint56(uint256 value) internal pure returns (uint56) {\n require(value <= type(uint56).max, \"SafeCast: value doesn't fit in 56 bits\");\n return uint56(value);\n }\n\n /**\n * @dev Returns the downcasted uint48 from uint256, reverting on\n * overflow (when the input is greater than largest uint48).\n *\n * Counterpart to Solidity's `uint48` operator.\n *\n * Requirements:\n *\n * - input must fit into 48 bits\n *\n * _Available since v4.7._\n */\n function toUint48(uint256 value) internal pure returns (uint48) {\n require(value <= type(uint48).max, \"SafeCast: value doesn't fit in 48 bits\");\n return uint48(value);\n }\n\n /**\n * @dev Returns the downcasted uint40 from uint256, reverting on\n * overflow (when the input is greater than largest uint40).\n *\n * Counterpart to Solidity's `uint40` operator.\n *\n * Requirements:\n *\n * - input must fit into 40 bits\n *\n * _Available since v4.7._\n */\n function toUint40(uint256 value) internal pure returns (uint40) {\n require(value <= type(uint40).max, \"SafeCast: value doesn't fit in 40 bits\");\n return uint40(value);\n }\n\n /**\n * @dev Returns the downcasted uint32 from uint256, reverting on\n * overflow (when the input is greater than largest uint32).\n *\n * Counterpart to Solidity's `uint32` operator.\n *\n * Requirements:\n *\n * - input must fit into 32 bits\n *\n * _Available since v2.5._\n */\n function toUint32(uint256 value) internal pure returns (uint32) {\n require(value <= type(uint32).max, \"SafeCast: value doesn't fit in 32 bits\");\n return uint32(value);\n }\n\n /**\n * @dev Returns the downcasted uint24 from uint256, reverting on\n * overflow (when the input is greater than largest uint24).\n *\n * Counterpart to Solidity's `uint24` operator.\n *\n * Requirements:\n *\n * - input must fit into 24 bits\n *\n * _Available since v4.7._\n */\n function toUint24(uint256 value) internal pure returns (uint24) {\n require(value <= type(uint24).max, \"SafeCast: value doesn't fit in 24 bits\");\n return uint24(value);\n }\n\n /**\n * @dev Returns the downcasted uint16 from uint256, reverting on\n * overflow (when the input is greater than largest uint16).\n *\n * Counterpart to Solidity's `uint16` operator.\n *\n * Requirements:\n *\n * - input must fit into 16 bits\n *\n * _Available since v2.5._\n */\n function toUint16(uint256 value) internal pure returns (uint16) {\n require(value <= type(uint16).max, \"SafeCast: value doesn't fit in 16 bits\");\n return uint16(value);\n }\n\n /**\n * @dev Returns the downcasted uint8 from uint256, reverting on\n * overflow (when the input is greater than largest uint8).\n *\n * Counterpart to Solidity's `uint8` operator.\n *\n * Requirements:\n *\n * - input must fit into 8 bits\n *\n * _Available since v2.5._\n */\n function toUint8(uint256 value) internal pure returns (uint8) {\n require(value <= type(uint8).max, \"SafeCast: value doesn't fit in 8 bits\");\n return uint8(value);\n }\n\n /**\n * @dev Converts a signed int256 into an unsigned uint256.\n *\n * Requirements:\n *\n * - input must be greater than or equal to 0.\n *\n * _Available since v3.0._\n */\n function toUint256(int256 value) internal pure returns (uint256) {\n require(value >= 0, \"SafeCast: value must be positive\");\n return uint256(value);\n }\n\n /**\n * @dev Returns the downcasted int248 from int256, reverting on\n * overflow (when the input is less than smallest int248 or\n * greater than largest int248).\n *\n * Counterpart to Solidity's `int248` operator.\n *\n * Requirements:\n *\n * - input must fit into 248 bits\n *\n * _Available since v4.7._\n */\n function toInt248(int256 value) internal pure returns (int248 downcasted) {\n downcasted = int248(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 248 bits\");\n }\n\n /**\n * @dev Returns the downcasted int240 from int256, reverting on\n * overflow (when the input is less than smallest int240 or\n * greater than largest int240).\n *\n * Counterpart to Solidity's `int240` operator.\n *\n * Requirements:\n *\n * - input must fit into 240 bits\n *\n * _Available since v4.7._\n */\n function toInt240(int256 value) internal pure returns (int240 downcasted) {\n downcasted = int240(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 240 bits\");\n }\n\n /**\n * @dev Returns the downcasted int232 from int256, reverting on\n * overflow (when the input is less than smallest int232 or\n * greater than largest int232).\n *\n * Counterpart to Solidity's `int232` operator.\n *\n * Requirements:\n *\n * - input must fit into 232 bits\n *\n * _Available since v4.7._\n */\n function toInt232(int256 value) internal pure returns (int232 downcasted) {\n downcasted = int232(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 232 bits\");\n }\n\n /**\n * @dev Returns the downcasted int224 from int256, reverting on\n * overflow (when the input is less than smallest int224 or\n * greater than largest int224).\n *\n * Counterpart to Solidity's `int224` operator.\n *\n * Requirements:\n *\n * - input must fit into 224 bits\n *\n * _Available since v4.7._\n */\n function toInt224(int256 value) internal pure returns (int224 downcasted) {\n downcasted = int224(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 224 bits\");\n }\n\n /**\n * @dev Returns the downcasted int216 from int256, reverting on\n * overflow (when the input is less than smallest int216 or\n * greater than largest int216).\n *\n * Counterpart to Solidity's `int216` operator.\n *\n * Requirements:\n *\n * - input must fit into 216 bits\n *\n * _Available since v4.7._\n */\n function toInt216(int256 value) internal pure returns (int216 downcasted) {\n downcasted = int216(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 216 bits\");\n }\n\n /**\n * @dev Returns the downcasted int208 from int256, reverting on\n * overflow (when the input is less than smallest int208 or\n * greater than largest int208).\n *\n * Counterpart to Solidity's `int208` operator.\n *\n * Requirements:\n *\n * - input must fit into 208 bits\n *\n * _Available since v4.7._\n */\n function toInt208(int256 value) internal pure returns (int208 downcasted) {\n downcasted = int208(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 208 bits\");\n }\n\n /**\n * @dev Returns the downcasted int200 from int256, reverting on\n * overflow (when the input is less than smallest int200 or\n * greater than largest int200).\n *\n * Counterpart to Solidity's `int200` operator.\n *\n * Requirements:\n *\n * - input must fit into 200 bits\n *\n * _Available since v4.7._\n */\n function toInt200(int256 value) internal pure returns (int200 downcasted) {\n downcasted = int200(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 200 bits\");\n }\n\n /**\n * @dev Returns the downcasted int192 from int256, reverting on\n * overflow (when the input is less than smallest int192 or\n * greater than largest int192).\n *\n * Counterpart to Solidity's `int192` operator.\n *\n * Requirements:\n *\n * - input must fit into 192 bits\n *\n * _Available since v4.7._\n */\n function toInt192(int256 value) internal pure returns (int192 downcasted) {\n downcasted = int192(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 192 bits\");\n }\n\n /**\n * @dev Returns the downcasted int184 from int256, reverting on\n * overflow (when the input is less than smallest int184 or\n * greater than largest int184).\n *\n * Counterpart to Solidity's `int184` operator.\n *\n * Requirements:\n *\n * - input must fit into 184 bits\n *\n * _Available since v4.7._\n */\n function toInt184(int256 value) internal pure returns (int184 downcasted) {\n downcasted = int184(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 184 bits\");\n }\n\n /**\n * @dev Returns the downcasted int176 from int256, reverting on\n * overflow (when the input is less than smallest int176 or\n * greater than largest int176).\n *\n * Counterpart to Solidity's `int176` operator.\n *\n * Requirements:\n *\n * - input must fit into 176 bits\n *\n * _Available since v4.7._\n */\n function toInt176(int256 value) internal pure returns (int176 downcasted) {\n downcasted = int176(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 176 bits\");\n }\n\n /**\n * @dev Returns the downcasted int168 from int256, reverting on\n * overflow (when the input is less than smallest int168 or\n * greater than largest int168).\n *\n * Counterpart to Solidity's `int168` operator.\n *\n * Requirements:\n *\n * - input must fit into 168 bits\n *\n * _Available since v4.7._\n */\n function toInt168(int256 value) internal pure returns (int168 downcasted) {\n downcasted = int168(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 168 bits\");\n }\n\n /**\n * @dev Returns the downcasted int160 from int256, reverting on\n * overflow (when the input is less than smallest int160 or\n * greater than largest int160).\n *\n * Counterpart to Solidity's `int160` operator.\n *\n * Requirements:\n *\n * - input must fit into 160 bits\n *\n * _Available since v4.7._\n */\n function toInt160(int256 value) internal pure returns (int160 downcasted) {\n downcasted = int160(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 160 bits\");\n }\n\n /**\n * @dev Returns the downcasted int152 from int256, reverting on\n * overflow (when the input is less than smallest int152 or\n * greater than largest int152).\n *\n * Counterpart to Solidity's `int152` operator.\n *\n * Requirements:\n *\n * - input must fit into 152 bits\n *\n * _Available since v4.7._\n */\n function toInt152(int256 value) internal pure returns (int152 downcasted) {\n downcasted = int152(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 152 bits\");\n }\n\n /**\n * @dev Returns the downcasted int144 from int256, reverting on\n * overflow (when the input is less than smallest int144 or\n * greater than largest int144).\n *\n * Counterpart to Solidity's `int144` operator.\n *\n * Requirements:\n *\n * - input must fit into 144 bits\n *\n * _Available since v4.7._\n */\n function toInt144(int256 value) internal pure returns (int144 downcasted) {\n downcasted = int144(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 144 bits\");\n }\n\n /**\n * @dev Returns the downcasted int136 from int256, reverting on\n * overflow (when the input is less than smallest int136 or\n * greater than largest int136).\n *\n * Counterpart to Solidity's `int136` operator.\n *\n * Requirements:\n *\n * - input must fit into 136 bits\n *\n * _Available since v4.7._\n */\n function toInt136(int256 value) internal pure returns (int136 downcasted) {\n downcasted = int136(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 136 bits\");\n }\n\n /**\n * @dev Returns the downcasted int128 from int256, reverting on\n * overflow (when the input is less than smallest int128 or\n * greater than largest int128).\n *\n * Counterpart to Solidity's `int128` operator.\n *\n * Requirements:\n *\n * - input must fit into 128 bits\n *\n * _Available since v3.1._\n */\n function toInt128(int256 value) internal pure returns (int128 downcasted) {\n downcasted = int128(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 128 bits\");\n }\n\n /**\n * @dev Returns the downcasted int120 from int256, reverting on\n * overflow (when the input is less than smallest int120 or\n * greater than largest int120).\n *\n * Counterpart to Solidity's `int120` operator.\n *\n * Requirements:\n *\n * - input must fit into 120 bits\n *\n * _Available since v4.7._\n */\n function toInt120(int256 value) internal pure returns (int120 downcasted) {\n downcasted = int120(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 120 bits\");\n }\n\n /**\n * @dev Returns the downcasted int112 from int256, reverting on\n * overflow (when the input is less than smallest int112 or\n * greater than largest int112).\n *\n * Counterpart to Solidity's `int112` operator.\n *\n * Requirements:\n *\n * - input must fit into 112 bits\n *\n * _Available since v4.7._\n */\n function toInt112(int256 value) internal pure returns (int112 downcasted) {\n downcasted = int112(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 112 bits\");\n }\n\n /**\n * @dev Returns the downcasted int104 from int256, reverting on\n * overflow (when the input is less than smallest int104 or\n * greater than largest int104).\n *\n * Counterpart to Solidity's `int104` operator.\n *\n * Requirements:\n *\n * - input must fit into 104 bits\n *\n * _Available since v4.7._\n */\n function toInt104(int256 value) internal pure returns (int104 downcasted) {\n downcasted = int104(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 104 bits\");\n }\n\n /**\n * @dev Returns the downcasted int96 from int256, reverting on\n * overflow (when the input is less than smallest int96 or\n * greater than largest int96).\n *\n * Counterpart to Solidity's `int96` operator.\n *\n * Requirements:\n *\n * - input must fit into 96 bits\n *\n * _Available since v4.7._\n */\n function toInt96(int256 value) internal pure returns (int96 downcasted) {\n downcasted = int96(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 96 bits\");\n }\n\n /**\n * @dev Returns the downcasted int88 from int256, reverting on\n * overflow (when the input is less than smallest int88 or\n * greater than largest int88).\n *\n * Counterpart to Solidity's `int88` operator.\n *\n * Requirements:\n *\n * - input must fit into 88 bits\n *\n * _Available since v4.7._\n */\n function toInt88(int256 value) internal pure returns (int88 downcasted) {\n downcasted = int88(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 88 bits\");\n }\n\n /**\n * @dev Returns the downcasted int80 from int256, reverting on\n * overflow (when the input is less than smallest int80 or\n * greater than largest int80).\n *\n * Counterpart to Solidity's `int80` operator.\n *\n * Requirements:\n *\n * - input must fit into 80 bits\n *\n * _Available since v4.7._\n */\n function toInt80(int256 value) internal pure returns (int80 downcasted) {\n downcasted = int80(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 80 bits\");\n }\n\n /**\n * @dev Returns the downcasted int72 from int256, reverting on\n * overflow (when the input is less than smallest int72 or\n * greater than largest int72).\n *\n * Counterpart to Solidity's `int72` operator.\n *\n * Requirements:\n *\n * - input must fit into 72 bits\n *\n * _Available since v4.7._\n */\n function toInt72(int256 value) internal pure returns (int72 downcasted) {\n downcasted = int72(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 72 bits\");\n }\n\n /**\n * @dev Returns the downcasted int64 from int256, reverting on\n * overflow (when the input is less than smallest int64 or\n * greater than largest int64).\n *\n * Counterpart to Solidity's `int64` operator.\n *\n * Requirements:\n *\n * - input must fit into 64 bits\n *\n * _Available since v3.1._\n */\n function toInt64(int256 value) internal pure returns (int64 downcasted) {\n downcasted = int64(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 64 bits\");\n }\n\n /**\n * @dev Returns the downcasted int56 from int256, reverting on\n * overflow (when the input is less than smallest int56 or\n * greater than largest int56).\n *\n * Counterpart to Solidity's `int56` operator.\n *\n * Requirements:\n *\n * - input must fit into 56 bits\n *\n * _Available since v4.7._\n */\n function toInt56(int256 value) internal pure returns (int56 downcasted) {\n downcasted = int56(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 56 bits\");\n }\n\n /**\n * @dev Returns the downcasted int48 from int256, reverting on\n * overflow (when the input is less than smallest int48 or\n * greater than largest int48).\n *\n * Counterpart to Solidity's `int48` operator.\n *\n * Requirements:\n *\n * - input must fit into 48 bits\n *\n * _Available since v4.7._\n */\n function toInt48(int256 value) internal pure returns (int48 downcasted) {\n downcasted = int48(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 48 bits\");\n }\n\n /**\n * @dev Returns the downcasted int40 from int256, reverting on\n * overflow (when the input is less than smallest int40 or\n * greater than largest int40).\n *\n * Counterpart to Solidity's `int40` operator.\n *\n * Requirements:\n *\n * - input must fit into 40 bits\n *\n * _Available since v4.7._\n */\n function toInt40(int256 value) internal pure returns (int40 downcasted) {\n downcasted = int40(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 40 bits\");\n }\n\n /**\n * @dev Returns the downcasted int32 from int256, reverting on\n * overflow (when the input is less than smallest int32 or\n * greater than largest int32).\n *\n * Counterpart to Solidity's `int32` operator.\n *\n * Requirements:\n *\n * - input must fit into 32 bits\n *\n * _Available since v3.1._\n */\n function toInt32(int256 value) internal pure returns (int32 downcasted) {\n downcasted = int32(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 32 bits\");\n }\n\n /**\n * @dev Returns the downcasted int24 from int256, reverting on\n * overflow (when the input is less than smallest int24 or\n * greater than largest int24).\n *\n * Counterpart to Solidity's `int24` operator.\n *\n * Requirements:\n *\n * - input must fit into 24 bits\n *\n * _Available since v4.7._\n */\n function toInt24(int256 value) internal pure returns (int24 downcasted) {\n downcasted = int24(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 24 bits\");\n }\n\n /**\n * @dev Returns the downcasted int16 from int256, reverting on\n * overflow (when the input is less than smallest int16 or\n * greater than largest int16).\n *\n * Counterpart to Solidity's `int16` operator.\n *\n * Requirements:\n *\n * - input must fit into 16 bits\n *\n * _Available since v3.1._\n */\n function toInt16(int256 value) internal pure returns (int16 downcasted) {\n downcasted = int16(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 16 bits\");\n }\n\n /**\n * @dev Returns the downcasted int8 from int256, reverting on\n * overflow (when the input is less than smallest int8 or\n * greater than largest int8).\n *\n * Counterpart to Solidity's `int8` operator.\n *\n * Requirements:\n *\n * - input must fit into 8 bits\n *\n * _Available since v3.1._\n */\n function toInt8(int256 value) internal pure returns (int8 downcasted) {\n downcasted = int8(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 8 bits\");\n }\n\n /**\n * @dev Converts an unsigned uint256 into a signed int256.\n *\n * Requirements:\n *\n * - input must be less than or equal to maxInt256.\n *\n * _Available since v3.0._\n */\n function toInt256(uint256 value) internal pure returns (int256) {\n // Note: Unsafe cast below is okay because `type(int256).max` is guaranteed to be positive\n require(value <= uint256(type(int256).max), \"SafeCast: value doesn't fit in an int256\");\n return int256(value);\n }\n}\n" + }, + "@openzeppelin/contracts/utils/StorageSlot.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/StorageSlot.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Library for reading and writing primitive types to specific storage slots.\n *\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\n * This library helps with reading and writing to such slots without the need for inline assembly.\n *\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\n *\n * Example usage to set ERC1967 implementation slot:\n * ```\n * contract ERC1967 {\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n *\n * function _getImplementation() internal view returns (address) {\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\n * }\n *\n * function _setImplementation(address newImplementation) internal {\n * require(Address.isContract(newImplementation), \"ERC1967: new implementation is not a contract\");\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\n * }\n * }\n * ```\n *\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\n */\nlibrary StorageSlot {\n struct AddressSlot {\n address value;\n }\n\n struct BooleanSlot {\n bool value;\n }\n\n struct Bytes32Slot {\n bytes32 value;\n }\n\n struct Uint256Slot {\n uint256 value;\n }\n\n /**\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\n */\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\n */\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\n */\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\n */\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Strings.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./math/Math.sol\";\n\n/**\n * @dev String operations.\n */\nlibrary Strings {\n bytes16 private constant _SYMBOLS = \"0123456789abcdef\";\n uint8 private constant _ADDRESS_LENGTH = 20;\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n */\n function toString(uint256 value) internal pure returns (string memory) {\n unchecked {\n uint256 length = Math.log10(value) + 1;\n string memory buffer = new string(length);\n uint256 ptr;\n /// @solidity memory-safe-assembly\n assembly {\n ptr := add(buffer, add(32, length))\n }\n while (true) {\n ptr--;\n /// @solidity memory-safe-assembly\n assembly {\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\n }\n value /= 10;\n if (value == 0) break;\n }\n return buffer;\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n */\n function toHexString(uint256 value) internal pure returns (string memory) {\n unchecked {\n return toHexString(value, Math.log256(value) + 1);\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n */\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n bytes memory buffer = new bytes(2 * length + 2);\n buffer[0] = \"0\";\n buffer[1] = \"x\";\n for (uint256 i = 2 * length + 1; i > 1; --i) {\n buffer[i] = _SYMBOLS[value & 0xf];\n value >>= 4;\n }\n require(value == 0, \"Strings: hex length insufficient\");\n return string(buffer);\n }\n\n /**\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\n */\n function toHexString(address addr) internal pure returns (string memory) {\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\n }\n}\n" + }, + "contracts/deprecated/OldDistributor.sol": { + "content": "// SPDX-License-Identifier: BUSL-1.1\n\n/*\n * █ \n ***** ▓▓▓ \n * ▓▓▓▓▓▓▓ \n * ///. ▓▓▓▓▓▓▓▓▓▓▓▓▓ \n ***** //////// ▓▓▓▓▓▓▓ \n * ///////////// ▓▓▓ \n ▓▓ ////////////////// █ ▓▓ \n ▓▓ ▓▓ /////////////////////// ▓▓ ▓▓ \n ▓▓ ▓▓ //////////////////////////// ▓▓ ▓▓ \n ▓▓ ▓▓ /////////▓▓▓///////▓▓▓///////// ▓▓ ▓▓ \n ▓▓ ,////////////////////////////////////// ▓▓ ▓▓ \n ▓▓ ////////////////////////////////////////// ▓▓ \n ▓▓ //////////////////////▓▓▓▓///////////////////// \n ,//////////////////////////////////////////////////// \n .////////////////////////////////////////////////////////// \n .//////////////////////////██.,//////////////////////////█ \n .//////////////////////████..,./////////////////////██ \n ...////////////////███████.....,.////////////////███ \n ,.,////////////████████ ........,///////////████ \n .,.,//////█████████ ,.......///////████ \n ,..//████████ ........./████ \n ..,██████ .....,███ \n .██ ,.,█ \n \n \n \n ▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓ ▓▓▓▓▓▓▓▓▓▓ \n ▓▓▓▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓ ▓▓ ▓▓▓▓ \n ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓ ▓▓▓▓▓ \n ▓▓▓ ▓▓ ▓▓▓ ▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ \n*/\n\npragma solidity ^0.8.17;\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport \"@openzeppelin/contracts/utils/math/SafeCast.sol\";\n\nimport \"../utils/UUPSHelper.sol\";\n\nstruct MerkleTree {\n // Root of a Merkle tree which leaves are `(address user, address token, uint amount)`\n // representing an amount of tokens accumulated by `user`.\n // The Merkle tree is assumed to have only increasing amounts: that is to say if a user can claim 1,\n // then after the amount associated in the Merkle tree for this token should be x > 1\n bytes32 merkleRoot;\n // Ipfs hash of the tree data\n bytes32 ipfsHash;\n}\n\nstruct Claim {\n uint208 amount;\n uint48 timestamp;\n}\n\n/// @title OldDistributor\n/// @notice Allows LPs on AMMs with concentrated liquidity to claim the rewards that were distributed to them\n/// @author Angle Labs. Inc\ncontract OldDistributor is UUPSHelper {\n using SafeERC20 for IERC20;\n\n // ================================= VARIABLES =================================\n\n /// @notice Tree of claimable tokens through this contract\n MerkleTree public tree;\n\n /// @notice Tree that was in place in the contract before the last `tree` update\n MerkleTree public lastTree;\n\n /// @notice Token to deposit to freeze the roots update\n IERC20 public disputeToken;\n\n /// @notice `Core` contract handling access control\n ICore public core;\n\n /// @notice Address which created the dispute\n /// @dev Used to store if there is an ongoing dispute\n address public disputer;\n\n /// @notice Last time the `tree` was updated\n uint48 public lastTreeUpdate;\n\n /// @notice Time before which a change in a tree becomes effective\n uint48 public disputePeriod;\n\n /// @notice Amount to deposit to freeze the roots update\n uint256 public disputeAmount;\n\n /// @notice Mapping user -> token -> amount to track claimed amounts\n mapping(address => mapping(address => Claim)) public claimed;\n\n /// @notice Trusted EOAs to update the Merkle root\n mapping(address => uint256) public canUpdateMerkleRoot;\n\n /// @notice Whether or not to disable permissionless claiming\n mapping(address => uint256) public onlyOperatorCanClaim;\n\n /// @notice user -> operator -> authorisation to claim\n mapping(address => mapping(address => uint256)) public operators;\n\n uint256[38] private __gap;\n\n // =================================== EVENTS ==================================\n\n event Claimed(address user, address token, uint256 amount);\n event Disputed(string reason);\n event DisputePeriodUpdated(uint48 _disputePeriod);\n event DisputeTokenUpdated(address indexed _disputeToken);\n event DisputeAmountUpdated(uint256 _disputeAmount);\n event DisputeResolved(bool valid);\n event OperatorClaimingToggled(address user, bool isEnabled);\n event OperatorToggled(address user, address operator, bool isWhitelisted);\n event Recovered(address indexed token, address indexed to, uint256 amount);\n event TreeUpdated(bytes32 merkleRoot, bytes32 ipfsHash);\n event TrustedToggled(address indexed eoa, bool trust);\n\n // ================================= MODIFIERS =================================\n\n /// @notice Checks whether the `msg.sender` has the governor role or the guardian role\n modifier onlyGovernorOrGuardian() {\n if (!core.isGovernorOrGuardian(msg.sender)) revert NotGovernorOrGuardian();\n _;\n }\n\n /// @notice Checks whether the `msg.sender` is the `user` address or is a trusted address\n modifier onlyTrustedOrUser(address user) {\n if (user != msg.sender && canUpdateMerkleRoot[msg.sender] != 1 && !core.isGovernorOrGuardian(msg.sender))\n revert NotTrusted();\n _;\n }\n\n // ================================ CONSTRUCTOR ================================\n\n constructor() initializer {}\n\n function initialize(ICore _core) external initializer {\n if (address(_core) == address(0)) revert ZeroAddress();\n core = _core;\n }\n\n /// @inheritdoc UUPSUpgradeable\n function _authorizeUpgrade(address) internal view override onlyGuardianUpgrader(core) {}\n\n // =============================== MAIN FUNCTION ===============================\n\n /// @notice Claims rewards for a given set of users\n /// @dev Anyone may call this function for anyone else, funds go to destination regardless, it's just a question of\n /// who provides the proof and pays the gas: `msg.sender` is used only for addresses that require a trusted operator\n /// @param users Recipient of tokens\n /// @param tokens ERC20 claimed\n /// @param amounts Amount of tokens that will be sent to the corresponding users\n /// @param proofs Array of hashes bridging from a leaf `(hash of user | token | amount)` to the Merkle root\n function claim(\n address[] calldata users,\n address[] calldata tokens,\n uint256[] calldata amounts,\n bytes32[][] calldata proofs\n ) external {\n uint256 usersLength = users.length;\n if (\n usersLength == 0 ||\n usersLength != tokens.length ||\n usersLength != amounts.length ||\n usersLength != proofs.length\n ) revert InvalidLengths();\n\n for (uint256 i; i < usersLength; ) {\n address user = users[i];\n address token = tokens[i];\n uint256 amount = amounts[i];\n\n // Checking if only an approved operator can claim for `user`\n if (onlyOperatorCanClaim[user] == 1 && operators[user][msg.sender] == 0) revert NotWhitelisted();\n\n // Verifying proof\n bytes32 leaf = keccak256(abi.encode(user, token, amount));\n if (!_verifyProof(leaf, proofs[i])) revert InvalidProof();\n\n // Closing reentrancy gate here\n uint256 toSend = amount - claimed[user][token].amount;\n claimed[user][token] = Claim(SafeCast.toUint208(amount), uint48(block.timestamp));\n\n IERC20(token).safeTransfer(user, toSend);\n emit Claimed(user, token, toSend);\n unchecked {\n ++i;\n }\n }\n }\n\n /// @notice Returns the MerkleRoot that is currently live for the contract\n function getMerkleRoot() public view returns (bytes32) {\n if (block.timestamp - lastTreeUpdate >= disputePeriod) return tree.merkleRoot;\n else return lastTree.merkleRoot;\n }\n\n // ============================ GOVERNANCE FUNCTIONS ===========================\n\n /// @notice Adds or removes EOAs which are trusted to update the Merkle root\n function toggleTrusted(address eoa) external onlyGovernorOrGuardian {\n uint256 trustedStatus = 1 - canUpdateMerkleRoot[eoa];\n canUpdateMerkleRoot[eoa] = trustedStatus;\n emit TrustedToggled(eoa, trustedStatus == 1);\n }\n\n /// @notice Updates Merkle Tree\n function updateTree(MerkleTree calldata _tree) external {\n if (\n disputer != address(0) ||\n // A trusted address cannot update a tree right after a precedent tree update otherwise it can de facto\n // validate a tree which has not passed the dispute period\n ((canUpdateMerkleRoot[msg.sender] != 1 || block.timestamp - lastTreeUpdate < disputePeriod) &&\n !core.isGovernorOrGuardian(msg.sender))\n ) revert NotTrusted();\n MerkleTree memory _lastTree = tree;\n tree = _tree;\n lastTree = _lastTree;\n lastTreeUpdate = uint48(block.timestamp);\n emit TreeUpdated(_tree.merkleRoot, _tree.ipfsHash);\n }\n\n /// @notice Freezes the Merkle tree update until the dispute is resolved\n /// @dev Requires a deposit of `disputeToken` that'll be slashed if the dispute is not accepted\n /// @dev It is only possible to create a dispute for `disputePeriod` after each tree update\n function disputeTree(string memory reason) external {\n if (block.timestamp - lastTreeUpdate >= disputePeriod) revert InvalidDispute();\n IERC20(disputeToken).safeTransferFrom(msg.sender, address(this), disputeAmount);\n disputer = msg.sender;\n emit Disputed(reason);\n }\n\n /// @notice Resolve the ongoing dispute, if any\n /// @param valid Whether the dispute was valid\n function resolveDispute(bool valid) external onlyGovernorOrGuardian {\n if (disputer == address(0)) revert NoDispute();\n if (valid) {\n IERC20(disputeToken).safeTransfer(disputer, disputeAmount);\n // If a dispute is valid, the contract falls back to the last tree that was updated\n _revokeTree();\n } else {\n IERC20(disputeToken).safeTransfer(msg.sender, disputeAmount);\n lastTreeUpdate = uint48(block.timestamp);\n }\n disputer = address(0);\n emit DisputeResolved(valid);\n }\n\n /// @notice Allows the governor or the guardian of this contract to fallback to the last version of the tree\n /// immediately\n function revokeTree() external onlyGovernorOrGuardian {\n if (disputer != address(0)) revert UnresolvedDispute();\n _revokeTree();\n }\n\n /// @notice Toggles permissioned claiming for a given user\n function toggleOnlyOperatorCanClaim(address user) external onlyTrustedOrUser(user) {\n uint256 oldValue = onlyOperatorCanClaim[user];\n onlyOperatorCanClaim[user] = 1 - oldValue;\n emit OperatorClaimingToggled(user, oldValue == 0);\n }\n\n /// @notice Toggles whitelisting for a given user and a given operator\n function toggleOperator(address user, address operator) external onlyTrustedOrUser(user) {\n uint256 oldValue = operators[user][operator];\n operators[user][operator] = 1 - oldValue;\n emit OperatorToggled(user, operator, oldValue == 0);\n }\n\n /// @notice Recovers any ERC20 token\n function recoverERC20(address tokenAddress, address to, uint256 amountToRecover) external onlyGovernorOrGuardian {\n IERC20(tokenAddress).safeTransfer(to, amountToRecover);\n emit Recovered(tokenAddress, to, amountToRecover);\n }\n\n /// @notice Sets the dispute period before which a tree update becomes effective\n function setDisputePeriod(uint48 _disputePeriod) external onlyGovernorOrGuardian {\n if (_disputePeriod > block.timestamp) revert InvalidParam();\n disputePeriod = uint48(_disputePeriod);\n emit DisputePeriodUpdated(_disputePeriod);\n }\n\n /// @notice Sets the token used as a caution during disputes\n function setDisputeToken(IERC20 _disputeToken) external onlyGovernorOrGuardian {\n if (disputer != address(0)) revert UnresolvedDispute();\n disputeToken = _disputeToken;\n emit DisputeTokenUpdated(address(_disputeToken));\n }\n\n /// @notice Sets the amount of `disputeToken` used as a caution during disputes\n function setDisputeAmount(uint256 _disputeAmount) external onlyGovernorOrGuardian {\n if (disputer != address(0)) revert UnresolvedDispute();\n disputeAmount = _disputeAmount;\n emit DisputeAmountUpdated(_disputeAmount);\n }\n\n // ============================= INTERNAL FUNCTIONS ============================\n\n /// @notice Fallback to the last version of the tree\n function _revokeTree() internal {\n MerkleTree memory _tree = lastTree;\n lastTreeUpdate = 0;\n tree = _tree;\n emit TreeUpdated(_tree.merkleRoot, _tree.ipfsHash);\n }\n\n /// @notice Checks the validity of a proof\n /// @param leaf Hashed leaf data, the starting point of the proof\n /// @param proof Array of hashes forming a hash chain from leaf to root\n /// @return true If proof is correct, else false\n function _verifyProof(bytes32 leaf, bytes32[] memory proof) internal view returns (bool) {\n bytes32 currentHash = leaf;\n uint256 proofLength = proof.length;\n for (uint256 i; i < proofLength; ) {\n if (currentHash < proof[i]) {\n currentHash = keccak256(abi.encode(currentHash, proof[i]));\n } else {\n currentHash = keccak256(abi.encode(proof[i], currentHash));\n }\n unchecked {\n ++i;\n }\n }\n bytes32 root = getMerkleRoot();\n if (root == bytes32(0)) revert InvalidUninitializedRoot();\n return currentHash == root;\n }\n}\n" + }, + "contracts/DistributionCreator.sol": { + "content": "// SPDX-License-Identifier: BUSL-1.1\n\n/*\n * █ \n ***** ▓▓▓ \n * ▓▓▓▓▓▓▓ \n * ///. ▓▓▓▓▓▓▓▓▓▓▓▓▓ \n ***** //////// ▓▓▓▓▓▓▓ \n * ///////////// ▓▓▓ \n ▓▓ ////////////////// █ ▓▓ \n ▓▓ ▓▓ /////////////////////// ▓▓ ▓▓ \n ▓▓ ▓▓ //////////////////////////// ▓▓ ▓▓ \n ▓▓ ▓▓ /////////▓▓▓///////▓▓▓///////// ▓▓ ▓▓ \n ▓▓ ,////////////////////////////////////// ▓▓ ▓▓ \n ▓▓ ////////////////////////////////////////// ▓▓ \n ▓▓ //////////////////////▓▓▓▓///////////////////// \n ,//////////////////////////////////////////////////// \n .////////////////////////////////////////////////////////// \n .//////////////////////////██.,//////////////////////////█ \n .//////////////////////████..,./////////////////////██ \n ...////////////////███████.....,.////////////////███ \n ,.,////////////████████ ........,///////////████ \n .,.,//////█████████ ,.......///////████ \n ,..//████████ ........./████ \n ..,██████ .....,███ \n .██ ,.,█ \n \n \n \n ▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓ ▓▓▓▓▓▓▓▓▓▓ \n ▓▓▓▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓ ▓▓ ▓▓▓▓ \n ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓ ▓▓▓▓▓ \n ▓▓▓ ▓▓ ▓▓▓ ▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ \n*/\n\npragma solidity ^0.8.17;\n\nimport { ReentrancyGuardUpgradeable } from \"@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol\";\nimport { IERC20, IERC20Metadata } from \"@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol\";\nimport { SafeERC20 } from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport { ECDSA } from \"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\";\n\nimport { IUniswapV3Pool } from \"./interfaces/external/uniswap/IUniswapV3Pool.sol\";\nimport { IAlgebraPool } from \"./interfaces/external/algebra/IAlgebraPool.sol\";\n\nimport \"./utils/UUPSHelper.sol\";\nimport { DistributionParameters } from \"./struct/DistributionParameters.sol\";\nimport { UniswapTokenData, ExtensiveDistributionParameters } from \"./struct/ExtensiveDistributionParameters.sol\";\nimport { RewardTokenAmounts } from \"./struct/RewardTokenAmounts.sol\";\n\ninterface IDistributionCreator {\n function tryGetExtensiveDistributionParameters(\n DistributionParameters memory distribution\n ) external view returns (bool success, ExtensiveDistributionParameters memory extensiveParams);\n}\n\n/// @title DistributionCreator\n/// @author Angle Labs, Inc.\n/// @notice Manages the distribution of rewards across different pools with concentrated liquidity (like on Uniswap V3)\n/// @dev This contract is mostly a helper for APIs built on top of Merkl\n/// @dev People depositing rewards must have signed a `message` with the conditions for using the\n/// product\n//solhint-disable\ncontract DistributionCreator is UUPSHelper, ReentrancyGuardUpgradeable {\n using SafeERC20 for IERC20;\n\n // =========================== CONSTANTS / VARIABLES ===========================\n\n /// @notice Epoch duration\n uint32 public constant EPOCH_DURATION = 3600;\n\n /// @notice Base for fee computation\n uint256 public constant BASE_9 = 1e9;\n\n /// @notice `Core` contract handling access control\n ICore public core;\n\n /// @notice User contract for distributing rewards\n address public distributor;\n\n /// @notice Address to which fees are forwarded\n address public feeRecipient;\n\n /// @notice Value (in base 10**9) of the fees taken when creating a distribution for a pool which do not\n /// have a whitelisted token in it\n uint256 public fees;\n\n /// @notice Message that needs to be acknowledged by users creating a distribution\n string public message;\n\n /// @notice Hash of the message that needs to be signed\n bytes32 public messageHash;\n\n /// @notice List of all rewards ever distributed or to be distributed in the contract\n /// @dev An attacker could try to populate this list. It shouldn't be an issue as only view functions\n /// iterate on it\n DistributionParameters[] public distributionList;\n\n /// @notice Maps an address to its fee rebate\n mapping(address => uint256) public feeRebate;\n\n /// @notice Maps a token to whether it is whitelisted or not. No fees are to be paid for incentives given\n /// on pools with whitelisted tokens\n mapping(address => uint256) public isWhitelistedToken;\n\n /// @notice Maps an address to its nonce for creating a distribution\n mapping(address => uint256) public nonces;\n\n /// @notice Maps an address to the last valid hash signed\n mapping(address => bytes32) public userSignatures;\n\n /// @notice Maps a user to whether it is whitelisted for not signing\n mapping(address => uint256) public userSignatureWhitelist;\n\n /// @notice Maps a token to the minimum amount that must be sent per epoch for a distribution to be valid\n /// @dev If `rewardTokenMinAmounts[token] == 0`, then `token` cannot be used as a reward\n mapping(address => uint256) public rewardTokenMinAmounts;\n\n /// @notice List of all reward tokens that have at some point been accepted\n address[] public rewardTokens;\n\n uint256[36] private __gap;\n\n // =================================== EVENTS ==================================\n\n event DistributorUpdated(address indexed _distributor);\n event FeeRebateUpdated(address indexed user, uint256 userFeeRebate);\n event FeeRecipientUpdated(address indexed _feeRecipient);\n event FeesSet(uint256 _fees);\n event MessageUpdated(bytes32 _messageHash);\n event NewDistribution(DistributionParameters distribution, address indexed sender);\n event RewardTokenMinimumAmountUpdated(address indexed token, uint256 amount);\n event TokenWhitelistToggled(address indexed token, uint256 toggleStatus);\n event UserSigned(bytes32 messageHash, address indexed user);\n event UserSigningWhitelistToggled(address indexed user, uint256 toggleStatus);\n\n // ================================= MODIFIERS =================================\n\n /// @notice Checks whether the `msg.sender` has the governor role or the guardian role\n modifier onlyGovernorOrGuardian() {\n if (!core.isGovernorOrGuardian(msg.sender)) revert NotGovernorOrGuardian();\n _;\n }\n\n /// @notice Checks whether an address has signed the message or not\n modifier hasSigned() {\n if (\n userSignatureWhitelist[msg.sender] == 0 &&\n userSignatures[msg.sender] != messageHash &&\n userSignatureWhitelist[tx.origin] == 0 &&\n userSignatures[tx.origin] != messageHash\n ) revert NotSigned();\n _;\n }\n\n // ================================ CONSTRUCTOR ================================\n\n function initialize(ICore _core, address _distributor, uint256 _fees) external initializer {\n if (address(_core) == address(0) || _distributor == address(0)) revert ZeroAddress();\n if (_fees >= BASE_9) revert InvalidParam();\n distributor = _distributor;\n core = _core;\n fees = _fees;\n }\n\n constructor() initializer {}\n\n /// @inheritdoc UUPSUpgradeable\n function _authorizeUpgrade(address) internal view override onlyGuardianUpgrader(core) {}\n\n // ============================== DEPOSIT FUNCTION =============================\n\n /// @notice Creates a `distribution` to incentivize a given pool for a specific period of time\n /// @return distributionAmount How many reward tokens are actually taken into consideration in the contract\n /// @dev If the address specified as a UniV3 pool is not effectively a pool, it will not be handled by the\n /// distribution script and rewards may be lost\n /// @dev Reward tokens sent as part of distributions must have been whitelisted before and amounts\n /// sent should be bigger than a minimum amount specific to each token\n /// @dev The `positionWrappers` specified in the `distribution` struct need to be supported by the script\n /// List of supported `positionWrappers` can be found in the docs.\n /// @dev If the pool incentivized contains one whitelisted token, then no fees are taken on the rewards\n /// @dev This function reverts if the sender has not signed the message `messageHash` once through one of\n /// the functions enabling to sign\n function createDistribution(\n DistributionParameters memory distribution\n ) external hasSigned returns (uint256 distributionAmount) {\n return _createDistribution(distribution);\n }\n\n /// @notice Same as the function above but for multiple distributions at once\n /// @return List of all the distribution amounts actually deposited for each `distribution` in the `distributions` list\n function createDistributions(\n DistributionParameters[] memory distributions\n ) external hasSigned returns (uint256[] memory) {\n uint256 distributionsLength = distributions.length;\n uint256[] memory distributionAmounts = new uint256[](distributionsLength);\n for (uint256 i; i < distributionsLength; ) {\n distributionAmounts[i] = _createDistribution(distributions[i]);\n unchecked {\n ++i;\n }\n }\n return distributionAmounts;\n }\n\n /// @notice Checks whether the `msg.sender`'s `signature` is compatible with the message\n /// to sign and stores the signature\n /// @dev If you signed the message once, and the message has not been modified, then you do not\n /// need to sign again\n function sign(bytes calldata signature) external {\n _sign(signature);\n }\n\n /// @notice Combines signing the message and creating a distribution\n function signAndCreateDistribution(\n DistributionParameters memory distribution,\n bytes calldata signature\n ) external returns (uint256 distributionAmount) {\n _sign(signature);\n return _createDistribution(distribution);\n }\n\n /// @notice Internal version of `createDistribution`\n function _createDistribution(\n DistributionParameters memory distribution\n ) internal nonReentrant returns (uint256 distributionAmount) {\n uint32 epochStart = _getRoundedEpoch(distribution.epochStart);\n uint256 minDistributionAmount = rewardTokenMinAmounts[distribution.rewardToken];\n distribution.epochStart = epochStart;\n // Reward are not accepted in the following conditions:\n if (\n // if epoch parameters lead to a past distribution\n epochStart + EPOCH_DURATION < block.timestamp ||\n // if the amount of epochs for which this distribution should last is zero\n distribution.numEpoch == 0 ||\n // if the distribution parameters are not correctly specified\n distribution.propFees + distribution.propToken0 + distribution.propToken1 != 1e4 ||\n // if boosted addresses get less than non-boosted addresses in case of\n (distribution.boostingAddress != address(0) && distribution.boostedReward < 1e4) ||\n // if the type of the position wrappers is not well specified\n distribution.positionWrappers.length != distribution.wrapperTypes.length ||\n // if the reward token is not whitelisted as an incentive token\n minDistributionAmount == 0 ||\n // if the amount distributed is too small with respect to what is allowed\n distribution.amount / distribution.numEpoch < minDistributionAmount\n ) revert InvalidReward();\n distributionAmount = distribution.amount;\n // Computing fees: these are waived for whitelisted addresses and if there is a whitelisted token in a pool\n uint256 userFeeRebate = feeRebate[msg.sender];\n if (\n userFeeRebate < BASE_9 &&\n // Algebra pools also have these `token0` and `token1` parameters\n isWhitelistedToken[IUniswapV3Pool(distribution.uniV3Pool).token0()] == 0 &&\n isWhitelistedToken[IUniswapV3Pool(distribution.uniV3Pool).token1()] == 0\n ) {\n uint256 _fees = (fees * (BASE_9 - userFeeRebate)) / BASE_9;\n uint256 distributionAmountMinusFees = (distributionAmount * (BASE_9 - _fees)) / BASE_9;\n address _feeRecipient = feeRecipient;\n _feeRecipient = _feeRecipient == address(0) ? address(this) : _feeRecipient;\n IERC20(distribution.rewardToken).safeTransferFrom(\n msg.sender,\n _feeRecipient,\n distributionAmount - distributionAmountMinusFees\n );\n distributionAmount = distributionAmountMinusFees;\n distribution.amount = distributionAmount;\n }\n\n IERC20(distribution.rewardToken).safeTransferFrom(msg.sender, distributor, distributionAmount);\n uint256 senderNonce = nonces[msg.sender];\n nonces[msg.sender] = senderNonce + 1;\n distribution.rewardId = bytes32(keccak256(abi.encodePacked(msg.sender, senderNonce)));\n distributionList.push(distribution);\n emit NewDistribution(distribution, msg.sender);\n }\n\n /// @notice Internal version of the `sign` function\n function _sign(bytes calldata signature) internal {\n bytes32 _messageHash = messageHash;\n if (ECDSA.recover(_messageHash, signature) != msg.sender) revert InvalidSignature();\n userSignatures[msg.sender] = _messageHash;\n emit UserSigned(_messageHash, msg.sender);\n }\n\n // ================================= UI HELPERS ================================\n // These functions are not to be queried on-chain and hence are not optimized for gas consumption\n\n /// @notice Returns the list of all distributions ever made or to be done in the future\n function getAllDistributions() external view returns (DistributionParameters[] memory) {\n return distributionList;\n }\n\n /// @notice Returns the list of all currently active distributions on pools of supported AMMs (like Uniswap V3)\n function getActiveDistributions()\n external\n view\n returns (ExtensiveDistributionParameters[] memory searchDistributions)\n {\n uint32 roundedEpoch = _getRoundedEpoch(uint32(block.timestamp));\n (searchDistributions, ) = _getPoolDistributionsBetweenEpochs(\n address(0),\n roundedEpoch,\n roundedEpoch + EPOCH_DURATION,\n 0,\n type(uint32).max\n );\n }\n\n /// @notice Similar to `getActiveDistributions()` with additional parameters to prevent out of gas error\n /// @param skip Disregard distibutions with a global index lower than `skip`\n /// @param first Limit the length of the returned array to `first`\n /// @return searchDistributions Eligible distributions\n /// @return lastIndexDistribution Index of the last distribution assessed in the list of all distributions\n /// For pagniation purpose, in case of out of gas, you can call back the same function but with `skip` set to `lastIndexDistribution`\n function getActiveDistributions(\n uint32 skip,\n uint32 first\n )\n external\n view\n returns (ExtensiveDistributionParameters[] memory searchDistributions, uint256 lastIndexDistribution)\n {\n uint32 roundedEpoch = _getRoundedEpoch(uint32(block.timestamp));\n return _getPoolDistributionsBetweenEpochs(address(0), roundedEpoch, roundedEpoch + EPOCH_DURATION, skip, first);\n }\n\n /// @notice Returns the list of all the reward tokens supported as well as their minimum amounts\n function getValidRewardTokens() external view returns (RewardTokenAmounts[] memory) {\n uint256 length;\n uint256 rewardTokenListLength = rewardTokens.length;\n RewardTokenAmounts[] memory validRewardTokens = new RewardTokenAmounts[](rewardTokenListLength);\n for (uint32 i; i < rewardTokenListLength; ) {\n address token = rewardTokens[i];\n uint256 minAmount = rewardTokenMinAmounts[token];\n if (minAmount > 0) {\n validRewardTokens[length] = RewardTokenAmounts(token, minAmount);\n length += 1;\n }\n unchecked {\n ++i;\n }\n }\n assembly {\n mstore(validRewardTokens, length)\n }\n return validRewardTokens;\n }\n\n /// @notice Returns the list of all the distributions that were or that are going to be live at\n /// a specific epoch\n function getDistributionsForEpoch(\n uint32 epoch\n ) external view returns (ExtensiveDistributionParameters[] memory searchDistributions) {\n uint32 roundedEpoch = _getRoundedEpoch(epoch);\n (searchDistributions, ) = _getPoolDistributionsBetweenEpochs(\n address(0),\n roundedEpoch,\n roundedEpoch + EPOCH_DURATION,\n 0,\n type(uint32).max\n );\n }\n\n /// @notice Similar to `getDistributionsForEpoch(uint256 epoch)` with additional parameters to prevent out of gas error\n /// @param skip Disregard distibutions with a global index lower than `skip`\n /// @param first Limit the length of the returned array to `first`\n /// @return searchDistributions Eligible distributions\n /// @return lastIndexDistribution Index of the last distribution assessed in the list of all distributions\n /// For pagniation purpose, in case of out of gas, you can call back the same function but with `skip` set to `lastIndexDistribution`\n function getDistributionsForEpoch(\n uint32 epoch,\n uint32 skip,\n uint32 first\n ) external view returns (ExtensiveDistributionParameters[] memory, uint256 lastIndexDistribution) {\n uint32 roundedEpoch = _getRoundedEpoch(epoch);\n return _getPoolDistributionsBetweenEpochs(address(0), roundedEpoch, roundedEpoch + EPOCH_DURATION, skip, first);\n }\n\n /// @notice Gets the distributions that were or will be live at some point between `epochStart` (included) and `epochEnd` (excluded)\n /// @dev If a distribution starts during `epochEnd`, it is not be returned by this function\n /// @dev Conversely, if a distribution starts after `epochStart` and ends before `epochEnd`, it is returned by this function\n function getDistributionsBetweenEpochs(\n uint32 epochStart,\n uint32 epochEnd\n ) external view returns (ExtensiveDistributionParameters[] memory searchDistributions) {\n (searchDistributions, ) = _getPoolDistributionsBetweenEpochs(\n address(0),\n _getRoundedEpoch(epochStart),\n _getRoundedEpoch(epochEnd),\n 0,\n type(uint32).max\n );\n }\n\n /// @notice Similar to `getDistributionsBetweenEpochs(uint256 epochStart, uint256 epochEnd)` with additional parameters to prevent out of gas error\n /// @param skip Disregard distibutions with a global index lower than `skip`\n /// @param first Limit the length of the returned array to `first`\n /// @return searchDistributions Eligible distributions\n /// @return lastIndexDistribution Index of the last distribution assessed in the list of all distributions\n /// For pagniation purpose, in case of out of gas, you can call back the same function but with `skip` set to `lastIndexDistribution`\n function getDistributionsBetweenEpochs(\n uint32 epochStart,\n uint32 epochEnd,\n uint32 skip,\n uint32 first\n ) external view returns (ExtensiveDistributionParameters[] memory, uint256 lastIndexDistribution) {\n return\n _getPoolDistributionsBetweenEpochs(\n address(0),\n _getRoundedEpoch(epochStart),\n _getRoundedEpoch(epochEnd),\n skip,\n first\n );\n }\n\n /// @notice Returns the list of all distributions that were or will be live after `epochStart` (included)\n function getDistributionsAfterEpoch(\n uint32 epochStart\n ) external view returns (ExtensiveDistributionParameters[] memory searchDistributions) {\n (searchDistributions, ) = _getPoolDistributionsBetweenEpochs(\n address(0),\n _getRoundedEpoch(epochStart),\n type(uint32).max,\n 0,\n type(uint32).max\n );\n }\n\n /// @notice Similar to `getDistributionsAfterEpoch(uint256 epochStart)` with additional parameters to prevent out of gas error\n /// @param skip Disregard distibutions with a global index lower than `skip`\n /// @param first Limit the length of the returned array to `first`\n /// @return searchDistributions Eligible distributions\n /// @return lastIndexDistribution Index of the last distribution assessed in the list of all distributions\n /// For pagniation purpose, in case of out of gas, you can call back the same function but with `skip` set to `lastIndexDistribution`\n function getDistributionsAfterEpoch(\n uint32 epochStart,\n uint32 skip,\n uint32 first\n ) external view returns (ExtensiveDistributionParameters[] memory, uint256 lastIndexDistribution) {\n return\n _getPoolDistributionsBetweenEpochs(address(0), _getRoundedEpoch(epochStart), type(uint32).max, skip, first);\n }\n\n /// @notice Returns the list of all currently active distributions for a specific UniswapV3 pool\n function getActivePoolDistributions(\n address uniV3Pool\n ) external view returns (ExtensiveDistributionParameters[] memory searchDistributions) {\n uint32 roundedEpoch = _getRoundedEpoch(uint32(block.timestamp));\n (searchDistributions, ) = _getPoolDistributionsBetweenEpochs(\n uniV3Pool,\n roundedEpoch,\n roundedEpoch + EPOCH_DURATION,\n 0,\n type(uint32).max\n );\n }\n\n /// @notice Similar to `getActivePoolDistributions(address uniV3Pool)` with additional parameters to prevent out of gas error\n /// @param skip Disregard distibutions with a global index lower than `skip`\n /// @param first Limit the length of the returned array to `first`\n /// @return searchDistributions Eligible distributions\n /// @return lastIndexDistribution Index of the last distribution assessed in the list of all distributions\n /// For pagniation purpose, in case of out of gas, you can call back the same function but with `skip` set to `lastIndexDistribution`\n function getActivePoolDistributions(\n address uniV3Pool,\n uint32 skip,\n uint32 first\n ) external view returns (ExtensiveDistributionParameters[] memory, uint256 lastIndexDistribution) {\n uint32 roundedEpoch = _getRoundedEpoch(uint32(block.timestamp));\n return _getPoolDistributionsBetweenEpochs(uniV3Pool, roundedEpoch, roundedEpoch + EPOCH_DURATION, skip, first);\n }\n\n /// @notice Returns the list of all the distributions that were or that are going to be live at a\n /// specific epoch and for a specific pool\n function getPoolDistributionsForEpoch(\n address uniV3Pool,\n uint32 epoch\n ) external view returns (ExtensiveDistributionParameters[] memory searchDistributions) {\n uint32 roundedEpoch = _getRoundedEpoch(epoch);\n (searchDistributions, ) = _getPoolDistributionsBetweenEpochs(\n uniV3Pool,\n roundedEpoch,\n roundedEpoch + EPOCH_DURATION,\n 0,\n type(uint32).max\n );\n }\n\n /// @notice Similar to `getPoolDistributionsForEpoch(address uniV3Pool,uint32 epoch)` with additional parameters to prevent out of gas error\n /// @param skip Disregard distibutions with a global index lower than `skip`\n /// @param first Limit the length of the returned array to `first`\n /// @return searchDistributions Eligible distributions\n /// @return lastIndexDistribution Index of the last distribution assessed in the list of all distributions\n /// For pagniation purpose, in case of out of gas, you can call back the same function but with `skip` set to `lastIndexDistribution`\n function getPoolDistributionsForEpoch(\n address uniV3Pool,\n uint32 epoch,\n uint32 skip,\n uint32 first\n ) external view returns (ExtensiveDistributionParameters[] memory, uint256 lastIndexDistribution) {\n uint32 roundedEpoch = _getRoundedEpoch(epoch);\n return _getPoolDistributionsBetweenEpochs(uniV3Pool, roundedEpoch, roundedEpoch + EPOCH_DURATION, skip, first);\n }\n\n /// @notice Returns the list of all distributions that were or will be live at some point between\n /// `epochStart` (included) and `epochEnd` (excluded) for a specific pool\n function getPoolDistributionsBetweenEpochs(\n address uniV3Pool,\n uint32 epochStart,\n uint32 epochEnd\n ) external view returns (ExtensiveDistributionParameters[] memory searchDistributions) {\n (searchDistributions, ) = _getPoolDistributionsBetweenEpochs(\n uniV3Pool,\n _getRoundedEpoch(epochStart),\n _getRoundedEpoch(epochEnd),\n 0,\n type(uint32).max\n );\n }\n\n /// @notice Similar to `getPoolDistributionsBetweenEpochs(address uniV3Pool,uint32 epochStart, uint32 epochEnd)` with additional parameters to prevent out of gas error\n /// @param skip Disregard distibutions with a global index lower than `skip`\n /// @param first Limit the length of the returned array to `first`\n /// @return searchDistributions Eligible distributions\n /// @return lastIndexDistribution Index of the last distribution assessed in the list of all distributions\n /// For pagniation purpose, in case of out of gas, you can call back the same function but with `skip` set to `lastIndexDistribution`\n function getPoolDistributionsBetweenEpochs(\n address uniV3Pool,\n uint32 epochStart,\n uint32 epochEnd,\n uint32 skip,\n uint32 first\n ) external view returns (ExtensiveDistributionParameters[] memory, uint256 lastIndexDistribution) {\n return\n _getPoolDistributionsBetweenEpochs(\n uniV3Pool,\n _getRoundedEpoch(epochStart),\n _getRoundedEpoch(epochEnd),\n skip,\n first\n );\n }\n\n /// @notice Returns the list of all distributions that were or will be live after `epochStart` (included)\n /// for a specific pool\n function getPoolDistributionsAfterEpoch(\n address uniV3Pool,\n uint32 epochStart\n ) external view returns (ExtensiveDistributionParameters[] memory searchDistributions) {\n (searchDistributions, ) = _getPoolDistributionsBetweenEpochs(\n uniV3Pool,\n _getRoundedEpoch(epochStart),\n type(uint32).max,\n 0,\n type(uint32).max\n );\n }\n\n /// @notice Similar to `getPoolDistributionsAfterEpoch(address uniV3Pool,uint32 epochStart)` with additional parameters to prevent out of gas error\n /// @param skip Disregard distibutions with a global index lower than `skip`\n /// @param first Limit the length of the returned array to `first`\n /// @return searchDistributions Eligible distributions\n /// @return lastIndexDistribution Index of the last distribution assessed in the list of all distributions\n /// For pagniation purpose, in case of out of gas, you can call back the same function but with `skip` set to `lastIndexDistribution`\n function getPoolDistributionsAfterEpoch(\n address uniV3Pool,\n uint32 epochStart,\n uint32 skip,\n uint32 first\n ) external view returns (ExtensiveDistributionParameters[] memory, uint256 lastIndexDistribution) {\n return\n _getPoolDistributionsBetweenEpochs(uniV3Pool, _getRoundedEpoch(epochStart), type(uint32).max, skip, first);\n }\n\n // ============================ GOVERNANCE FUNCTIONS ===========================\n\n /// @notice Sets a new `distributor` to which rewards should be distributed\n function setNewDistributor(address _distributor) external onlyGovernorOrGuardian {\n if (_distributor == address(0)) revert InvalidParam();\n distributor = _distributor;\n emit DistributorUpdated(_distributor);\n }\n\n /// @notice Sets the fees on deposit\n function setFees(uint256 _fees) external onlyGovernorOrGuardian {\n if (_fees >= BASE_9) revert InvalidParam();\n fees = _fees;\n emit FeesSet(_fees);\n }\n\n /// @notice Sets fee rebates for a given user\n function setUserFeeRebate(address user, uint256 userFeeRebate) external onlyGovernorOrGuardian {\n feeRebate[user] = userFeeRebate;\n emit FeeRebateUpdated(user, userFeeRebate);\n }\n\n /// @notice Toggles the fee whitelist for `token`\n function toggleTokenWhitelist(address token) external onlyGovernorOrGuardian {\n uint256 toggleStatus = 1 - isWhitelistedToken[token];\n isWhitelistedToken[token] = toggleStatus;\n emit TokenWhitelistToggled(token, toggleStatus);\n }\n\n /// @notice Recovers fees accrued on the contract for a list of `tokens`\n function recoverFees(IERC20[] calldata tokens, address to) external onlyGovernorOrGuardian {\n uint256 tokensLength = tokens.length;\n for (uint256 i; i < tokensLength; ) {\n tokens[i].safeTransfer(to, tokens[i].balanceOf(address(this)));\n unchecked {\n ++i;\n }\n }\n }\n\n /// @notice Sets the minimum amounts per distribution epoch for different reward tokens\n function setRewardTokenMinAmounts(\n address[] calldata tokens,\n uint256[] calldata amounts\n ) external onlyGovernorOrGuardian {\n uint256 tokensLength = tokens.length;\n if (tokensLength != amounts.length) revert InvalidLengths();\n for (uint256 i; i < tokensLength; ++i) {\n uint256 amount = amounts[i];\n // Basic logic check to make sure there are no duplicates in the `rewardTokens` table. If a token is\n // removed then re-added, it will appear as a duplicate in the list\n if (amount > 0 && rewardTokenMinAmounts[tokens[i]] == 0) rewardTokens.push(tokens[i]);\n rewardTokenMinAmounts[tokens[i]] = amount;\n emit RewardTokenMinimumAmountUpdated(tokens[i], amount);\n }\n }\n\n /// @notice Sets a new address to receive fees\n function setFeeRecipient(address _feeRecipient) external onlyGovernorOrGuardian {\n feeRecipient = _feeRecipient;\n emit FeeRecipientUpdated(_feeRecipient);\n }\n\n /// @notice Sets the message that needs to be signed by users before posting rewards\n function setMessage(string memory _message) external onlyGovernorOrGuardian {\n message = _message;\n bytes32 _messageHash = ECDSA.toEthSignedMessageHash(bytes(_message));\n messageHash = _messageHash;\n emit MessageUpdated(_messageHash);\n }\n\n /// @notice Toggles the whitelist status for `user` when it comes to signing messages before depositing rewards.\n function toggleSigningWhitelist(address user) external onlyGovernorOrGuardian {\n uint256 whitelistStatus = 1 - userSignatureWhitelist[user];\n userSignatureWhitelist[user] = whitelistStatus;\n emit UserSigningWhitelistToggled(user, whitelistStatus);\n }\n\n // ============================== INTERNAL HELPERS =============================\n\n /// @notice Rounds an `epoch` timestamp to the start of the corresponding period\n function _getRoundedEpoch(uint32 epoch) internal pure returns (uint32) {\n return (epoch / EPOCH_DURATION) * EPOCH_DURATION;\n }\n\n /// @notice Checks whether `distribution` was live between `roundedEpochStart` and `roundedEpochEnd`\n function _isDistributionLiveBetweenEpochs(\n DistributionParameters memory distribution,\n uint32 roundedEpochStart,\n uint32 roundedEpochEnd\n ) internal pure returns (bool) {\n uint256 distributionEpochStart = distribution.epochStart;\n return (distributionEpochStart + distribution.numEpoch * EPOCH_DURATION > roundedEpochStart &&\n distributionEpochStart < roundedEpochEnd);\n }\n\n /// @notice Fetches data for `token` on the Uniswap `pool`\n function _getUniswapTokenData(\n IERC20Metadata token,\n address pool\n ) internal view returns (UniswapTokenData memory data) {\n data.add = address(token);\n data.decimals = token.decimals();\n data.symbol = token.symbol();\n data.poolBalance = token.balanceOf(pool);\n }\n\n /// @notice Fetches extra data about the parameters in a distribution\n function getExtensiveDistributionParameters(\n DistributionParameters memory distribution\n ) external view returns (ExtensiveDistributionParameters memory extensiveParams) {\n extensiveParams.base = distribution;\n try IUniswapV3Pool(distribution.uniV3Pool).fee() returns (uint24 fee) {\n extensiveParams.poolFee = fee;\n } catch {\n extensiveParams.poolFee = 0;\n }\n extensiveParams.token0 = _getUniswapTokenData(\n IERC20Metadata(IUniswapV3Pool(distribution.uniV3Pool).token0()),\n distribution.uniV3Pool\n );\n extensiveParams.token1 = _getUniswapTokenData(\n IERC20Metadata(IUniswapV3Pool(distribution.uniV3Pool).token1()),\n distribution.uniV3Pool\n );\n extensiveParams.rewardTokenSymbol = IERC20Metadata(distribution.rewardToken).symbol();\n extensiveParams.rewardTokenDecimals = IERC20Metadata(distribution.rewardToken).decimals();\n }\n\n /// @notice Tries to fetch extra data about the parameters in a distribution\n function tryGetExtensiveDistributionParameters(\n DistributionParameters memory distribution\n ) external returns (bool success, ExtensiveDistributionParameters memory extensiveParams) {\n (bool callSuccess, bytes memory returndata) = address(this).delegatecall(\n abi.encodeWithSelector(DistributionCreator.getExtensiveDistributionParameters.selector, distribution)\n );\n success = callSuccess;\n if (success) {\n extensiveParams = abi.decode(returndata, (ExtensiveDistributionParameters));\n }\n return (success, extensiveParams);\n }\n\n /// @notice Gets the list of all the distributions for `uniV3Pool` that have been active between `epochStart` and `epochEnd` (excluded)\n /// @dev If the `uniV3Pool` parameter is equal to 0, then this function will return the distributions for all pools\n function _getPoolDistributionsBetweenEpochs(\n address uniV3Pool,\n uint32 epochStart,\n uint32 epochEnd,\n uint32 skip,\n uint32 first\n ) internal view returns (ExtensiveDistributionParameters[] memory, uint256) {\n uint256 length;\n uint256 distributionListLength = distributionList.length;\n uint256 returnSize = first > distributionListLength ? distributionListLength : first;\n ExtensiveDistributionParameters[] memory activeRewards = new ExtensiveDistributionParameters[](returnSize);\n uint32 i = skip;\n while (i < distributionListLength) {\n DistributionParameters memory distribution = distributionList[i];\n if (\n _isDistributionLiveBetweenEpochs(distribution, epochStart, epochEnd) &&\n (uniV3Pool == address(0) || distribution.uniV3Pool == uniV3Pool)\n ) {\n (bool success, ExtensiveDistributionParameters memory extensiveParams) = IDistributionCreator(\n address(this)\n ).tryGetExtensiveDistributionParameters(distribution);\n if (success) {\n activeRewards[length] = extensiveParams;\n length += 1;\n }\n }\n unchecked {\n ++i;\n }\n if (length == returnSize) break;\n }\n assembly {\n mstore(activeRewards, length)\n }\n return (activeRewards, i);\n }\n}\n" + }, + "contracts/Distributor.sol": { + "content": "// SPDX-License-Identifier: BUSL-1.1\n\n/*\n * █ \n ***** ▓▓▓ \n * ▓▓▓▓▓▓▓ \n * ///. ▓▓▓▓▓▓▓▓▓▓▓▓▓ \n ***** //////// ▓▓▓▓▓▓▓ \n * ///////////// ▓▓▓ \n ▓▓ ////////////////// █ ▓▓ \n ▓▓ ▓▓ /////////////////////// ▓▓ ▓▓ \n ▓▓ ▓▓ //////////////////////////// ▓▓ ▓▓ \n ▓▓ ▓▓ /////////▓▓▓///////▓▓▓///////// ▓▓ ▓▓ \n ▓▓ ,////////////////////////////////////// ▓▓ ▓▓ \n ▓▓ ////////////////////////////////////////// ▓▓ \n ▓▓ //////////////////////▓▓▓▓///////////////////// \n ,//////////////////////////////////////////////////// \n .////////////////////////////////////////////////////////// \n .//////////////////////////██.,//////////////////////////█ \n .//////////////////////████..,./////////////////////██ \n ...////////////////███████.....,.////////////////███ \n ,.,////////////████████ ........,///////////████ \n .,.,//////█████████ ,.......///////████ \n ,..//████████ ........./████ \n ..,██████ .....,███ \n .██ ,.,█ \n \n \n \n ▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓ ▓▓▓▓▓▓▓▓▓▓ \n ▓▓▓▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓ ▓▓ ▓▓▓▓ \n ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓ ▓▓▓▓▓ \n ▓▓▓ ▓▓ ▓▓▓ ▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ \n*/\n\npragma solidity ^0.8.17;\n\nimport { IERC20 } from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport { SafeERC20 } from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport { SafeCast } from \"@openzeppelin/contracts/utils/math/SafeCast.sol\";\n\nimport \"./utils/UUPSHelper.sol\";\n\nstruct MerkleTree {\n // Root of a Merkle tree which leaves are `(address user, address token, uint amount)`\n // representing an amount of tokens accumulated by `user`.\n // The Merkle tree is assumed to have only increasing amounts: that is to say if a user can claim 1,\n // then after the amount associated in the Merkle tree for this token should be x > 1\n bytes32 merkleRoot;\n // Ipfs hash of the tree data\n bytes32 ipfsHash;\n}\n\nstruct Claim {\n uint208 amount;\n uint48 timestamp;\n bytes32 merkleRoot;\n}\n\n/// @title Distributor\n/// @notice Allows LPs on AMMs with concentrated liquidity to claim the rewards that were distributed to them\n/// @author Angle Labs. Inc\ncontract Distributor is UUPSHelper {\n using SafeERC20 for IERC20;\n\n /// @notice Epoch duration\n uint32 internal constant _EPOCH_DURATION = 3600;\n\n // ================================= VARIABLES =================================\n\n /// @notice Tree of claimable tokens through this contract\n MerkleTree public tree;\n\n /// @notice Tree that was in place in the contract before the last `tree` update\n MerkleTree public lastTree;\n\n /// @notice Token to deposit to freeze the roots update\n IERC20 public disputeToken;\n\n /// @notice `Core` contract handling access control\n ICore public core;\n\n /// @notice Address which created the dispute\n /// @dev Used to store if there is an ongoing dispute\n address public disputer;\n\n /// @notice When the current tree will become valid\n uint48 public endOfDisputePeriod;\n\n /// @notice Time after which a change in a tree becomes effective, in EPOCH_DURATION\n uint48 public disputePeriod;\n\n /// @notice Amount to deposit to freeze the roots update\n uint256 public disputeAmount;\n\n /// @notice Mapping user -> token -> amount to track claimed amounts\n mapping(address => mapping(address => Claim)) public claimed;\n\n /// @notice Trusted EOAs to update the Merkle root\n mapping(address => uint256) public canUpdateMerkleRoot;\n\n /// @notice Whether or not to disable permissionless claiming\n mapping(address => uint256) public onlyOperatorCanClaim;\n\n /// @notice user -> operator -> authorisation to claim\n mapping(address => mapping(address => uint256)) public operators;\n\n uint256[38] private __gap;\n\n // =================================== EVENTS ==================================\n\n event Claimed(address indexed user, address indexed token, uint256 amount);\n event DisputeAmountUpdated(uint256 _disputeAmount);\n event Disputed(string reason);\n event DisputePeriodUpdated(uint48 _disputePeriod);\n event DisputeResolved(bool valid);\n event DisputeTokenUpdated(address indexed _disputeToken);\n event OperatorClaimingToggled(address indexed user, bool isEnabled);\n event OperatorToggled(address indexed user, address indexed operator, bool isWhitelisted);\n event Recovered(address indexed token, address indexed to, uint256 amount);\n event Revoked(); // With this event an indexer could maintain a table (timestamp, merkleRootUpdate)\n event TreeUpdated(bytes32 merkleRoot, bytes32 ipfsHash, uint48 endOfDisputePeriod);\n event TrustedToggled(address indexed eoa, bool trust);\n\n // ================================= MODIFIERS =================================\n\n /// @notice Checks whether the `msg.sender` has the governor role or the guardian role\n modifier onlyGovernorOrGuardian() {\n if (!core.isGovernorOrGuardian(msg.sender)) revert NotGovernorOrGuardian();\n _;\n }\n\n /// @notice Checks whether the `msg.sender` is the `user` address or is a trusted address\n modifier onlyTrustedOrUser(address user) {\n if (user != msg.sender && canUpdateMerkleRoot[msg.sender] != 1 && !core.isGovernorOrGuardian(msg.sender))\n revert NotTrusted();\n _;\n }\n\n // ================================ CONSTRUCTOR ================================\n\n constructor() initializer {}\n\n function initialize(ICore _core) external initializer {\n if (address(_core) == address(0)) revert ZeroAddress();\n core = _core;\n }\n\n /// @inheritdoc UUPSUpgradeable\n function _authorizeUpgrade(address) internal view override onlyGuardianUpgrader(core) {}\n\n // =============================== MAIN FUNCTION ===============================\n\n /// @notice Claims rewards for a given set of users\n /// @dev Anyone may call this function for anyone else, funds go to destination regardless, it's just a question of\n /// who provides the proof and pays the gas: `msg.sender` is used only for addresses that require a trusted operator\n /// @param users Recipient of tokens\n /// @param tokens ERC20 claimed\n /// @param amounts Amount of tokens that will be sent to the corresponding users\n /// @param proofs Array of hashes bridging from a leaf `(hash of user | token | amount)` to the Merkle root\n function claim(\n address[] calldata users,\n address[] calldata tokens,\n uint256[] calldata amounts,\n bytes32[][] calldata proofs\n ) external {\n uint256 usersLength = users.length;\n if (\n usersLength == 0 ||\n usersLength != tokens.length ||\n usersLength != amounts.length ||\n usersLength != proofs.length\n ) revert InvalidLengths();\n\n for (uint256 i; i < usersLength; ) {\n address user = users[i];\n address token = tokens[i];\n uint256 amount = amounts[i];\n\n // Checking if only an approved operator can claim for `user`\n if (onlyOperatorCanClaim[user] == 1 && operators[user][msg.sender] == 0) revert NotWhitelisted();\n\n // Verifying proof\n bytes32 leaf = keccak256(abi.encode(user, token, amount));\n if (!_verifyProof(leaf, proofs[i])) revert InvalidProof();\n\n // Closing reentrancy gate here\n uint256 toSend = amount - claimed[user][token].amount;\n claimed[user][token] = Claim(SafeCast.toUint208(amount), uint48(block.timestamp), getMerkleRoot());\n\n IERC20(token).safeTransfer(user, toSend);\n emit Claimed(user, token, toSend);\n unchecked {\n ++i;\n }\n }\n }\n\n /// @notice Returns the MerkleRoot that is currently live for the contract\n function getMerkleRoot() public view returns (bytes32) {\n if (block.timestamp >= endOfDisputePeriod && disputer == address(0)) return tree.merkleRoot;\n else return lastTree.merkleRoot;\n }\n\n // ============================ GOVERNANCE FUNCTIONS ===========================\n\n /// @notice Adds or removes EOAs which are trusted to update the Merkle root\n function toggleTrusted(address eoa) external onlyGovernorOrGuardian {\n uint256 trustedStatus = 1 - canUpdateMerkleRoot[eoa];\n canUpdateMerkleRoot[eoa] = trustedStatus;\n emit TrustedToggled(eoa, trustedStatus == 1);\n }\n\n /// @notice Updates Merkle Tree\n function updateTree(MerkleTree calldata _tree) external {\n if (\n disputer != address(0) ||\n // A trusted address cannot update a tree right after a precedent tree update otherwise it can de facto\n // validate a tree which has not passed the dispute period\n ((canUpdateMerkleRoot[msg.sender] != 1 || block.timestamp < endOfDisputePeriod) &&\n !core.isGovernorOrGuardian(msg.sender))\n ) revert NotTrusted();\n MerkleTree memory _lastTree = tree;\n tree = _tree;\n lastTree = _lastTree;\n\n uint48 _endOfPeriod = _endOfDisputePeriod(uint48(block.timestamp));\n endOfDisputePeriod = _endOfPeriod;\n emit TreeUpdated(_tree.merkleRoot, _tree.ipfsHash, _endOfPeriod);\n }\n\n /// @notice Freezes the Merkle tree update until the dispute is resolved\n /// @dev Requires a deposit of `disputeToken` that'll be slashed if the dispute is not accepted\n /// @dev It is only possible to create a dispute within `disputePeriod` after each tree update\n function disputeTree(string memory reason) external {\n if (disputer != address(0)) revert UnresolvedDispute();\n if (block.timestamp >= endOfDisputePeriod) revert InvalidDispute();\n IERC20(disputeToken).safeTransferFrom(msg.sender, address(this), disputeAmount);\n disputer = msg.sender;\n emit Disputed(reason);\n }\n\n /// @notice Resolve the ongoing dispute, if any\n /// @param valid Whether the dispute was valid\n function resolveDispute(bool valid) external onlyGovernorOrGuardian {\n if (disputer == address(0)) revert NoDispute();\n if (valid) {\n IERC20(disputeToken).safeTransfer(disputer, disputeAmount);\n // If a dispute is valid, the contract falls back to the last tree that was updated\n _revokeTree();\n } else {\n IERC20(disputeToken).safeTransfer(msg.sender, disputeAmount);\n endOfDisputePeriod = _endOfDisputePeriod(uint48(block.timestamp));\n }\n disputer = address(0);\n emit DisputeResolved(valid);\n }\n\n /// @notice Allows the governor or the guardian of this contract to fallback to the last version of the tree\n /// immediately\n function revokeTree() external onlyGovernorOrGuardian {\n if (disputer != address(0)) revert UnresolvedDispute();\n _revokeTree();\n }\n\n /// @notice Toggles permissioned claiming for a given user\n function toggleOnlyOperatorCanClaim(address user) external onlyTrustedOrUser(user) {\n uint256 oldValue = onlyOperatorCanClaim[user];\n onlyOperatorCanClaim[user] = 1 - oldValue;\n emit OperatorClaimingToggled(user, oldValue == 0);\n }\n\n /// @notice Toggles whitelisting for a given user and a given operator\n function toggleOperator(address user, address operator) external onlyTrustedOrUser(user) {\n uint256 oldValue = operators[user][operator];\n operators[user][operator] = 1 - oldValue;\n emit OperatorToggled(user, operator, oldValue == 0);\n }\n\n /// @notice Recovers any ERC20 token\n function recoverERC20(address tokenAddress, address to, uint256 amountToRecover) external onlyGovernorOrGuardian {\n IERC20(tokenAddress).safeTransfer(to, amountToRecover);\n emit Recovered(tokenAddress, to, amountToRecover);\n }\n\n /// @notice Sets the dispute period after which a tree update becomes effective\n function setDisputePeriod(uint48 _disputePeriod) external onlyGovernorOrGuardian {\n disputePeriod = uint48(_disputePeriod);\n emit DisputePeriodUpdated(_disputePeriod);\n }\n\n /// @notice Sets the token used as a caution during disputes\n function setDisputeToken(IERC20 _disputeToken) external onlyGovernorOrGuardian {\n if (disputer != address(0)) revert UnresolvedDispute();\n disputeToken = _disputeToken;\n emit DisputeTokenUpdated(address(_disputeToken));\n }\n\n /// @notice Sets the amount of `disputeToken` used as a caution during disputes\n function setDisputeAmount(uint256 _disputeAmount) external onlyGovernorOrGuardian {\n if (disputer != address(0)) revert UnresolvedDispute();\n disputeAmount = _disputeAmount;\n emit DisputeAmountUpdated(_disputeAmount);\n }\n\n // ============================= INTERNAL FUNCTIONS ============================\n\n /// @notice Fallback to the last version of the tree\n function _revokeTree() internal {\n MerkleTree memory _tree = lastTree;\n endOfDisputePeriod = 0;\n tree = _tree;\n emit Revoked();\n emit TreeUpdated(\n _tree.merkleRoot,\n _tree.ipfsHash,\n (uint48(block.timestamp) / _EPOCH_DURATION) * (_EPOCH_DURATION) // Last hour\n );\n }\n\n /// @notice Returns the end of the dispute period\n /// @dev treeUpdate is rounded up to next hour and then `disputePeriod` hours are added\n function _endOfDisputePeriod(uint48 treeUpdate) internal view returns (uint48) {\n return ((treeUpdate - 1) / _EPOCH_DURATION + 1 + disputePeriod) * (_EPOCH_DURATION);\n }\n\n /// @notice Checks the validity of a proof\n /// @param leaf Hashed leaf data, the starting point of the proof\n /// @param proof Array of hashes forming a hash chain from leaf to root\n /// @return true If proof is correct, else false\n function _verifyProof(bytes32 leaf, bytes32[] memory proof) internal view returns (bool) {\n bytes32 currentHash = leaf;\n uint256 proofLength = proof.length;\n for (uint256 i; i < proofLength; ) {\n if (currentHash < proof[i]) {\n currentHash = keccak256(abi.encode(currentHash, proof[i]));\n } else {\n currentHash = keccak256(abi.encode(proof[i], currentHash));\n }\n unchecked {\n ++i;\n }\n }\n bytes32 root = getMerkleRoot();\n if (root == bytes32(0)) revert InvalidUninitializedRoot();\n return currentHash == root;\n }\n}\n" + }, + "contracts/external/AccessControlUpgradeable.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.7;\n\nimport \"@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\n\n/**\n * @dev This contract is fully forked from OpenZeppelin `AccessControlUpgradeable`.\n * The only difference is the removal of the ERC165 implementation as it's not\n * needed in Angle.\n *\n * Contract module that allows children to implement role-based access\n * control mechanisms. This is a lightweight version that doesn't allow enumerating role\n * members except through off-chain means by accessing the contract event logs. Some\n * applications may benefit from on-chain enumerability, for those cases see\n * {AccessControlEnumerable}.\n *\n * Roles are referred to by their `bytes32` identifier. These should be exposed\n * in the external API and be unique. The best way to achieve this is by\n * using `public constant` hash digests:\n *\n * ```\n * bytes32 public constant MY_ROLE = keccak256(\"MY_ROLE\");\n * ```\n *\n * Roles can be used to represent a set of permissions. To restrict access to a\n * function call, use {hasRole}:\n *\n * ```\n * function foo() public {\n * require(hasRole(MY_ROLE, msg.sender));\n * ...\n * }\n * ```\n *\n * Roles can be granted and revoked dynamically via the {grantRole} and\n * {revokeRole} functions. Each role has an associated admin role, and only\n * accounts that have a role's admin role can call {grantRole} and {revokeRole}.\n *\n * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means\n * that only accounts with this role will be able to grant or revoke other\n * roles. More complex role relationships can be created by using\n * {_setRoleAdmin}.\n *\n * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to\n * grant and revoke this role. Extra precautions should be taken to secure\n * accounts that have been granted it.\n */\n//solhint-disable\nabstract contract AccessControlUpgradeable is Initializable {\n function __AccessControl_init() internal initializer {\n __AccessControl_init_unchained();\n }\n\n function __AccessControl_init_unchained() internal initializer {}\n\n struct RoleData {\n mapping(address => bool) members;\n bytes32 adminRole;\n }\n\n mapping(bytes32 => RoleData) private _roles;\n\n bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;\n\n /**\n * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`\n *\n * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite\n * {RoleAdminChanged} not being emitted signaling this.\n *\n * _Available since v3.1._\n */\n event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);\n\n /**\n * @dev Emitted when `account` is granted `role`.\n *\n * `sender` is the account that originated the contract call, an admin role\n * bearer except when using {_setupRole}.\n */\n event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);\n\n /**\n * @dev Emitted when `account` is revoked `role`.\n *\n * `sender` is the account that originated the contract call:\n * - if using `revokeRole`, it is the admin role bearer\n * - if using `renounceRole`, it is the role bearer (i.e. `account`)\n */\n event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);\n\n /**\n * @dev Modifier that checks that an account has a specific role. Reverts\n * with a standardized message including the required role.\n *\n * The format of the revert reason is given by the following regular expression:\n *\n * /^AccessControl: account (0x[0-9a-f]{20}) is missing role (0x[0-9a-f]{32})$/\n *\n * _Available since v4.1._\n */\n modifier onlyRole(bytes32 role) {\n _checkRole(role, msg.sender);\n _;\n }\n\n /**\n * @dev Returns `true` if `account` has been granted `role`.\n */\n function hasRole(bytes32 role, address account) public view returns (bool) {\n return _roles[role].members[account];\n }\n\n /**\n * @dev Revert with a standard message if `account` is missing `role`.\n *\n * The format of the revert reason is given by the following regular expression:\n *\n * /^AccessControl: account (0x[0-9a-f]{20}) is missing role (0x[0-9a-f]{32})$/\n */\n function _checkRole(bytes32 role, address account) internal view {\n if (!hasRole(role, account)) {\n revert(\n string(\n abi.encodePacked(\n \"AccessControl: account \",\n StringsUpgradeable.toHexString(uint160(account), 20),\n \" is missing role \",\n StringsUpgradeable.toHexString(uint256(role), 32)\n )\n )\n );\n }\n }\n\n /**\n * @dev Returns the admin role that controls `role`. See {grantRole} and\n * {revokeRole}.\n *\n * To change a role's admin, use {_setRoleAdmin}.\n */\n function getRoleAdmin(bytes32 role) public view returns (bytes32) {\n return _roles[role].adminRole;\n }\n\n /**\n * @dev Grants `role` to `account`.\n *\n * If `account` had not been already granted `role`, emits a {RoleGranted}\n * event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n */\n function grantRole(bytes32 role, address account) external onlyRole(getRoleAdmin(role)) {\n _grantRole(role, account);\n }\n\n /**\n * @dev Revokes `role` from `account`.\n *\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n */\n function revokeRole(bytes32 role, address account) external onlyRole(getRoleAdmin(role)) {\n _revokeRole(role, account);\n }\n\n /**\n * @dev Revokes `role` from the calling account.\n *\n * Roles are often managed via {grantRole} and {revokeRole}: this function's\n * purpose is to provide a mechanism for accounts to lose their privileges\n * if they are compromised (such as when a trusted device is misplaced).\n *\n * If the calling account had been granted `role`, emits a {RoleRevoked}\n * event.\n *\n * Requirements:\n *\n * - the caller must be `account`.\n */\n function renounceRole(bytes32 role, address account) external {\n require(account == msg.sender, \"71\");\n\n _revokeRole(role, account);\n }\n\n /**\n * @dev Grants `role` to `account`.\n *\n * If `account` had not been already granted `role`, emits a {RoleGranted}\n * event. Note that unlike {grantRole}, this function doesn't perform any\n * checks on the calling account.\n *\n * [WARNING]\n * ====\n * This function should only be called from the constructor when setting\n * up the initial roles for the system.\n *\n * Using this function in any other way is effectively circumventing the admin\n * system imposed by {AccessControl}.\n * ====\n */\n function _setupRole(bytes32 role, address account) internal {\n _grantRole(role, account);\n }\n\n /**\n * @dev Sets `adminRole` as ``role``'s admin role.\n *\n * Emits a {RoleAdminChanged} event.\n */\n function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal {\n emit RoleAdminChanged(role, getRoleAdmin(role), adminRole);\n _roles[role].adminRole = adminRole;\n }\n\n function _grantRole(bytes32 role, address account) internal {\n if (!hasRole(role, account)) {\n _roles[role].members[account] = true;\n emit RoleGranted(role, account, msg.sender);\n }\n }\n\n function _revokeRole(bytes32 role, address account) internal {\n if (hasRole(role, account)) {\n _roles[role].members[account] = false;\n emit RoleRevoked(role, account, msg.sender);\n }\n }\n\n uint256[49] private __gap;\n}\n" + }, + "contracts/external/ProxyAdmin.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"./TransparentUpgradeableProxy.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\n/**\n * @dev This is an auxiliary contract meant to be assigned as the admin of a {TransparentUpgradeableProxy}. For an\n * explanation of why you would want to use this see the documentation for {TransparentUpgradeableProxy}.\n * This contract was fully forked from OpenZeppelin `ProxyAdmin`\n */\ncontract ProxyAdmin is Ownable {\n /**\n * @dev Returns the current implementation of `proxy`.\n *\n * Requirements:\n *\n * - This contract must be the admin of `proxy`.\n */\n function getProxyImplementation(TransparentUpgradeableProxy proxy) public view virtual returns (address) {\n // We need to manually run the static call since the getter cannot be flagged as view\n // bytes4(keccak256(\"implementation()\")) == 0x5c60da1b\n (bool success, bytes memory returndata) = address(proxy).staticcall(hex\"5c60da1b\");\n require(success);\n return abi.decode(returndata, (address));\n }\n\n /**\n * @dev Returns the current admin of `proxy`.\n *\n * Requirements:\n *\n * - This contract must be the admin of `proxy`.\n */\n function getProxyAdmin(TransparentUpgradeableProxy proxy) public view virtual returns (address) {\n // We need to manually run the static call since the getter cannot be flagged as view\n // bytes4(keccak256(\"admin()\")) == 0xf851a440\n (bool success, bytes memory returndata) = address(proxy).staticcall(hex\"f851a440\");\n require(success);\n return abi.decode(returndata, (address));\n }\n\n /**\n * @dev Changes the admin of `proxy` to `newAdmin`.\n *\n * Requirements:\n *\n * - This contract must be the current admin of `proxy`.\n */\n function changeProxyAdmin(TransparentUpgradeableProxy proxy, address newAdmin) public virtual onlyOwner {\n proxy.changeAdmin(newAdmin);\n }\n\n /**\n * @dev Upgrades `proxy` to `implementation`. See {TransparentUpgradeableProxy-upgradeTo}.\n *\n * Requirements:\n *\n * - This contract must be the admin of `proxy`.\n */\n function upgrade(TransparentUpgradeableProxy proxy, address implementation) public virtual onlyOwner {\n proxy.upgradeTo(implementation);\n }\n\n /**\n * @dev Upgrades `proxy` to `implementation` and calls a function on the new implementation. See\n * {TransparentUpgradeableProxy-upgradeToAndCall}.\n *\n * Requirements:\n *\n * - This contract must be the admin of `proxy`.\n */\n function upgradeAndCall(\n TransparentUpgradeableProxy proxy,\n address implementation,\n bytes memory data\n ) public payable virtual onlyOwner {\n proxy.upgradeToAndCall{ value: msg.value }(implementation, data);\n }\n}\n" + }, + "contracts/external/TransparentUpgradeableProxy.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol\";\n\n/**\n * @dev This contract implements a proxy that is upgradeable by an admin. It is fully forked from OpenZeppelin\n * `TransparentUpgradeableProxy`\n *\n * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector\n * clashing], which can potentially be used in an attack, this contract uses the\n * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two\n * things that go hand in hand:\n *\n * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if\n * that call matches one of the admin functions exposed by the proxy itself.\n * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the\n * implementation. If the admin tries to call a function on the implementation it will fail with an error that says\n * \"admin cannot fallback to proxy target\".\n *\n * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing\n * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due\n * to sudden errors when trying to call a function from the proxy implementation.\n *\n * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,\n * you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\n */\ncontract TransparentUpgradeableProxy is ERC1967Proxy {\n /**\n * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.\n */\n modifier ifAdmin() {\n if (msg.sender == _getAdmin()) {\n _;\n } else {\n _fallback();\n }\n }\n\n /**\n * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and\n * optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\n */\n constructor(\n address _logic,\n address admin_,\n bytes memory _data\n ) payable ERC1967Proxy(_logic, _data) {\n assert(_ADMIN_SLOT == bytes32(uint256(keccak256(\"eip1967.proxy.admin\")) - 1));\n _changeAdmin(admin_);\n }\n\n /**\n * @dev Returns the current admin.\n *\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.\n *\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\n */\n function admin() external ifAdmin returns (address admin_) {\n admin_ = _getAdmin();\n }\n\n /**\n * @dev Returns the current implementation.\n *\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.\n *\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\n * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\n */\n function implementation() external ifAdmin returns (address implementation_) {\n implementation_ = _implementation();\n }\n\n /**\n * @dev Changes the admin of the proxy.\n *\n * Emits an {AdminChanged} event.\n *\n * NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\n */\n function changeAdmin(address newAdmin) external virtual ifAdmin {\n _changeAdmin(newAdmin);\n }\n\n /**\n * @dev Upgrade the implementation of the proxy.\n *\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\n */\n function upgradeTo(address newImplementation) external ifAdmin {\n _upgradeToAndCall(newImplementation, bytes(\"\"), false);\n }\n\n /**\n * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified\n * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the\n * proxied contract.\n *\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\n */\n function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {\n _upgradeToAndCall(newImplementation, data, true);\n }\n\n /**\n * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.\n */\n function _beforeFallback() internal virtual override {\n require(msg.sender != _getAdmin(), \"TransparentUpgradeableProxy: admin cannot fallback to proxy target\");\n super._beforeFallback();\n }\n\n /**\n * @dev Returns the current admin.\n */\n function _admin() internal view virtual returns (address) {\n return _getAdmin();\n }\n}\n" + }, + "contracts/interfaces/CoreModuleInterfaces.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.7;\n\n/// @title IAngleMiddlemanGauge\n/// @author Angle Core Team\n/// @notice Interface for the `AngleMiddleman` contract\ninterface IAngleMiddlemanGauge {\n function notifyReward(address gauge, uint256 amount) external;\n}\n\ninterface IStakingRewards {\n function notifyRewardAmount(uint256 reward) external;\n}\n\ninterface IGaugeController {\n //solhint-disable-next-line\n function gauge_types(address addr) external view returns (int128);\n\n //solhint-disable-next-line\n function gauge_relative_weight_write(address addr, uint256 timestamp) external returns (uint256);\n\n //solhint-disable-next-line\n function gauge_relative_weight(address addr, uint256 timestamp) external view returns (uint256);\n}\n\ninterface ILiquidityGauge {\n // solhint-disable-next-line\n function deposit_reward_token(address _rewardToken, uint256 _amount) external;\n}\n" + }, + "contracts/interfaces/external/algebra/IAlgebraPool.sol": { + "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title IAlgebraPool\n/// @dev Copied from: https://github.com/cryptoalgebra/Algebra/blob/master/src/core/contracts/interfaces/pool/IAlgebraPoolState.sol\ninterface IAlgebraPool {\n /**\n * @notice The globalState structure in the pool stores many values but requires only one slot\n * and is exposed as a single method to save gas when accessed externally.\n * @return price The current price of the pool as a sqrt(token1/token0) Q64.96 value;\n * Returns tick The current tick of the pool, i.e. according to the last tick transition that was run;\n * Returns This value may not always be equal to SqrtTickMath.getTickAtSqrtRatio(price) if the price is on a tick\n * boundary;\n * Returns fee The last pool fee value in hundredths of a bip, i.e. 1e-6;\n * Returns timepointIndex The index of the last written timepoint;\n * Returns communityFeeToken0 The community fee percentage of the swap fee in thousandths (1e-3) for token0;\n * Returns communityFeeToken1 The community fee percentage of the swap fee in thousandths (1e-3) for token1;\n * Returns unlocked Whether the pool is currently locked to reentrancy;\n */\n function globalState()\n external\n view\n returns (\n uint160 price,\n int24 tick,\n uint16 fee,\n uint16 timepointIndex,\n uint8 communityFeeToken0,\n uint8 communityFeeToken1,\n bool unlocked\n );\n}\n" + }, + "contracts/interfaces/external/uniswap/IUniswapV3Pool.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity >=0.5.0;\n\n/// @title Pool state that never changes\n/// @notice These parameters are fixed for a pool forever, i.e., the methods will always return the same values\ninterface IUniswapV3Pool {\n /// @notice The first of the two tokens of the pool, sorted by address\n /// @return The token contract address\n function token0() external view returns (address);\n\n /// @notice The second of the two tokens of the pool, sorted by address\n /// @return The token contract address\n function token1() external view returns (address);\n\n /// @notice The pool's fee in hundredths of a bip, i.e. 1e-6\n /// @return The fee\n function fee() external view returns (uint24);\n}\n" + }, + "contracts/interfaces/IAgToken.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\";\n\n/// @title IAgToken\n/// @author Angle Core Team\n/// @notice Interface for the stablecoins `AgToken` contracts\n/// @dev This interface only contains functions of the `AgToken` contract which are called by other contracts\n/// of this module or of the first module of the Angle Protocol\ninterface IAgToken is IERC20Upgradeable {\n // ======================= Minter Role Only Functions ===========================\n\n /// @notice Lets the `StableMaster` contract or another whitelisted contract mint agTokens\n /// @param account Address to mint to\n /// @param amount Amount to mint\n /// @dev The contracts allowed to issue agTokens are the `StableMaster` contract, `VaultManager` contracts\n /// associated to this stablecoin as well as the flash loan module (if activated) and potentially contracts\n /// whitelisted by governance\n function mint(address account, uint256 amount) external;\n\n /// @notice Burns `amount` tokens from a `burner` address after being asked to by `sender`\n /// @param amount Amount of tokens to burn\n /// @param burner Address to burn from\n /// @param sender Address which requested the burn from `burner`\n /// @dev This method is to be called by a contract with the minter right after being requested\n /// to do so by a `sender` address willing to burn tokens from another `burner` address\n /// @dev The method checks the allowance between the `sender` and the `burner`\n function burnFrom(uint256 amount, address burner, address sender) external;\n\n /// @notice Burns `amount` tokens from a `burner` address\n /// @param amount Amount of tokens to burn\n /// @param burner Address to burn from\n /// @dev This method is to be called by a contract with a minter right on the AgToken after being\n /// requested to do so by an address willing to burn tokens from its address\n function burnSelf(uint256 amount, address burner) external;\n\n // ========================= Treasury Only Functions ===========================\n\n /// @notice Adds a minter in the contract\n /// @param minter Minter address to add\n /// @dev Zero address checks are performed directly in the `Treasury` contract\n function addMinter(address minter) external;\n\n /// @notice Removes a minter from the contract\n /// @param minter Minter address to remove\n /// @dev This function can also be called by a minter wishing to revoke itself\n function removeMinter(address minter) external;\n\n /// @notice Sets a new treasury contract\n /// @param _treasury New treasury address\n function setTreasury(address _treasury) external;\n\n // ========================= External functions ================================\n\n /// @notice Checks whether an address has the right to mint agTokens\n /// @param minter Address for which the minting right should be checked\n /// @return Whether the address has the right to mint agTokens or not\n function isMinter(address minter) external view returns (bool);\n}\n" + }, + "contracts/interfaces/ICore.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\n/// @title ICore\n/// @author Angle Labs, Inc.\n/// @notice Interface for the `Core` contracts of smart contract modules used in Angle Labs contracts\ninterface ICore {\n /// @notice Checks whether an address is governor\n /// @param admin Address to check\n /// @return Whether the address has the `GOVERNOR_ROLE` or not\n function isGovernor(address admin) external view returns (bool);\n\n /// @notice Checks whether an address is a governor or a guardian of a module\n /// @param admin Address to check\n /// @return Whether the address has the `GUARDIAN_ROLE` or not\n /// @dev Governance should make sure when adding a governor to also give this governor the guardian\n /// role by calling the `addGovernor` function\n function isGovernorOrGuardian(address admin) external view returns (bool);\n}\n" + }, + "contracts/interfaces/ITreasury.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"./IAgToken.sol\";\nimport \"./ICore.sol\";\n\n/// @title ITreasury\n/// @author Angle Core Team\n/// @notice Interface for the `Treasury` contract\n/// @dev This interface only contains functions of the `Treasury` which are called by other contracts\n/// of this module\ninterface ITreasury {\n /// @notice Stablecoin handled by this `treasury` contract\n function stablecoin() external view returns (IAgToken);\n\n /// @notice Checks whether a given address has the governor role\n /// @param admin Address to check\n /// @return Whether the address has the governor role\n /// @dev Access control is only kept in the `CoreBorrow` contract\n function isGovernor(address admin) external view returns (bool);\n\n /// @notice Checks whether a given address has the guardian or the governor role\n /// @param admin Address to check\n /// @return Whether the address has the guardian or the governor role\n /// @dev Access control is only kept in the `CoreBorrow` contract which means that this function\n /// queries the `CoreBorrow` contract\n function isGovernorOrGuardian(address admin) external view returns (bool);\n}\n" + }, + "contracts/middleman/MerklGaugeMiddleman.sol": { + "content": "// SPDX-License-Identifier: BUSL-1.1\n\n/*\n * █ \n ***** ▓▓▓ \n * ▓▓▓▓▓▓▓ \n * ///. ▓▓▓▓▓▓▓▓▓▓▓▓▓ \n ***** //////// ▓▓▓▓▓▓▓ \n * ///////////// ▓▓▓ \n ▓▓ ////////////////// █ ▓▓ \n ▓▓ ▓▓ /////////////////////// ▓▓ ▓▓ \n ▓▓ ▓▓ //////////////////////////// ▓▓ ▓▓ \n ▓▓ ▓▓ /////////▓▓▓///////▓▓▓///////// ▓▓ ▓▓ \n ▓▓ ,////////////////////////////////////// ▓▓ ▓▓ \n ▓▓ ////////////////////////////////////////// ▓▓ \n ▓▓ //////////////////////▓▓▓▓///////////////////// \n ,//////////////////////////////////////////////////// \n .////////////////////////////////////////////////////////// \n .//////////////////////////██.,//////////////////////////█ \n .//////////////////////████..,./////////////////////██ \n ...////////////////███████.....,.////////////////███ \n ,.,////////////████████ ........,///////////████ \n .,.,//////█████████ ,.......///////████ \n ,..//████████ ........./████ \n ..,██████ .....,███ \n .██ ,.,█ \n \n \n \n ▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓ ▓▓▓▓▓▓▓▓▓▓ \n ▓▓▓▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓ ▓▓ ▓▓▓▓ \n ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓ ▓▓▓▓▓ \n ▓▓▓ ▓▓ ▓▓▓ ▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ \n*/\n\npragma solidity ^0.8.17;\n\nimport { IERC20 } from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport { SafeERC20 } from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\n\nimport \"../DistributionCreator.sol\";\n\n/// @title MerklGaugeMiddleman\n/// @author Angle Labs, Inc.\n/// @notice Manages the transfer of ANGLE rewards to the `DistributionCreator` contract\n/// @dev This contract is built under the assumption that the `DistributionCreator` contract has already whitelisted\n/// this contract for it to distribute rewards without having to sign a message\n/// @dev Transient funds left in this contract after a call may be exploited\ncontract MerklGaugeMiddleman {\n using SafeERC20 for IERC20;\n\n // ================================= PARAMETERS ================================\n\n /// @notice Contract handling access control\n ICore public accessControlManager;\n\n /// @notice Maps a gauge to its reward parameters\n mapping(address => DistributionParameters) public gaugeParams;\n\n // =================================== EVENT ===================================\n\n event GaugeSet(address indexed gauge);\n\n constructor(ICore _accessControlManager) {\n if (address(_accessControlManager) == address(0)) revert ZeroAddress();\n accessControlManager = _accessControlManager;\n IERC20 _angle = angle();\n // Condition left here for testing purposes\n if (address(_angle) != address(0))\n _angle.safeIncreaseAllowance(address(merklDistributionCreator()), type(uint256).max);\n }\n\n // ================================= REFERENCES ================================\n\n /// @notice Address of the ANGLE token\n function angle() public view virtual returns (IERC20) {\n return IERC20(0x31429d1856aD1377A8A0079410B297e1a9e214c2);\n }\n\n /// @notice Address of the Merkl contract managing rewards to be distributed\n /// @dev Address is the same across the different chains on which it is deployed\n function merklDistributionCreator() public view virtual returns (DistributionCreator) {\n return DistributionCreator(0x8BB4C975Ff3c250e0ceEA271728547f3802B36Fd);\n }\n\n // ============================= EXTERNAL FUNCTIONS ============================\n\n /// @notice Restores the allowance for the ANGLE token to the `DistributionCreator` contract\n function setAngleAllowance() external {\n IERC20 _angle = angle();\n address manager = address(merklDistributionCreator());\n uint256 currentAllowance = _angle.allowance(address(this), manager);\n if (currentAllowance < type(uint256).max)\n _angle.safeIncreaseAllowance(manager, type(uint256).max - currentAllowance);\n }\n\n /// @notice Specifies the reward distribution parameters for `gauge`\n function setGauge(address gauge, DistributionParameters memory params) external {\n if (!accessControlManager.isGovernorOrGuardian(msg.sender)) revert NotGovernorOrGuardian();\n DistributionCreator manager = merklDistributionCreator();\n if (\n gauge == address(0) ||\n params.rewardToken != address(angle()) ||\n (manager.isWhitelistedToken(IUniswapV3Pool(params.uniV3Pool).token0()) == 0 &&\n manager.isWhitelistedToken(IUniswapV3Pool(params.uniV3Pool).token1()) == 0)\n ) revert InvalidParams();\n gaugeParams[gauge] = params;\n emit GaugeSet(gauge);\n }\n\n /// @notice Transmits rewards from the `AngleDistributor` to the `DistributionCreator` with the correct\n /// parameters\n /// @dev Callable by any contract\n /// @dev This method can be used to recover leftover ANGLE tokens in the contract\n function notifyReward(address gauge, uint256 amount) public {\n DistributionParameters memory params = gaugeParams[gauge];\n if (params.uniV3Pool == address(0)) revert InvalidParams();\n if (amount == 0) amount = angle().balanceOf(address(this));\n params.epochStart = uint32(block.timestamp);\n params.amount = amount;\n DistributionCreator creator = merklDistributionCreator();\n if (amount > 0) {\n // Need to deal with minimum distribution amounts\n if (amount > creator.rewardTokenMinAmounts(address(angle())) * params.numEpoch) {\n merklDistributionCreator().createDistribution(params);\n } else {\n // Sending leftover ANGLE tokens to the `msg.sender`\n angle().safeTransfer(msg.sender, amount);\n }\n }\n }\n\n /// @notice Fetches tokens and transmits rewards in the same transaction\n function notifyRewardWithTransfer(address gauge, uint256 amount) external {\n angle().safeTransferFrom(msg.sender, address(this), amount);\n notifyReward(gauge, amount);\n }\n}\n" + }, + "contracts/middleman/MerklGaugeMiddlemanPolygon.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"./MerklGaugeMiddleman.sol\";\n\n/// @title MerklGaugeMiddlemanPolygon\n/// @author Angle Labs, Inc.\ncontract MerklGaugeMiddlemanPolygon is MerklGaugeMiddleman {\n constructor(ICore _accessControlManager) MerklGaugeMiddleman(_accessControlManager) {}\n\n function angle() public pure override returns (IERC20) {\n return IERC20(0x900F717EA076E1E7a484ad9DD2dB81CEEc60eBF1);\n }\n}\n" + }, + "contracts/mock/AngleDistributor.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.7;\n\nimport \"./AngleDistributorEvents.sol\";\n\n/// @title AngleDistributor\n/// @author Forked from contracts developed by Curve and Frax and adapted by Angle Core Team\n/// - ERC20CRV.vy (https://github.com/curvefi/curve-dao-contracts/blob/master/contracts/ERC20CRV.vy)\n/// - FraxGaugeFXSRewardsDistributor.sol (https://github.com/FraxFinance/frax-solidity/blob/master/src/hardhat/contracts/Curve/FraxGaugeFXSRewardsDistributor.sol)\n/// @notice All the events used in `AngleDistributor` contract\ncontract AngleDistributor is AngleDistributorEvents, ReentrancyGuardUpgradeable, AccessControlUpgradeable {\n using SafeERC20 for IERC20;\n\n /// @notice Role for governors only\n bytes32 public constant GOVERNOR_ROLE = keccak256(\"GOVERNOR_ROLE\");\n /// @notice Role for the guardian\n bytes32 public constant GUARDIAN_ROLE = keccak256(\"GUARDIAN_ROLE\");\n\n /// @notice Length of a week in seconds\n uint256 public constant WEEK = 3600 * 24 * 7;\n\n /// @notice Time at which the emission rate is updated\n uint256 public constant RATE_REDUCTION_TIME = WEEK;\n\n /// @notice Reduction of the emission rate\n uint256 public constant RATE_REDUCTION_COEFFICIENT = 1007827884862117171; // 1.5 ^ (1/52) * 10**18\n\n /// @notice Base used for computation\n uint256 public constant BASE = 10**18;\n\n /// @notice Maps the address of a gauge to the last time this gauge received rewards\n mapping(address => uint256) public lastTimeGaugePaid;\n\n /// @notice Maps the address of a gauge to whether it was killed or not\n /// A gauge killed in this contract cannot receive any rewards\n mapping(address => bool) public killedGauges;\n\n /// @notice Maps the address of a type >= 2 gauge to a delegate address responsible\n /// for giving rewards to the actual gauge\n mapping(address => address) public delegateGauges;\n\n /// @notice Maps the address of a gauge delegate to whether this delegate supports the `notifyReward` interface\n /// and is therefore built for automation\n mapping(address => bool) public isInterfaceKnown;\n\n /// @notice Address of the ANGLE token given as a reward\n IERC20 public rewardToken;\n\n /// @notice Address of the `GaugeController` contract\n IGaugeController public controller;\n\n /// @notice Address responsible for pulling rewards of type >= 2 gauges and distributing it to the\n /// associated contracts if there is not already an address delegated for this specific contract\n address public delegateGauge;\n\n /// @notice ANGLE current emission rate, it is first defined in the initializer and then updated every week\n uint256 public rate;\n\n /// @notice Timestamp at which the current emission epoch started\n uint256 public startEpochTime;\n\n /// @notice Amount of ANGLE tokens distributed through staking at the start of the epoch\n /// This is an informational variable used to track how much has been distributed through liquidity mining\n uint256 public startEpochSupply;\n\n /// @notice Index of the current emission epoch\n /// Here also, this variable is not useful per se inside the smart contracts of the protocol, it is\n /// just an informational variable\n uint256 public miningEpoch;\n\n /// @notice Whether ANGLE distribution through this contract is on or no\n bool public distributionsOn;\n\n /// @notice Constructor of the contract\n /// @param _rewardToken Address of the ANGLE token\n /// @param _controller Address of the GaugeController\n /// @param _initialRate Initial ANGLE emission rate\n /// @param _startEpochSupply Amount of ANGLE tokens already distributed via liquidity mining\n /// @param governor Governor address of the contract\n /// @param guardian Address of the guardian of this contract\n /// @param _delegateGauge Address that will be used to pull rewards for type 2 gauges\n /// @dev After this contract is created, the correct amount of ANGLE tokens should be transferred to the contract\n /// @dev The `_delegateGauge` can be the zero address\n function initialize(\n address _rewardToken,\n address _controller,\n uint256 _initialRate,\n uint256 _startEpochSupply,\n address governor,\n address guardian,\n address _delegateGauge\n ) external initializer {\n require(\n _controller != address(0) && _rewardToken != address(0) && guardian != address(0) && governor != address(0),\n \"0\"\n );\n rewardToken = IERC20(_rewardToken);\n controller = IGaugeController(_controller);\n startEpochSupply = _startEpochSupply;\n miningEpoch = 0;\n // Some ANGLE tokens should be sent to the contract directly after initialization\n rate = _initialRate;\n delegateGauge = _delegateGauge;\n distributionsOn = false;\n startEpochTime = block.timestamp;\n _setRoleAdmin(GOVERNOR_ROLE, GOVERNOR_ROLE);\n _setRoleAdmin(GUARDIAN_ROLE, GOVERNOR_ROLE);\n _setupRole(GUARDIAN_ROLE, guardian);\n _setupRole(GOVERNOR_ROLE, governor);\n _setupRole(GUARDIAN_ROLE, governor);\n }\n\n /// @custom:oz-upgrades-unsafe-allow constructor\n constructor() initializer {}\n\n // ======================== Internal Functions =================================\n\n /// @notice Internal function to distribute rewards to a gauge\n /// @param gaugeAddr Address of the gauge to distribute rewards to\n /// @return weeksElapsed Weeks elapsed since the last call\n /// @return rewardTally Amount of rewards distributed to the gauge\n /// @dev The reason for having an internal function is that it's called by the `distributeReward` and the\n /// `distributeRewardToMultipleGauges`\n /// @dev Although they would need to be performed all the time this function is called, this function does not\n /// contain checks on whether distribution is on, and on whether rate should be reduced. These are done in each external\n /// function calling this function for gas efficiency\n function _distributeReward(address gaugeAddr) internal returns (uint256 weeksElapsed, uint256 rewardTally) {\n // Checking if the gauge has been added or if it still possible to distribute rewards to this gauge\n int128 gaugeType = IGaugeController(controller).gauge_types(gaugeAddr);\n require(gaugeType >= 0 && !killedGauges[gaugeAddr], \"110\");\n\n // Calculate the elapsed time in weeks.\n uint256 lastTimePaid = lastTimeGaugePaid[gaugeAddr];\n\n // Edge case for first reward for this gauge\n if (lastTimePaid == 0) {\n weeksElapsed = 1;\n if (gaugeType == 0) {\n // We give a full approval for the gauges with type zero which correspond to the staking\n // contracts of the protocol\n rewardToken.safeApprove(gaugeAddr, type(uint256).max);\n }\n } else {\n // Truncation desired\n weeksElapsed = (block.timestamp - lastTimePaid) / WEEK;\n // Return early here for 0 weeks instead of throwing, as it could have bad effects in other contracts\n if (weeksElapsed == 0) {\n return (0, 0);\n }\n }\n rewardTally = 0;\n // We use this variable to keep track of the emission rate across different weeks\n uint256 weeklyRate = rate;\n for (uint256 i = 0; i < weeksElapsed; i++) {\n uint256 relWeightAtWeek;\n if (i == 0) {\n // Mutative, for the current week: makes sure the weight is checkpointed. Also returns the weight.\n relWeightAtWeek = controller.gauge_relative_weight_write(gaugeAddr, block.timestamp);\n } else {\n // View\n relWeightAtWeek = controller.gauge_relative_weight(gaugeAddr, (block.timestamp - WEEK * i));\n }\n rewardTally += (weeklyRate * relWeightAtWeek * WEEK) / BASE;\n\n // To get the rate of the week prior from the current rate we just have to multiply by the weekly division\n // factor\n // There may be some precisions error: inferred previous values of the rate may be different to what we would\n // have had if the rate had been computed correctly in these weeks: we expect from empirical observations\n // this `weeklyRate` to be inferior to what the `rate` would have been\n weeklyRate = (weeklyRate * RATE_REDUCTION_COEFFICIENT) / BASE;\n }\n\n // Update the last time paid, rounded to the closest week\n // in order not to have an ever moving time on when to call this function\n lastTimeGaugePaid[gaugeAddr] = (block.timestamp / WEEK) * WEEK;\n\n // If the `gaugeType >= 2`, this means that the gauge is a gauge on another chain (and corresponds to tokens\n // that need to be bridged) or is associated to an external contract of the Angle Protocol\n if (gaugeType >= 2) {\n // If it is defined, we use the specific delegate attached to the gauge\n address delegate = delegateGauges[gaugeAddr];\n if (delegate == address(0)) {\n // If not, we check if a delegate common to all gauges with type >= 2 can be used\n delegate = delegateGauge;\n }\n if (delegate != address(0)) {\n _sendDelegateRewards(gaugeAddr, delegate, rewardTally);\n } else {\n rewardToken.safeTransfer(gaugeAddr, rewardTally);\n }\n } else if (gaugeType == 1) {\n // This is for the case of Perpetual contracts which need to be able to receive their reward tokens\n rewardToken.safeTransfer(gaugeAddr, rewardTally);\n IStakingRewards(gaugeAddr).notifyRewardAmount(rewardTally);\n } else {\n // Potentially override the gauge address\n address delegate = delegateGauges[gaugeAddr];\n if (delegate != address(0)) {\n _sendDelegateRewards(gaugeAddr, delegate, rewardTally);\n } else {\n ILiquidityGauge(gaugeAddr).deposit_reward_token(address(rewardToken), rewardTally);\n }\n }\n emit RewardDistributed(gaugeAddr, rewardTally);\n }\n\n /// @notice Helper to send `rewardTally` for `gaugeAddr` to the non zero `delegate` address\n function _sendDelegateRewards(\n address gaugeAddr,\n address delegate,\n uint256 rewardTally\n ) internal {\n rewardToken.safeTransfer(delegate, rewardTally);\n // If this delegate supports a specific interface, then rewards sent are notified through this\n // interface\n if (isInterfaceKnown[delegate]) {\n IAngleMiddlemanGauge(delegate).notifyReward(gaugeAddr, rewardTally);\n }\n }\n\n /// @notice Updates mining rate and supply at the start of the epoch\n /// @dev Any modifying mining call must also call this\n /// @dev It is possible that more than one week past between two calls of this function, and for this reason\n /// this function has been slightly modified from Curve implementation by Angle Team\n function _updateMiningParameters() internal {\n // When entering this function, we always have: `(block.timestamp - startEpochTime) / RATE_REDUCTION_TIME >= 1`\n uint256 epochDelta = (block.timestamp - startEpochTime) / RATE_REDUCTION_TIME;\n\n // Storing intermediate values for the rate and for the `startEpochSupply`\n uint256 _rate = rate;\n uint256 _startEpochSupply = startEpochSupply;\n\n startEpochTime += RATE_REDUCTION_TIME * epochDelta;\n miningEpoch += epochDelta;\n\n for (uint256 i = 0; i < epochDelta; i++) {\n // Updating the intermediate values of the `startEpochSupply`\n _startEpochSupply += _rate * RATE_REDUCTION_TIME;\n _rate = (_rate * BASE) / RATE_REDUCTION_COEFFICIENT;\n }\n rate = _rate;\n startEpochSupply = _startEpochSupply;\n emit UpdateMiningParameters(block.timestamp, _rate, _startEpochSupply);\n }\n\n /// @notice Toggles the fact that a gauge delegate can be used for automation or not and therefore supports\n /// the `notifyReward` interface\n /// @param _delegateGauge Address of the gauge to change\n function _toggleInterfaceKnown(address _delegateGauge) internal {\n bool isInterfaceKnownMem = isInterfaceKnown[_delegateGauge];\n isInterfaceKnown[_delegateGauge] = !isInterfaceKnownMem;\n emit InterfaceKnownToggled(_delegateGauge, !isInterfaceKnownMem);\n }\n\n // ================= Permissionless External Functions =========================\n\n /// @notice Distributes rewards to a staking contract (also called gauge)\n /// @param gaugeAddr Address of the gauge to send tokens too\n /// @return weeksElapsed Number of weeks elapsed since the last time rewards were distributed\n /// @return rewardTally Amount of tokens sent to the gauge\n /// @dev Anyone can call this function to distribute rewards to the different staking contracts\n function distributeReward(address gaugeAddr) external nonReentrant returns (uint256, uint256) {\n // Checking if distribution is on\n require(distributionsOn == true, \"109\");\n // Updating rate distribution parameters if need be\n if (block.timestamp >= startEpochTime + RATE_REDUCTION_TIME) {\n _updateMiningParameters();\n }\n return _distributeReward(gaugeAddr);\n }\n\n /// @notice Distributes rewards to multiple staking contracts\n /// @param gauges Addresses of the gauge to send tokens too\n /// @dev Anyone can call this function to distribute rewards to the different staking contracts\n /// @dev Compared with the `distributeReward` function, this function sends rewards to multiple\n /// contracts at the same time\n function distributeRewardToMultipleGauges(address[] memory gauges) external nonReentrant {\n // Checking if distribution is on\n require(distributionsOn == true, \"109\");\n // Updating rate distribution parameters if need be\n if (block.timestamp >= startEpochTime + RATE_REDUCTION_TIME) {\n _updateMiningParameters();\n }\n for (uint256 i = 0; i < gauges.length; i++) {\n _distributeReward(gauges[i]);\n }\n }\n\n /// @notice Updates mining rate and supply at the start of the epoch\n /// @dev Callable by any address, but only once per epoch\n function updateMiningParameters() external {\n require(block.timestamp >= startEpochTime + RATE_REDUCTION_TIME, \"108\");\n _updateMiningParameters();\n }\n\n // ========================= Governor Functions ================================\n\n /// @notice Withdraws ERC20 tokens that could accrue on this contract\n /// @param tokenAddress Address of the ERC20 token to withdraw\n /// @param to Address to transfer to\n /// @param amount Amount to transfer\n /// @dev Added to support recovering LP Rewards and other mistaken tokens\n /// from other systems to be distributed to holders\n /// @dev This function could also be used to recover ANGLE tokens in case the rate got smaller\n function recoverERC20(\n address tokenAddress,\n address to,\n uint256 amount\n ) external onlyRole(GOVERNOR_ROLE) {\n // If the token is the ANGLE token, we need to make sure that governance is not going to withdraw\n // too many tokens and that it'll be able to sustain the weekly distribution forever\n // This check assumes that `distributeReward` has been called for gauges and that there are no gauges\n // which have not received their past week's rewards\n if (tokenAddress == address(rewardToken)) {\n uint256 currentBalance = rewardToken.balanceOf(address(this));\n // The amount distributed till the end is `rate * WEEK / (1 - RATE_REDUCTION_FACTOR)` where\n // `RATE_REDUCTION_FACTOR = BASE / RATE_REDUCTION_COEFFICIENT` which translates to:\n require(\n currentBalance >=\n ((rate * RATE_REDUCTION_COEFFICIENT) * WEEK) / (RATE_REDUCTION_COEFFICIENT - BASE) + amount,\n \"4\"\n );\n }\n IERC20(tokenAddress).safeTransfer(to, amount);\n emit Recovered(tokenAddress, to, amount);\n }\n\n /// @notice Sets a new gauge controller\n /// @param _controller Address of the new gauge controller\n function setGaugeController(address _controller) external onlyRole(GOVERNOR_ROLE) {\n require(_controller != address(0), \"0\");\n controller = IGaugeController(_controller);\n emit GaugeControllerUpdated(_controller);\n }\n\n /// @notice Sets a new delegate gauge for pulling rewards of a type >= 2 gauges or of all type >= 2 gauges\n /// @param gaugeAddr Gauge to change the delegate of\n /// @param _delegateGauge Address of the new gauge delegate related to `gaugeAddr`\n /// @param toggleInterface Whether we should toggle the fact that the `_delegateGauge` is built for automation or not\n /// @dev This function can be used to remove delegating or introduce the pulling of rewards to a given address\n /// @dev If `gaugeAddr` is the zero address, this function updates the delegate gauge common to all gauges with type >= 2\n /// @dev The `toggleInterface` parameter has been added for convenience to save one transaction when adding a gauge delegate\n /// which supports the `notifyReward` interface\n function setDelegateGauge(\n address gaugeAddr,\n address _delegateGauge,\n bool toggleInterface\n ) external onlyRole(GOVERNOR_ROLE) {\n if (gaugeAddr != address(0)) {\n delegateGauges[gaugeAddr] = _delegateGauge;\n } else {\n delegateGauge = _delegateGauge;\n }\n emit DelegateGaugeUpdated(gaugeAddr, _delegateGauge);\n\n if (toggleInterface) {\n _toggleInterfaceKnown(_delegateGauge);\n }\n }\n\n /// @notice Changes the ANGLE emission rate\n /// @param _newRate New ANGLE emission rate\n /// @dev It is important to be super wary when calling this function and to make sure that `distributeReward`\n /// has been called for all gauges in the past weeks. If not, gauges may get an incorrect distribution of ANGLE rewards\n /// for these past weeks based on the new rate and not on the old rate\n /// @dev Governance should thus make sure to call this function rarely and when it does to do it after the weekly `distributeReward`\n /// calls for all existing gauges\n /// @dev As this function assumes that `distributeReward` has been called during the week, it also assumes that the `startEpochSupply`\n /// parameter has been put up to date\n function setRate(uint256 _newRate) external onlyRole(GOVERNOR_ROLE) {\n // Checking if the new rate is compatible with the amount of ANGLE tokens this contract has in balance\n // This check assumes, like this function, that `distributeReward` has correctly been called before\n require(\n rewardToken.balanceOf(address(this)) >=\n ((_newRate * RATE_REDUCTION_COEFFICIENT) * WEEK) / (RATE_REDUCTION_COEFFICIENT - BASE),\n \"4\"\n );\n rate = _newRate;\n emit RateUpdated(_newRate);\n }\n\n /// @notice Toggles the status of a gauge to either killed or unkilled\n /// @param gaugeAddr Gauge to toggle the status of\n /// @dev It is impossible to kill a gauge in the `GaugeController` contract, for this reason killing of gauges\n /// takes place in the `AngleDistributor` contract\n /// @dev This means that people could vote for a gauge in the gauge controller contract but that rewards are not going\n /// to be distributed to it in the end: people would need to remove their weights on the gauge killed to end the diminution\n /// in rewards\n /// @dev In the case of a gauge being killed, this function resets the timestamps at which this gauge has been approved and\n /// disapproves the gauge to spend the token\n /// @dev It should be cautiously called by governance as it could result in less ANGLE overall rewards than initially planned\n /// if people do not remove their voting weights to the killed gauge\n function toggleGauge(address gaugeAddr) external onlyRole(GOVERNOR_ROLE) {\n bool gaugeKilledMem = killedGauges[gaugeAddr];\n if (!gaugeKilledMem) {\n delete lastTimeGaugePaid[gaugeAddr];\n rewardToken.safeApprove(gaugeAddr, 0);\n }\n killedGauges[gaugeAddr] = !gaugeKilledMem;\n emit GaugeToggled(gaugeAddr, !gaugeKilledMem);\n }\n\n // ========================= Guardian Function =================================\n\n /// @notice Halts or activates distribution of rewards\n function toggleDistributions() external onlyRole(GUARDIAN_ROLE) {\n bool distributionsOnMem = distributionsOn;\n distributionsOn = !distributionsOnMem;\n emit DistributionsToggled(!distributionsOnMem);\n }\n\n /// @notice Notifies that the interface of a gauge delegate is known or has changed\n /// @param _delegateGauge Address of the gauge to change\n /// @dev Gauge delegates that are built for automation should be toggled\n function toggleInterfaceKnown(address _delegateGauge) external onlyRole(GUARDIAN_ROLE) {\n _toggleInterfaceKnown(_delegateGauge);\n }\n}\n" + }, + "contracts/mock/AngleDistributorEvents.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.7;\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport \"@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol\";\n\nimport \"../interfaces/CoreModuleInterfaces.sol\";\n\nimport \"../external/AccessControlUpgradeable.sol\";\n\n/// @title AngleDistributorEvents\n/// @author Angle Core Team\n/// @notice All the events used in `AngleDistributor` contract\ncontract AngleDistributorEvents {\n event DelegateGaugeUpdated(address indexed _gaugeAddr, address indexed _delegateGauge);\n event DistributionsToggled(bool _distributionsOn);\n event GaugeControllerUpdated(address indexed _controller);\n event GaugeToggled(address indexed gaugeAddr, bool newStatus);\n event InterfaceKnownToggled(address indexed _delegateGauge, bool _isInterfaceKnown);\n event RateUpdated(uint256 _newRate);\n event Recovered(address indexed tokenAddress, address indexed to, uint256 amount);\n event RewardDistributed(address indexed gaugeAddr, uint256 rewardTally);\n event UpdateMiningParameters(uint256 time, uint256 rate, uint256 supply);\n}\n" + }, + "contracts/mock/MockCoreBorrow.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\ncontract MockCoreBorrow {\n mapping(address => bool) public governors;\n mapping(address => bool) public guardians;\n\n function isGovernor(address admin) external view returns (bool) {\n return governors[admin];\n }\n\n function isGovernorOrGuardian(address admin) external view returns (bool) {\n return governors[admin] || guardians[admin];\n }\n\n function toggleGovernor(address admin) external {\n governors[admin] = !governors[admin];\n }\n\n function toggleGuardian(address admin) external {\n guardians[admin] = !guardians[admin];\n }\n}\n" + }, + "contracts/mock/MockMerklGaugeMiddleman.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"../middleman/MerklGaugeMiddleman.sol\";\n\ncontract MockMerklGaugeMiddleman is MerklGaugeMiddleman {\n address public angleDistributorAddress;\n IERC20 public angleAddress;\n DistributionCreator public manager;\n\n constructor(ICore _coreBorrow) MerklGaugeMiddleman(_coreBorrow) {}\n\n function angle() public view override returns (IERC20) {\n return angleAddress;\n }\n\n function merklDistributionCreator() public view override returns (DistributionCreator) {\n return manager;\n }\n\n function setAddresses(\n address _angleDistributorAddress,\n IERC20 _angleAddress,\n DistributionCreator _manager\n ) external {\n angleDistributorAddress = _angleDistributorAddress;\n angleAddress = _angleAddress;\n manager = _manager;\n }\n}\n" + }, + "contracts/mock/MockPool.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.7;\n\ncontract MockPool {\n address public token0;\n address public token1;\n uint32 public constant EPOCH_DURATION = 3600;\n\n function setToken(address token, uint256 who) external {\n if (who == 0) token0 = token;\n else token1 = token;\n }\n}\n" + }, + "contracts/mock/MockToken.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.7;\n\nimport \"@openzeppelin/contracts/token/ERC20/ERC20.sol\";\n\ncontract MockToken is ERC20 {\n event Minting(address indexed _to, address indexed _minter, uint256 _amount);\n\n event Burning(address indexed _from, address indexed _burner, uint256 _amount);\n\n uint8 internal _decimal;\n mapping(address => bool) public minters;\n address public treasury;\n\n constructor(\n string memory name_,\n string memory symbol_,\n uint8 decimal_\n ) ERC20(name_, symbol_) {\n _decimal = decimal_;\n }\n\n function decimals() public view override returns (uint8) {\n return _decimal;\n }\n\n function mint(address account, uint256 amount) external {\n _mint(account, amount);\n emit Minting(account, msg.sender, amount);\n }\n\n function burn(address account, uint256 amount) public {\n _burn(account, amount);\n emit Burning(account, msg.sender, amount);\n }\n\n function setAllowance(address from, address to) public {\n _approve(from, to, type(uint256).max);\n }\n\n function burnSelf(uint256 amount, address account) public {\n _burn(account, amount);\n emit Burning(account, msg.sender, amount);\n }\n\n function addMinter(address minter) public {\n minters[minter] = true;\n }\n\n function removeMinter(address minter) public {\n minters[minter] = false;\n }\n\n function setTreasury(address _treasury) public {\n treasury = _treasury;\n }\n}\n" + }, + "contracts/mock/MockTokenPermit.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.7;\n\nimport \"@openzeppelin/contracts/token/ERC20/extensions/draft-ERC20Permit.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\n\ncontract MockTokenPermit is ERC20Permit {\n using SafeERC20 for IERC20;\n event Minting(address indexed _to, address indexed _minter, uint256 _amount);\n\n event Burning(address indexed _from, address indexed _burner, uint256 _amount);\n\n uint8 internal _decimal;\n mapping(address => bool) public minters;\n address public treasury;\n uint256 public fees;\n\n bool public reverts;\n\n constructor(\n string memory name_,\n string memory symbol_,\n uint8 decimal_\n ) ERC20Permit(name_) ERC20(name_, symbol_) {\n _decimal = decimal_;\n }\n\n function decimals() public view override returns (uint8) {\n return _decimal;\n }\n\n function mint(address account, uint256 amount) external {\n _mint(account, amount);\n emit Minting(account, msg.sender, amount);\n }\n\n function burn(address account, uint256 amount) public {\n _burn(account, amount);\n emit Burning(account, msg.sender, amount);\n }\n\n function setAllowance(address from, address to) public {\n _approve(from, to, type(uint256).max);\n }\n\n function burnSelf(uint256 amount, address account) public {\n _burn(account, amount);\n emit Burning(account, msg.sender, amount);\n }\n\n function addMinter(address minter) public {\n minters[minter] = true;\n }\n\n function removeMinter(address minter) public {\n minters[minter] = false;\n }\n\n function setTreasury(address _treasury) public {\n treasury = _treasury;\n }\n\n function setFees(uint256 _fees) public {\n fees = _fees;\n }\n\n function recoverERC20(\n IERC20 token,\n address to,\n uint256 amount\n ) external {\n token.safeTransfer(to, amount);\n }\n\n function swapIn(\n address bridgeToken,\n uint256 amount,\n address to\n ) external returns (uint256) {\n require(!reverts);\n\n IERC20(bridgeToken).safeTransferFrom(msg.sender, address(this), amount);\n uint256 canonicalOut = amount;\n canonicalOut -= (canonicalOut * fees) / 10**9;\n _mint(to, canonicalOut);\n return canonicalOut;\n }\n\n function swapOut(\n address bridgeToken,\n uint256 amount,\n address to\n ) external returns (uint256) {\n require(!reverts);\n _burn(msg.sender, amount);\n uint256 bridgeOut = amount;\n bridgeOut -= (bridgeOut * fees) / 10**9;\n IERC20(bridgeToken).safeTransfer(to, bridgeOut);\n return bridgeOut;\n }\n}\n" + }, + "contracts/mock/MockTreasury.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\ncontract MockTreasury {\n address public stablecoin;\n address public governor;\n address public guardian;\n address public vaultManager1;\n address public vaultManager2;\n address public flashLoanModule;\n\n constructor(\n address _stablecoin,\n address _governor,\n address _guardian,\n address _vaultManager1,\n address _vaultManager2,\n address _flashLoanModule\n ) {\n stablecoin = _stablecoin;\n governor = _governor;\n guardian = _guardian;\n vaultManager1 = _vaultManager1;\n vaultManager2 = _vaultManager2;\n flashLoanModule = _flashLoanModule;\n }\n\n function isGovernor(address admin) external view returns (bool) {\n return (admin == governor);\n }\n\n function isGovernorOrGuardian(address admin) external view returns (bool) {\n return (admin == governor || admin == guardian);\n }\n}\n" + }, + "contracts/mock/MockUniswapV3Pool.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.7;\n\ncontract MockUniswapV3Pool {\n address public token0;\n address public token1;\n uint32 public constant EPOCH_DURATION = 3600;\n uint256 public fee;\n\n function setToken(address token, uint256 who) external {\n if (who == 0) token0 = token;\n else token1 = token;\n }\n\n function round(uint256 amount) external pure returns (uint256) {\n return (amount / EPOCH_DURATION) * EPOCH_DURATION;\n }\n}\n" + }, + "contracts/struct/DistributionParameters.sol": { + "content": "// SPDX-License-Identifier: BUSL-1.1\n\npragma solidity ^0.8.17;\n\nstruct DistributionParameters {\n // ID of the reward (populated once created)\n bytes32 rewardId;\n // Address of the UniswapV3 pool that needs to be incentivized\n address uniV3Pool;\n // Address of the reward token for the incentives\n address rewardToken;\n // Amount of `rewardToken` to distribute across all the epochs\n // Amount distributed per epoch is `amount/numEpoch`\n uint256 amount;\n // List of all position wrappers to consider or not for this contract. Some wrappers like Gamma or Arrakis\n // are automatically detected and so there is no need to specify them here. Check out the docs to find out\n // which need to be specified and which are not automatically detected.\n address[] positionWrappers;\n // Type (Arrakis, Gamma, Blacklist, ...) encoded as a `uint32` for each wrapper in the list above. Mapping between\n // wrapper types and their corresponding `uint32` value can be found in Angle Docs\n uint32[] wrapperTypes;\n // In the incentivization formula, how much of the fees should go to holders of token0\n // in base 10**4\n uint32 propToken0;\n // Proportion for holding token1 (in base 10**4)\n uint32 propToken1;\n // Proportion for providing a useful liquidity (in base 10**4) that generates fees\n uint32 propFees;\n // Timestamp at which the incentivization should start\n uint32 epochStart;\n // Amount of epochs for which incentivization should last\n uint32 numEpoch;\n // Whether out of range liquidity should still be incentivized or not\n // This should be equal to 1 if out of range liquidity should still be incentivized\n // and 0 otherwise\n uint32 isOutOfRangeIncentivized;\n // How much more addresses with a maximum boost can get with respect to addresses\n // which do not have a boost (in base 4). In the case of Curve where addresses get 2.5x more\n // this would be 25000\n uint32 boostedReward;\n // Address of the token which dictates who gets boosted rewards or not. This is optional\n // and if the zero address is given no boost will be taken into account\n address boostingAddress;\n // Additional data passed when distributing rewards. This parameter may be used in case\n // the reward distribution script needs to look into other parameters beyond the ones above.\n bytes additionalData;\n}\n" + }, + "contracts/struct/ExtensiveDistributionParameters.sol": { + "content": "// SPDX-License-Identifier: BUSL-1.1\n\npragma solidity ^0.8.17;\n\nimport \"./DistributionParameters.sol\";\n\nstruct UniswapTokenData {\n address add;\n uint8 decimals;\n string symbol;\n uint256 poolBalance;\n}\n\nstruct ExtensiveDistributionParameters {\n DistributionParameters base;\n // Uniswap pool data\n uint24 poolFee;\n UniswapTokenData token0;\n UniswapTokenData token1;\n // rewardToken data\n string rewardTokenSymbol;\n uint8 rewardTokenDecimals;\n}\n" + }, + "contracts/struct/RewardTokenAmounts.sol": { + "content": "// SPDX-License-Identifier: BUSL-1.1\n\npragma solidity ^0.8.17;\n\nstruct RewardTokenAmounts {\n address token;\n uint256 minimumAmountPerEpoch;\n}\n" + }, + "contracts/utils/Errors.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nerror InvalidDispute();\nerror InvalidLengths();\nerror InvalidParam();\nerror InvalidParams();\nerror InvalidProof();\nerror InvalidUninitializedRoot();\nerror InvalidReward();\nerror InvalidSignature();\nerror NoDispute();\nerror NotGovernor();\nerror NotGovernorOrGuardian();\nerror NotSigned();\nerror NotTrusted();\nerror NotWhitelisted();\nerror UnresolvedDispute();\nerror ZeroAddress();\n" + }, + "contracts/utils/UUPSHelper.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\n/*\n * █ \n ***** ▓▓▓ \n * ▓▓▓▓▓▓▓ \n * ///. ▓▓▓▓▓▓▓▓▓▓▓▓▓ \n ***** //////// ▓▓▓▓▓▓▓ \n * ///////////// ▓▓▓ \n ▓▓ ////////////////// █ ▓▓ \n ▓▓ ▓▓ /////////////////////// ▓▓ ▓▓ \n ▓▓ ▓▓ //////////////////////////// ▓▓ ▓▓ \n ▓▓ ▓▓ /////////▓▓▓///////▓▓▓///////// ▓▓ ▓▓ \n ▓▓ ,////////////////////////////////////// ▓▓ ▓▓ \n ▓▓ ////////////////////////////////////////// ▓▓ \n ▓▓ //////////////////////▓▓▓▓///////////////////// \n ,//////////////////////////////////////////////////// \n .////////////////////////////////////////////////////////// \n .//////////////////////////██.,//////////////////////////█ \n .//////////////////////████..,./////////////////////██ \n ...////////////////███████.....,.////////////////███ \n ,.,////////////████████ ........,///////////████ \n .,.,//////█████████ ,.......///////████ \n ,..//████████ ........./████ \n ..,██████ .....,███ \n .██ ,.,█ \n \n \n \n ▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓ ▓▓▓▓▓▓▓▓▓▓ \n ▓▓▓▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓ ▓▓ ▓▓▓▓ \n ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓ ▓▓▓▓▓ \n ▓▓▓ ▓▓ ▓▓▓ ▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ \n*/\n\npragma solidity ^0.8.17;\n\nimport \"@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol\";\n\nimport \"../interfaces/ICore.sol\";\nimport \"../utils/Errors.sol\";\n\n/// @title UUPSHelper\n/// @notice Helper contract for UUPSUpgradeable contracts where the upgradeability is controlled by a specific address\n/// @author Angle Labs., Inc\n/// @dev The 0 address check in the modifier allows the use of these modifiers during initialization\nabstract contract UUPSHelper is UUPSUpgradeable {\n modifier onlyGuardianUpgrader(ICore _core) {\n if (address(_core) != address(0) && !_core.isGovernorOrGuardian(msg.sender)) revert NotGovernorOrGuardian();\n _;\n }\n\n modifier onlyGovernorUpgrader(ICore _core) {\n if (address(_core) != address(0) && !_core.isGovernor(msg.sender)) revert NotGovernor();\n _;\n }\n\n constructor() initializer {}\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 100000 + }, + "viaIR": false, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + } + } +} \ No newline at end of file diff --git a/hardhat.config.ts b/hardhat.config.ts index 68ce437..4171d10 100644 --- a/hardhat.config.ts +++ b/hardhat.config.ts @@ -81,7 +81,7 @@ const config: HardhatUserConfig = { // For the lists of Chain ID: https://chainlist.org networks: { hardhat: { - accounts: accounts('base'), + accounts: accounts('filecoin'), live: false, blockGasLimit: 125e5, initialBaseFeePerGas: 0, @@ -116,7 +116,7 @@ const config: HardhatUserConfig = { url: nodeUrl('polygonzkevm'), blockNumber: 3214816, */ - url: nodeUrl('linea'), + url: nodeUrl('filecoin'), // blockNumber: 14188687, }, mining: argv.disableAutoMining @@ -317,6 +317,19 @@ const config: HardhatUserConfig = { }, }, }, + filecoin: { + live: true, + url: nodeUrl('filecoin'), + accounts: accounts('filecoin'), + gas: 'auto', + gasMultiplier: 1.3, + chainId: 314, + verify: { + etherscan: { + apiKey: etherscanKey('filecoin'), + }, + }, + }, }, paths: { sources: './contracts', diff --git a/scripts/message.ts b/scripts/getMessage.ts similarity index 84% rename from scripts/message.ts rename to scripts/getMessage.ts index 8bd8bb2..9440ef0 100644 --- a/scripts/message.ts +++ b/scripts/getMessage.ts @@ -11,8 +11,9 @@ async function main() { deployer, ) as DistributionCreator; - console.log('Toggling signature whitelist'); - console.log(await manager.message()); + console.log('Getting message'); + const message = await manager.message(); + console.log(message); } main().catch(error => { diff --git a/scripts/setDisputeAmount.ts b/scripts/setDisputeAmount.ts new file mode 100644 index 0000000..4af0141 --- /dev/null +++ b/scripts/setDisputeAmount.ts @@ -0,0 +1,21 @@ +import { deployments, ethers } from 'hardhat'; + +import { Distributor, Distributor__factory } from '../typechain'; + +async function main() { + const { deployer } = await ethers.getNamedSigners(); + const managerAddress = (await deployments.get('Distributor')).address; + const manager: Distributor = new ethers.Contract( + managerAddress, + Distributor__factory.createInterface(), + deployer, + ) as Distributor; + + console.log('Setting dispute amount'); + await manager.setDisputeAmount(100000000000000000000); +} + +main().catch(error => { + console.error(error); + process.exit(1); +}); diff --git a/scripts/setDisputePeriod.ts b/scripts/setDisputePeriod.ts new file mode 100644 index 0000000..4d29e23 --- /dev/null +++ b/scripts/setDisputePeriod.ts @@ -0,0 +1,21 @@ +import { deployments, ethers } from 'hardhat'; + +import { Distributor, Distributor__factory } from '../typechain'; + +async function main() { + const { deployer } = await ethers.getNamedSigners(); + const managerAddress = (await deployments.get('Distributor')).address; + const manager: Distributor = new ethers.Contract( + managerAddress, + Distributor__factory.createInterface(), + deployer, + ) as Distributor; + + console.log('Setting dispute period'); + await manager.setDisputePeriod(1); +} + +main().catch(error => { + console.error(error); + process.exit(1); +}); diff --git a/scripts/setDisputeToken.ts b/scripts/setDisputeToken.ts new file mode 100644 index 0000000..c0c3a0d --- /dev/null +++ b/scripts/setDisputeToken.ts @@ -0,0 +1,21 @@ +import { deployments, ethers } from 'hardhat'; + +import { Distributor, Distributor__factory } from '../typechain'; + +async function main() { + const { deployer } = await ethers.getNamedSigners(); + const managerAddress = (await deployments.get('Distributor')).address; + const manager: Distributor = new ethers.Contract( + managerAddress, + Distributor__factory.createInterface(), + deployer, + ) as Distributor; + + console.log('Setting dispute token'); + await manager.setDisputeToken(deployer.address); +} + +main().catch(error => { + console.error(error); + process.exit(1); +}); diff --git a/scripts/setFeeRecipient.ts b/scripts/setFeeRecipient.ts new file mode 100644 index 0000000..66d993d --- /dev/null +++ b/scripts/setFeeRecipient.ts @@ -0,0 +1,21 @@ +import { deployments, ethers } from 'hardhat'; + +import { DistributionCreator, DistributionCreator__factory } from '../typechain'; + +async function main() { + const { deployer } = await ethers.getNamedSigners(); + const managerAddress = (await deployments.get('DistributionCreator')).address; + const manager: DistributionCreator = new ethers.Contract( + managerAddress, + DistributionCreator__factory.createInterface(), + deployer, + ) as DistributionCreator; + + console.log('Setting fee recipient'); + await manager.setFeeRecipient('0x916685b590233ba10c0b52b3fae6b0e75e9ab477'); +} + +main().catch(error => { + console.error(error); + process.exit(1); +}); diff --git a/scripts/setMessage.ts b/scripts/setMessage.ts new file mode 100644 index 0000000..a9eb9d9 --- /dev/null +++ b/scripts/setMessage.ts @@ -0,0 +1,23 @@ +import { deployments, ethers } from 'hardhat'; + +import { DistributionCreator, DistributionCreator__factory } from '../typechain'; + +async function main() { + const { deployer } = await ethers.getNamedSigners(); + const managerAddress = (await deployments.get('DistributionCreator')).address; + const manager: DistributionCreator = new ethers.Contract( + managerAddress, + DistributionCreator__factory.createInterface(), + deployer, + ) as DistributionCreator; + + console.log('Setting message'); + const message = + " 1. Merkl is experimental software provided as is, use it at your own discretion. There may notably be delays in the onchain Merkle root updates and there may be flaws in the script (or engine) or in the infrastructure used to update results onchain. In that regard, everyone can permissionlessly dispute the rewards which are posted onchain, and when creating a distribution, you are responsible for checking the results and eventually dispute them. 2. If you are specifying an invalid pool address or a pool from an AMM that is not marked as supported, your rewards will not be taken into account and you will not be able to recover them. 3. If you do not blacklist liquidity position managers or smart contract addresses holding LP tokens that are not natively supported by the Merkl system, or if you don't specify the addresses of the liquidity position managers that are not automatically handled by the system, then the script will not be able to take the specifities of these addresses into account, and it will reward them like a normal externally owned account would be. If these are smart contracts that do not support external rewards, then rewards that should be accruing to it will be lost. 4. If rewards sent through Merkl remain unclaimed for a period of more than 1 year after the end of the distribution (because they are meant for instance for smart contract addresses that cannot claim or deal with them), then we reserve the right to recover these rewards. 5. Fees apply to incentives deposited on Merkl, unless the pools incentivized contain a whitelisted token (e.g an Angle Protocol stablecoin). 6. By interacting with the Merkl smart contract to deposit an incentive for a pool, you are exposed to smart contract risk and to the offchain mechanism used to compute reward distribution. 7. If the rewards you are sending are too small in value, or if you are sending rewards using a token that is not approved for it, your rewards will not be handled by the script, and they may be lost. 8. If you mistakenly send too much rewards compared with what you wanted to send, you will not be able to call them back. You will also not be able to prematurely end a reward distribution once created. 9. The engine handling reward distribution for a pool may not look at all the swaps occurring on the pool during the time for which you are incentivizing, but just at a subset of it to gain in efficiency. Overall, if you distribute incentives using Merkl, it means that you are aware of how the engine works, of the approximations it makes and of the behaviors it may trigger (e.g. just in time liquidity). 10. Rewards corresponding to incentives distributed through Merkl do not compound block by block, but are regularly made available (through a Merkle root update) at a frequency which depends on the chain. "; + await manager.setMessage(message); +} + +main().catch(error => { + console.error(error); + process.exit(1); +}); diff --git a/scripts/setRewardTokenMinAmount.ts b/scripts/setRewardTokenMinAmount.ts new file mode 100644 index 0000000..0d5df75 --- /dev/null +++ b/scripts/setRewardTokenMinAmount.ts @@ -0,0 +1,27 @@ +import { deployments, ethers } from 'hardhat'; + +import { DistributionCreator, DistributionCreator__factory } from '../typechain'; + +async function main() { + let manager: DistributionCreator; + const { deployer } = await ethers.getNamedSigners(); + const managerAddress = (await deployments.get('DistributionCreator')).address; + + manager = new ethers.Contract( + managerAddress, + DistributionCreator__factory.createInterface(), + deployer, + ) as DistributionCreator; + + console.log('Setting reward token min amount'); + await ( + await manager + .connect(deployer) + .setRewardTokenMinAmounts(['0x0D1E753a25eBda689453309112904807625bEFBe'], [200000000000000000000000]) + ).wait(); +} + +main().catch(error => { + console.error(error); + process.exit(1); +}); diff --git a/scripts/toggleTokenWhitelist.ts b/scripts/toggleTokenWhitelist.ts new file mode 100644 index 0000000..16849ff --- /dev/null +++ b/scripts/toggleTokenWhitelist.ts @@ -0,0 +1,24 @@ +import { deployments, ethers } from 'hardhat'; + +import { DistributionCreator, DistributionCreator__factory } from '../typechain'; + +async function main() { + let manager: DistributionCreator; + const { deployer } = await ethers.getNamedSigners(); + + const managerAddress = (await deployments.get('DistributionCreator')).address; + + manager = new ethers.Contract( + managerAddress, + DistributionCreator__factory.createInterface(), + deployer, + ) as DistributionCreator; + + console.log('Toggling token whitelist'); + await (await manager.connect(deployer).toggleTokenWhitelist(deployer.address)).wait(); +} + +main().catch(error => { + console.error(error); + process.exit(1); +}); diff --git a/scripts/toggleTrusted.ts b/scripts/toggleTrusted.ts new file mode 100644 index 0000000..f460bd5 --- /dev/null +++ b/scripts/toggleTrusted.ts @@ -0,0 +1,21 @@ +import { deployments, ethers } from 'hardhat'; + +import { Distributor, Distributor__factory } from '../typechain'; + +async function main() { + const { deployer } = await ethers.getNamedSigners(); + const managerAddress = (await deployments.get('Distributor')).address; + const manager: Distributor = new ethers.Contract( + managerAddress, + Distributor__factory.createInterface(), + deployer, + ) as Distributor; + + console.log('Toggling trusted'); + await manager.toggleTrusted('0x435046800Fb9149eE65159721A92cB7d50a7534b'); +} + +main().catch(error => { + console.error(error); + process.exit(1); +}); From 8162383d3ac30905bb408fa4fbf9810a30cd9e27 Mon Sep 17 00:00:00 2001 From: Pablo Veyrat Date: Mon, 13 Nov 2023 18:56:27 +0100 Subject: [PATCH 2/3] feat: coredao and thundercore deployments --- deploy/0_distributor.ts | 4 +- deploy/1_distributionCreator.ts | 3 +- deployments/coredao/.chainId | 1 + deployments/coredao/DistributionCreator.json | 132 + .../DistributionCreator_Implementation_7.json | 4743 +++++++++++++++++ deployments/coredao/Distributor.json | 132 + .../coredao/Distributor_Implementation_2.json | 1248 +++++ .../1d17a992f70400315a977c7229541e31.json | 132 + .../69984a2380fa2fad0c3afbbb08b5652b.json | 98 + .../e77f17fbb4334e4df730b35bdfde2517.json | 213 + deployments/thundercore/.chainId | 1 + .../thundercore/DistributionCreator.json | 132 + .../DistributionCreator_Implementation_7.json | 4743 +++++++++++++++++ deployments/thundercore/Distributor.json | 132 + .../Distributor_Implementation_2.json | 1248 +++++ .../1d17a992f70400315a977c7229541e31.json | 132 + .../69984a2380fa2fad0c3afbbb08b5652b.json | 98 + .../e77f17fbb4334e4df730b35bdfde2517.json | 213 + hardhat.config.ts | 30 +- 19 files changed, 13430 insertions(+), 5 deletions(-) create mode 100644 deployments/coredao/.chainId create mode 100644 deployments/coredao/DistributionCreator.json create mode 100644 deployments/coredao/DistributionCreator_Implementation_7.json create mode 100644 deployments/coredao/Distributor.json create mode 100644 deployments/coredao/Distributor_Implementation_2.json create mode 100644 deployments/coredao/solcInputs/1d17a992f70400315a977c7229541e31.json create mode 100644 deployments/coredao/solcInputs/69984a2380fa2fad0c3afbbb08b5652b.json create mode 100644 deployments/coredao/solcInputs/e77f17fbb4334e4df730b35bdfde2517.json create mode 100644 deployments/thundercore/.chainId create mode 100644 deployments/thundercore/DistributionCreator.json create mode 100644 deployments/thundercore/DistributionCreator_Implementation_7.json create mode 100644 deployments/thundercore/Distributor.json create mode 100644 deployments/thundercore/Distributor_Implementation_2.json create mode 100644 deployments/thundercore/solcInputs/1d17a992f70400315a977c7229541e31.json create mode 100644 deployments/thundercore/solcInputs/69984a2380fa2fad0c3afbbb08b5652b.json create mode 100644 deployments/thundercore/solcInputs/e77f17fbb4334e4df730b35bdfde2517.json diff --git a/deploy/0_distributor.ts b/deploy/0_distributor.ts index a31f3db..0e04e28 100644 --- a/deploy/0_distributor.ts +++ b/deploy/0_distributor.ts @@ -10,6 +10,7 @@ const func: DeployFunction = async ({ deployments, ethers, network }) => { const { deployer } = await ethers.getNamedSigners(); let core: string; + // TODO: change the coreMerkl address to that of the desired chain core = '0x3E399AE5B4D8bc0021e53b51c8BCdD66DD62c03b'; /* if (!network.live) { @@ -23,7 +24,7 @@ const func: DeployFunction = async ({ deployments, ethers, network }) => { console.log('Let us get started with deployment'); console.log(deployer.address); - /* + console.log('Now deploying Distributor'); console.log('Starting with the implementation'); @@ -32,7 +33,6 @@ const func: DeployFunction = async ({ deployments, ethers, network }) => { from: deployer.address, log: !argv.ci, }); - */ const implementationAddress = (await ethers.getContract('Distributor_Implementation_2')).address; diff --git a/deploy/1_distributionCreator.ts b/deploy/1_distributionCreator.ts index 5b5e789..66a6013 100644 --- a/deploy/1_distributionCreator.ts +++ b/deploy/1_distributionCreator.ts @@ -11,6 +11,7 @@ const func: DeployFunction = async ({ deployments, ethers, network }) => { const { deployer } = await ethers.getNamedSigners(); let core: string; + // TODO: change the coreMerkl address to that of the desired chain core = '0x3E399AE5B4D8bc0021e53b51c8BCdD66DD62c03b'; /* if (!network.live) { @@ -78,5 +79,5 @@ const func: DeployFunction = async ({ deployments, ethers, network }) => { }; func.tags = ['distributionCreator']; -func.dependencies = []; +func.dependencies = ['distributor']; export default func; diff --git a/deployments/coredao/.chainId b/deployments/coredao/.chainId new file mode 100644 index 0000000..a42ee12 --- /dev/null +++ b/deployments/coredao/.chainId @@ -0,0 +1 @@ +1116 \ No newline at end of file diff --git a/deployments/coredao/DistributionCreator.json b/deployments/coredao/DistributionCreator.json new file mode 100644 index 0000000..468dfb4 --- /dev/null +++ b/deployments/coredao/DistributionCreator.json @@ -0,0 +1,132 @@ +{ + "address": "0x8BB4C975Ff3c250e0ceEA271728547f3802B36Fd", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_logic", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "stateMutability": "payable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "previousAdmin", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "AdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "beacon", + "type": "address" + } + ], + "name": "BeaconUpgraded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "stateMutability": "payable", + "type": "receive" + } + ], + "transactionHash": "0x86522d59f452ad4a192bfd7f8f689c00795b9613da07c4dd2c1a9fd871758ff8", + "receipt": { + "to": null, + "from": "0x9f76a95AA7535bb0893cf88A146396e00ed21A12", + "contractAddress": "0x8BB4C975Ff3c250e0ceEA271728547f3802B36Fd", + "transactionIndex": 1, + "gasUsed": "273887", + "logsBloom": "0x00000000000000000000000000000000400000001000000000000000000000000000000002001000000000000000000000000200000000800000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x22812eba206bb7ed5a6baefa6ebd7e863720994c5612a8dc5bd4679711337ec5", + "transactionHash": "0x86522d59f452ad4a192bfd7f8f689c00795b9613da07c4dd2c1a9fd871758ff8", + "logs": [ + { + "transactionIndex": 1, + "blockNumber": 8867928, + "transactionHash": "0x86522d59f452ad4a192bfd7f8f689c00795b9613da07c4dd2c1a9fd871758ff8", + "address": "0x8BB4C975Ff3c250e0ceEA271728547f3802B36Fd", + "topics": [ + "0xbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b", + "0x0000000000000000000000007db28175b63f154587bbb1cae62d39ea80a23383" + ], + "data": "0x", + "logIndex": 1, + "blockHash": "0x22812eba206bb7ed5a6baefa6ebd7e863720994c5612a8dc5bd4679711337ec5" + } + ], + "blockNumber": 8867928, + "cumulativeGasUsed": "318106", + "status": 1, + "byzantium": true + }, + "args": [ + "0x7Db28175B63f154587BbB1Cae62D39Ea80A23383", + "0x" + ], + "numDeployments": 1, + "solcInputHash": "e77f17fbb4334e4df730b35bdfde2517", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_logic\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"previousAdmin\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"AdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"beacon\",\"type\":\"address\"}],\"name\":\"BeaconUpgraded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"implementation\",\"type\":\"address\"}],\"name\":\"Upgraded\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"details\":\"This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an implementation address that can be changed. This address is stored in storage in the location specified by https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the implementation behind the proxy.\",\"kind\":\"dev\",\"methods\":{\"constructor\":{\"details\":\"Initializes the upgradeable proxy with an initial implementation specified by `_logic`. If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded function call, and allows initializing the storage of the proxy like a Solidity constructor.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol\":\"ERC1967Proxy\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":100000},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/interfaces/draft-IERC1822.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\\n * proxy whose upgrades are fully controlled by the current implementation.\\n */\\ninterface IERC1822Proxiable {\\n /**\\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\\n * address.\\n *\\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\\n * function revert if invoked through a proxy.\\n */\\n function proxiableUUID() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0x1d4afe6cb24200cc4545eed814ecf5847277dfe5d613a1707aad5fceecebcfff\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/ERC1967/ERC1967Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../Proxy.sol\\\";\\nimport \\\"./ERC1967Upgrade.sol\\\";\\n\\n/**\\n * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an\\n * implementation address that can be changed. This address is stored in storage in the location specified by\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the\\n * implementation behind the proxy.\\n */\\ncontract ERC1967Proxy is Proxy, ERC1967Upgrade {\\n /**\\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.\\n *\\n * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded\\n * function call, and allows initializing the storage of the proxy like a Solidity constructor.\\n */\\n constructor(address _logic, bytes memory _data) payable {\\n _upgradeToAndCall(_logic, _data, false);\\n }\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _implementation() internal view virtual override returns (address impl) {\\n return ERC1967Upgrade._getImplementation();\\n }\\n}\\n\",\"keccak256\":\"0xa2b22da3032e50b55f95ec1d13336102d675f341167aa76db571ef7f8bb7975d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/ERC1967/ERC1967Upgrade.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (proxy/ERC1967/ERC1967Upgrade.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../beacon/IBeacon.sol\\\";\\nimport \\\"../../interfaces/draft-IERC1822.sol\\\";\\nimport \\\"../../utils/Address.sol\\\";\\nimport \\\"../../utils/StorageSlot.sol\\\";\\n\\n/**\\n * @dev This abstract contract provides getters and event emitting update functions for\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\\n *\\n * _Available since v4.1._\\n *\\n * @custom:oz-upgrades-unsafe-allow delegatecall\\n */\\nabstract contract ERC1967Upgrade {\\n // This is the keccak-256 hash of \\\"eip1967.proxy.rollback\\\" subtracted by 1\\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\\n\\n /**\\n * @dev Storage slot with the address of the current implementation.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n /**\\n * @dev Emitted when the implementation is upgraded.\\n */\\n event Upgraded(address indexed implementation);\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _getImplementation() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 implementation slot.\\n */\\n function _setImplementation(address newImplementation) private {\\n require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n }\\n\\n /**\\n * @dev Perform implementation upgrade\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeTo(address newImplementation) internal {\\n _setImplementation(newImplementation);\\n emit Upgraded(newImplementation);\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCall(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _upgradeTo(newImplementation);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(newImplementation, data);\\n }\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCallUUPS(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n // Upgrades from old implementations will perform a rollback test. This test requires the new\\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\\n // this special case will break upgrade paths from old UUPS implementation to new ones.\\n if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) {\\n _setImplementation(newImplementation);\\n } else {\\n try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {\\n require(slot == _IMPLEMENTATION_SLOT, \\\"ERC1967Upgrade: unsupported proxiableUUID\\\");\\n } catch {\\n revert(\\\"ERC1967Upgrade: new implementation is not UUPS\\\");\\n }\\n _upgradeToAndCall(newImplementation, data, forceCall);\\n }\\n }\\n\\n /**\\n * @dev Storage slot with the admin of the contract.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.admin\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n /**\\n * @dev Emitted when the admin account has changed.\\n */\\n event AdminChanged(address previousAdmin, address newAdmin);\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _getAdmin() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 admin slot.\\n */\\n function _setAdmin(address newAdmin) private {\\n require(newAdmin != address(0), \\\"ERC1967: new admin is the zero address\\\");\\n StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n */\\n function _changeAdmin(address newAdmin) internal {\\n emit AdminChanged(_getAdmin(), newAdmin);\\n _setAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\\n */\\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\\n\\n /**\\n * @dev Emitted when the beacon is upgraded.\\n */\\n event BeaconUpgraded(address indexed beacon);\\n\\n /**\\n * @dev Returns the current beacon.\\n */\\n function _getBeacon() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_BEACON_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new beacon in the EIP1967 beacon slot.\\n */\\n function _setBeacon(address newBeacon) private {\\n require(Address.isContract(newBeacon), \\\"ERC1967: new beacon is not a contract\\\");\\n require(\\n Address.isContract(IBeacon(newBeacon).implementation()),\\n \\\"ERC1967: beacon implementation is not a contract\\\"\\n );\\n StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon;\\n }\\n\\n /**\\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\\n *\\n * Emits a {BeaconUpgraded} event.\\n */\\n function _upgradeBeaconToAndCall(\\n address newBeacon,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _setBeacon(newBeacon);\\n emit BeaconUpgraded(newBeacon);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xabf3f59bc0e5423eae45e459dbe92e7052c6983628d39008590edc852a62f94a\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (proxy/Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\\n * be specified by overriding the virtual {_implementation} function.\\n *\\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\\n * different contract through the {_delegate} function.\\n *\\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\\n */\\nabstract contract Proxy {\\n /**\\n * @dev Delegates the current call to `implementation`.\\n *\\n * This function does not return to its internal call site, it will return directly to the external caller.\\n */\\n function _delegate(address implementation) internal virtual {\\n assembly {\\n // Copy msg.data. We take full control of memory in this inline assembly\\n // block because it will not return to Solidity code. We overwrite the\\n // Solidity scratch pad at memory position 0.\\n calldatacopy(0, 0, calldatasize())\\n\\n // Call the implementation.\\n // out and outsize are 0 because we don't know the size yet.\\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\\n\\n // Copy the returned data.\\n returndatacopy(0, 0, returndatasize())\\n\\n switch result\\n // delegatecall returns 0 on error.\\n case 0 {\\n revert(0, returndatasize())\\n }\\n default {\\n return(0, returndatasize())\\n }\\n }\\n }\\n\\n /**\\n * @dev This is a virtual function that should be overridden so it returns the address to which the fallback function\\n * and {_fallback} should delegate.\\n */\\n function _implementation() internal view virtual returns (address);\\n\\n /**\\n * @dev Delegates the current call to the address returned by `_implementation()`.\\n *\\n * This function does not return to its internal call site, it will return directly to the external caller.\\n */\\n function _fallback() internal virtual {\\n _beforeFallback();\\n _delegate(_implementation());\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\\n * function in the contract matches the call data.\\n */\\n fallback() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data\\n * is empty.\\n */\\n receive() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`\\n * call, or as part of the Solidity `fallback` or `receive` functions.\\n *\\n * If overridden should call `super._beforeFallback()`.\\n */\\n function _beforeFallback() internal virtual {}\\n}\\n\",\"keccak256\":\"0xc130fe33f1b2132158531a87734153293f6d07bc263ff4ac90e85da9c82c0e27\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/beacon/IBeacon.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\\n */\\ninterface IBeacon {\\n /**\\n * @dev Must return an address that can be used as a delegate call target.\\n *\\n * {BeaconProxy} will check that this address is a contract.\\n */\\n function implementation() external view returns (address);\\n}\\n\",\"keccak256\":\"0xd50a3421ac379ccb1be435fa646d66a65c986b4924f0849839f08692f39dde61\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\n *\\n * _Available since v4.8._\\n */\\n function verifyCallResultFromTarget(\\n address target,\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n if (success) {\\n if (returndata.length == 0) {\\n // only check isContract if the call was successful and the return data is empty\\n // otherwise we already know that it was a contract\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n }\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason or using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xf96f969e24029d43d0df89e59d365f277021dac62b48e1c1e3ebe0acdd7f1ca1\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/StorageSlot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/StorageSlot.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for reading and writing primitive types to specific storage slots.\\n *\\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\\n * This library helps with reading and writing to such slots without the need for inline assembly.\\n *\\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\\n *\\n * Example usage to set ERC1967 implementation slot:\\n * ```\\n * contract ERC1967 {\\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n *\\n * function _getImplementation() internal view returns (address) {\\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n * }\\n *\\n * function _setImplementation(address newImplementation) internal {\\n * require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n * }\\n * }\\n * ```\\n *\\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\\n */\\nlibrary StorageSlot {\\n struct AddressSlot {\\n address value;\\n }\\n\\n struct BooleanSlot {\\n bool value;\\n }\\n\\n struct Bytes32Slot {\\n bytes32 value;\\n }\\n\\n struct Uint256Slot {\\n uint256 value;\\n }\\n\\n /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\\n */\\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\\n */\\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\\n */\\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd5c50c54bf02740ebd122ff06832546cb5fa84486d52695a9ccfd11666e0c81d\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x60806040526040516107ad3803806107ad83398101604081905261002291610319565b61002e82826000610035565b5050610436565b61003e8361006b565b60008251118061004b5750805b156100665761006483836100ab60201b6100291760201c565b505b505050565b610074816100d7565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b60606100d08383604051806060016040528060278152602001610786602791396101a9565b9392505050565b6100ea8161022260201b6100551760201c565b6101515760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b60648201526084015b60405180910390fd5b806101887f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc60001b61023160201b6100711760201c565b80546001600160a01b0319166001600160a01b039290921691909117905550565b6060600080856001600160a01b0316856040516101c691906103e7565b600060405180830381855af49150503d8060008114610201576040519150601f19603f3d011682016040523d82523d6000602084013e610206565b606091505b50909250905061021886838387610234565b9695505050505050565b6001600160a01b03163b151590565b90565b606083156102a357825160000361029c576001600160a01b0385163b61029c5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610148565b50816102ad565b6102ad83836102b5565b949350505050565b8151156102c55781518083602001fd5b8060405162461bcd60e51b81526004016101489190610403565b634e487b7160e01b600052604160045260246000fd5b60005b838110156103105781810151838201526020016102f8565b50506000910152565b6000806040838503121561032c57600080fd5b82516001600160a01b038116811461034357600080fd5b60208401519092506001600160401b038082111561036057600080fd5b818501915085601f83011261037457600080fd5b815181811115610386576103866102df565b604051601f8201601f19908116603f011681019083821181831017156103ae576103ae6102df565b816040528281528860208487010111156103c757600080fd5b6103d88360208301602088016102f5565b80955050505050509250929050565b600082516103f98184602087016102f5565b9190910192915050565b60208152600082518060208401526104228160408501602087016102f5565b601f01601f19169190910160400192915050565b610341806104456000396000f3fe60806040523661001357610011610017565b005b6100115b610027610022610074565b6100b9565b565b606061004e83836040518060600160405280602781526020016102e5602791396100dd565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b90565b60006100b47f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5473ffffffffffffffffffffffffffffffffffffffff1690565b905090565b3660008037600080366000845af43d6000803e8080156100d8573d6000f35b3d6000fd5b60606000808573ffffffffffffffffffffffffffffffffffffffff16856040516101079190610277565b600060405180830381855af49150503d8060008114610142576040519150601f19603f3d011682016040523d82523d6000602084013e610147565b606091505b509150915061015886838387610162565b9695505050505050565b606083156101fd5782516000036101f65773ffffffffffffffffffffffffffffffffffffffff85163b6101f6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064015b60405180910390fd5b5081610207565b610207838361020f565b949350505050565b81511561021f5781518083602001fd5b806040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016101ed9190610293565b60005b8381101561026e578181015183820152602001610256565b50506000910152565b60008251610289818460208701610253565b9190910192915050565b60208152600082518060208401526102b2816040850160208701610253565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a26469706673582212208d6f628b23c1e021c9b2ae38fc6a126b22b03b9629f5dfe1de8fc7f044229aec64736f6c63430008110033416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564", + "deployedBytecode": "0x60806040523661001357610011610017565b005b6100115b610027610022610074565b6100b9565b565b606061004e83836040518060600160405280602781526020016102e5602791396100dd565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b90565b60006100b47f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5473ffffffffffffffffffffffffffffffffffffffff1690565b905090565b3660008037600080366000845af43d6000803e8080156100d8573d6000f35b3d6000fd5b60606000808573ffffffffffffffffffffffffffffffffffffffff16856040516101079190610277565b600060405180830381855af49150503d8060008114610142576040519150601f19603f3d011682016040523d82523d6000602084013e610147565b606091505b509150915061015886838387610162565b9695505050505050565b606083156101fd5782516000036101f65773ffffffffffffffffffffffffffffffffffffffff85163b6101f6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064015b60405180910390fd5b5081610207565b610207838361020f565b949350505050565b81511561021f5781518083602001fd5b806040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016101ed9190610293565b60005b8381101561026e578181015183820152602001610256565b50506000910152565b60008251610289818460208701610253565b9190910192915050565b60208152600082518060208401526102b2816040850160208701610253565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a26469706673582212208d6f628b23c1e021c9b2ae38fc6a126b22b03b9629f5dfe1de8fc7f044229aec64736f6c63430008110033", + "devdoc": { + "details": "This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an implementation address that can be changed. This address is stored in storage in the location specified by https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the implementation behind the proxy.", + "kind": "dev", + "methods": { + "constructor": { + "details": "Initializes the upgradeable proxy with an initial implementation specified by `_logic`. If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded function call, and allows initializing the storage of the proxy like a Solidity constructor." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/deployments/coredao/DistributionCreator_Implementation_7.json b/deployments/coredao/DistributionCreator_Implementation_7.json new file mode 100644 index 0000000..3ae04d6 --- /dev/null +++ b/deployments/coredao/DistributionCreator_Implementation_7.json @@ -0,0 +1,4743 @@ +{ + "address": "0x7Db28175B63f154587BbB1Cae62D39Ea80A23383", + "abi": [ + { + "inputs": [], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "InvalidLengths", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidParam", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidReward", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidSignature", + "type": "error" + }, + { + "inputs": [], + "name": "NotGovernorOrGuardian", + "type": "error" + }, + { + "inputs": [], + "name": "NotSigned", + "type": "error" + }, + { + "inputs": [], + "name": "ZeroAddress", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "previousAdmin", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "AdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "beacon", + "type": "address" + } + ], + "name": "BeaconUpgraded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "_distributor", + "type": "address" + } + ], + "name": "DistributorUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "userFeeRebate", + "type": "uint256" + } + ], + "name": "FeeRebateUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "_feeRecipient", + "type": "address" + } + ], + "name": "FeeRecipientUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "_fees", + "type": "uint256" + } + ], + "name": "FeesSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "bytes32", + "name": "_messageHash", + "type": "bytes32" + } + ], + "name": "MessageUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "components": [ + { + "internalType": "bytes32", + "name": "rewardId", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "uniV3Pool", + "type": "address" + }, + { + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address[]", + "name": "positionWrappers", + "type": "address[]" + }, + { + "internalType": "uint32[]", + "name": "wrapperTypes", + "type": "uint32[]" + }, + { + "internalType": "uint32", + "name": "propToken0", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propToken1", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propFees", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "epochStart", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "numEpoch", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "isOutOfRangeIncentivized", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "boostedReward", + "type": "uint32" + }, + { + "internalType": "address", + "name": "boostingAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "additionalData", + "type": "bytes" + } + ], + "indexed": false, + "internalType": "struct DistributionParameters", + "name": "distribution", + "type": "tuple" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "NewDistribution", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "RewardTokenMinimumAmountUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "toggleStatus", + "type": "uint256" + } + ], + "name": "TokenWhitelistToggled", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "bytes32", + "name": "messageHash", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + } + ], + "name": "UserSigned", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "toggleStatus", + "type": "uint256" + } + ], + "name": "UserSigningWhitelistToggled", + "type": "event" + }, + { + "inputs": [], + "name": "BASE_9", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "EPOCH_DURATION", + "outputs": [ + { + "internalType": "uint32", + "name": "", + "type": "uint32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "core", + "outputs": [ + { + "internalType": "contract ICore", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "bytes32", + "name": "rewardId", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "uniV3Pool", + "type": "address" + }, + { + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address[]", + "name": "positionWrappers", + "type": "address[]" + }, + { + "internalType": "uint32[]", + "name": "wrapperTypes", + "type": "uint32[]" + }, + { + "internalType": "uint32", + "name": "propToken0", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propToken1", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propFees", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "epochStart", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "numEpoch", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "isOutOfRangeIncentivized", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "boostedReward", + "type": "uint32" + }, + { + "internalType": "address", + "name": "boostingAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "additionalData", + "type": "bytes" + } + ], + "internalType": "struct DistributionParameters", + "name": "distribution", + "type": "tuple" + } + ], + "name": "createDistribution", + "outputs": [ + { + "internalType": "uint256", + "name": "distributionAmount", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "bytes32", + "name": "rewardId", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "uniV3Pool", + "type": "address" + }, + { + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address[]", + "name": "positionWrappers", + "type": "address[]" + }, + { + "internalType": "uint32[]", + "name": "wrapperTypes", + "type": "uint32[]" + }, + { + "internalType": "uint32", + "name": "propToken0", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propToken1", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propFees", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "epochStart", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "numEpoch", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "isOutOfRangeIncentivized", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "boostedReward", + "type": "uint32" + }, + { + "internalType": "address", + "name": "boostingAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "additionalData", + "type": "bytes" + } + ], + "internalType": "struct DistributionParameters[]", + "name": "distributions", + "type": "tuple[]" + } + ], + "name": "createDistributions", + "outputs": [ + { + "internalType": "uint256[]", + "name": "", + "type": "uint256[]" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "distributionList", + "outputs": [ + { + "internalType": "bytes32", + "name": "rewardId", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "uniV3Pool", + "type": "address" + }, + { + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "uint32", + "name": "propToken0", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propToken1", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propFees", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "epochStart", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "numEpoch", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "isOutOfRangeIncentivized", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "boostedReward", + "type": "uint32" + }, + { + "internalType": "address", + "name": "boostingAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "additionalData", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "distributor", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "feeRebate", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "feeRecipient", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "fees", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getActiveDistributions", + "outputs": [ + { + "components": [ + { + "components": [ + { + "internalType": "bytes32", + "name": "rewardId", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "uniV3Pool", + "type": "address" + }, + { + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address[]", + "name": "positionWrappers", + "type": "address[]" + }, + { + "internalType": "uint32[]", + "name": "wrapperTypes", + "type": "uint32[]" + }, + { + "internalType": "uint32", + "name": "propToken0", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propToken1", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propFees", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "epochStart", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "numEpoch", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "isOutOfRangeIncentivized", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "boostedReward", + "type": "uint32" + }, + { + "internalType": "address", + "name": "boostingAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "additionalData", + "type": "bytes" + } + ], + "internalType": "struct DistributionParameters", + "name": "base", + "type": "tuple" + }, + { + "internalType": "uint24", + "name": "poolFee", + "type": "uint24" + }, + { + "components": [ + { + "internalType": "address", + "name": "add", + "type": "address" + }, + { + "internalType": "uint8", + "name": "decimals", + "type": "uint8" + }, + { + "internalType": "string", + "name": "symbol", + "type": "string" + }, + { + "internalType": "uint256", + "name": "poolBalance", + "type": "uint256" + } + ], + "internalType": "struct UniswapTokenData", + "name": "token0", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "address", + "name": "add", + "type": "address" + }, + { + "internalType": "uint8", + "name": "decimals", + "type": "uint8" + }, + { + "internalType": "string", + "name": "symbol", + "type": "string" + }, + { + "internalType": "uint256", + "name": "poolBalance", + "type": "uint256" + } + ], + "internalType": "struct UniswapTokenData", + "name": "token1", + "type": "tuple" + }, + { + "internalType": "string", + "name": "rewardTokenSymbol", + "type": "string" + }, + { + "internalType": "uint8", + "name": "rewardTokenDecimals", + "type": "uint8" + } + ], + "internalType": "struct ExtensiveDistributionParameters[]", + "name": "searchDistributions", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint32", + "name": "skip", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "first", + "type": "uint32" + } + ], + "name": "getActiveDistributions", + "outputs": [ + { + "components": [ + { + "components": [ + { + "internalType": "bytes32", + "name": "rewardId", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "uniV3Pool", + "type": "address" + }, + { + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address[]", + "name": "positionWrappers", + "type": "address[]" + }, + { + "internalType": "uint32[]", + "name": "wrapperTypes", + "type": "uint32[]" + }, + { + "internalType": "uint32", + "name": "propToken0", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propToken1", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propFees", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "epochStart", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "numEpoch", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "isOutOfRangeIncentivized", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "boostedReward", + "type": "uint32" + }, + { + "internalType": "address", + "name": "boostingAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "additionalData", + "type": "bytes" + } + ], + "internalType": "struct DistributionParameters", + "name": "base", + "type": "tuple" + }, + { + "internalType": "uint24", + "name": "poolFee", + "type": "uint24" + }, + { + "components": [ + { + "internalType": "address", + "name": "add", + "type": "address" + }, + { + "internalType": "uint8", + "name": "decimals", + "type": "uint8" + }, + { + "internalType": "string", + "name": "symbol", + "type": "string" + }, + { + "internalType": "uint256", + "name": "poolBalance", + "type": "uint256" + } + ], + "internalType": "struct UniswapTokenData", + "name": "token0", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "address", + "name": "add", + "type": "address" + }, + { + "internalType": "uint8", + "name": "decimals", + "type": "uint8" + }, + { + "internalType": "string", + "name": "symbol", + "type": "string" + }, + { + "internalType": "uint256", + "name": "poolBalance", + "type": "uint256" + } + ], + "internalType": "struct UniswapTokenData", + "name": "token1", + "type": "tuple" + }, + { + "internalType": "string", + "name": "rewardTokenSymbol", + "type": "string" + }, + { + "internalType": "uint8", + "name": "rewardTokenDecimals", + "type": "uint8" + } + ], + "internalType": "struct ExtensiveDistributionParameters[]", + "name": "searchDistributions", + "type": "tuple[]" + }, + { + "internalType": "uint256", + "name": "lastIndexDistribution", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "uniV3Pool", + "type": "address" + } + ], + "name": "getActivePoolDistributions", + "outputs": [ + { + "components": [ + { + "components": [ + { + "internalType": "bytes32", + "name": "rewardId", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "uniV3Pool", + "type": "address" + }, + { + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address[]", + "name": "positionWrappers", + "type": "address[]" + }, + { + "internalType": "uint32[]", + "name": "wrapperTypes", + "type": "uint32[]" + }, + { + "internalType": "uint32", + "name": "propToken0", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propToken1", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propFees", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "epochStart", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "numEpoch", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "isOutOfRangeIncentivized", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "boostedReward", + "type": "uint32" + }, + { + "internalType": "address", + "name": "boostingAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "additionalData", + "type": "bytes" + } + ], + "internalType": "struct DistributionParameters", + "name": "base", + "type": "tuple" + }, + { + "internalType": "uint24", + "name": "poolFee", + "type": "uint24" + }, + { + "components": [ + { + "internalType": "address", + "name": "add", + "type": "address" + }, + { + "internalType": "uint8", + "name": "decimals", + "type": "uint8" + }, + { + "internalType": "string", + "name": "symbol", + "type": "string" + }, + { + "internalType": "uint256", + "name": "poolBalance", + "type": "uint256" + } + ], + "internalType": "struct UniswapTokenData", + "name": "token0", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "address", + "name": "add", + "type": "address" + }, + { + "internalType": "uint8", + "name": "decimals", + "type": "uint8" + }, + { + "internalType": "string", + "name": "symbol", + "type": "string" + }, + { + "internalType": "uint256", + "name": "poolBalance", + "type": "uint256" + } + ], + "internalType": "struct UniswapTokenData", + "name": "token1", + "type": "tuple" + }, + { + "internalType": "string", + "name": "rewardTokenSymbol", + "type": "string" + }, + { + "internalType": "uint8", + "name": "rewardTokenDecimals", + "type": "uint8" + } + ], + "internalType": "struct ExtensiveDistributionParameters[]", + "name": "searchDistributions", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "uniV3Pool", + "type": "address" + }, + { + "internalType": "uint32", + "name": "skip", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "first", + "type": "uint32" + } + ], + "name": "getActivePoolDistributions", + "outputs": [ + { + "components": [ + { + "components": [ + { + "internalType": "bytes32", + "name": "rewardId", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "uniV3Pool", + "type": "address" + }, + { + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address[]", + "name": "positionWrappers", + "type": "address[]" + }, + { + "internalType": "uint32[]", + "name": "wrapperTypes", + "type": "uint32[]" + }, + { + "internalType": "uint32", + "name": "propToken0", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propToken1", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propFees", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "epochStart", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "numEpoch", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "isOutOfRangeIncentivized", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "boostedReward", + "type": "uint32" + }, + { + "internalType": "address", + "name": "boostingAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "additionalData", + "type": "bytes" + } + ], + "internalType": "struct DistributionParameters", + "name": "base", + "type": "tuple" + }, + { + "internalType": "uint24", + "name": "poolFee", + "type": "uint24" + }, + { + "components": [ + { + "internalType": "address", + "name": "add", + "type": "address" + }, + { + "internalType": "uint8", + "name": "decimals", + "type": "uint8" + }, + { + "internalType": "string", + "name": "symbol", + "type": "string" + }, + { + "internalType": "uint256", + "name": "poolBalance", + "type": "uint256" + } + ], + "internalType": "struct UniswapTokenData", + "name": "token0", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "address", + "name": "add", + "type": "address" + }, + { + "internalType": "uint8", + "name": "decimals", + "type": "uint8" + }, + { + "internalType": "string", + "name": "symbol", + "type": "string" + }, + { + "internalType": "uint256", + "name": "poolBalance", + "type": "uint256" + } + ], + "internalType": "struct UniswapTokenData", + "name": "token1", + "type": "tuple" + }, + { + "internalType": "string", + "name": "rewardTokenSymbol", + "type": "string" + }, + { + "internalType": "uint8", + "name": "rewardTokenDecimals", + "type": "uint8" + } + ], + "internalType": "struct ExtensiveDistributionParameters[]", + "name": "", + "type": "tuple[]" + }, + { + "internalType": "uint256", + "name": "lastIndexDistribution", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getAllDistributions", + "outputs": [ + { + "components": [ + { + "internalType": "bytes32", + "name": "rewardId", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "uniV3Pool", + "type": "address" + }, + { + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address[]", + "name": "positionWrappers", + "type": "address[]" + }, + { + "internalType": "uint32[]", + "name": "wrapperTypes", + "type": "uint32[]" + }, + { + "internalType": "uint32", + "name": "propToken0", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propToken1", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propFees", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "epochStart", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "numEpoch", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "isOutOfRangeIncentivized", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "boostedReward", + "type": "uint32" + }, + { + "internalType": "address", + "name": "boostingAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "additionalData", + "type": "bytes" + } + ], + "internalType": "struct DistributionParameters[]", + "name": "", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint32", + "name": "epochStart", + "type": "uint32" + } + ], + "name": "getDistributionsAfterEpoch", + "outputs": [ + { + "components": [ + { + "components": [ + { + "internalType": "bytes32", + "name": "rewardId", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "uniV3Pool", + "type": "address" + }, + { + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address[]", + "name": "positionWrappers", + "type": "address[]" + }, + { + "internalType": "uint32[]", + "name": "wrapperTypes", + "type": "uint32[]" + }, + { + "internalType": "uint32", + "name": "propToken0", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propToken1", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propFees", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "epochStart", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "numEpoch", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "isOutOfRangeIncentivized", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "boostedReward", + "type": "uint32" + }, + { + "internalType": "address", + "name": "boostingAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "additionalData", + "type": "bytes" + } + ], + "internalType": "struct DistributionParameters", + "name": "base", + "type": "tuple" + }, + { + "internalType": "uint24", + "name": "poolFee", + "type": "uint24" + }, + { + "components": [ + { + "internalType": "address", + "name": "add", + "type": "address" + }, + { + "internalType": "uint8", + "name": "decimals", + "type": "uint8" + }, + { + "internalType": "string", + "name": "symbol", + "type": "string" + }, + { + "internalType": "uint256", + "name": "poolBalance", + "type": "uint256" + } + ], + "internalType": "struct UniswapTokenData", + "name": "token0", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "address", + "name": "add", + "type": "address" + }, + { + "internalType": "uint8", + "name": "decimals", + "type": "uint8" + }, + { + "internalType": "string", + "name": "symbol", + "type": "string" + }, + { + "internalType": "uint256", + "name": "poolBalance", + "type": "uint256" + } + ], + "internalType": "struct UniswapTokenData", + "name": "token1", + "type": "tuple" + }, + { + "internalType": "string", + "name": "rewardTokenSymbol", + "type": "string" + }, + { + "internalType": "uint8", + "name": "rewardTokenDecimals", + "type": "uint8" + } + ], + "internalType": "struct ExtensiveDistributionParameters[]", + "name": "searchDistributions", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint32", + "name": "epochStart", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "skip", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "first", + "type": "uint32" + } + ], + "name": "getDistributionsAfterEpoch", + "outputs": [ + { + "components": [ + { + "components": [ + { + "internalType": "bytes32", + "name": "rewardId", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "uniV3Pool", + "type": "address" + }, + { + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address[]", + "name": "positionWrappers", + "type": "address[]" + }, + { + "internalType": "uint32[]", + "name": "wrapperTypes", + "type": "uint32[]" + }, + { + "internalType": "uint32", + "name": "propToken0", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propToken1", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propFees", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "epochStart", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "numEpoch", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "isOutOfRangeIncentivized", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "boostedReward", + "type": "uint32" + }, + { + "internalType": "address", + "name": "boostingAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "additionalData", + "type": "bytes" + } + ], + "internalType": "struct DistributionParameters", + "name": "base", + "type": "tuple" + }, + { + "internalType": "uint24", + "name": "poolFee", + "type": "uint24" + }, + { + "components": [ + { + "internalType": "address", + "name": "add", + "type": "address" + }, + { + "internalType": "uint8", + "name": "decimals", + "type": "uint8" + }, + { + "internalType": "string", + "name": "symbol", + "type": "string" + }, + { + "internalType": "uint256", + "name": "poolBalance", + "type": "uint256" + } + ], + "internalType": "struct UniswapTokenData", + "name": "token0", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "address", + "name": "add", + "type": "address" + }, + { + "internalType": "uint8", + "name": "decimals", + "type": "uint8" + }, + { + "internalType": "string", + "name": "symbol", + "type": "string" + }, + { + "internalType": "uint256", + "name": "poolBalance", + "type": "uint256" + } + ], + "internalType": "struct UniswapTokenData", + "name": "token1", + "type": "tuple" + }, + { + "internalType": "string", + "name": "rewardTokenSymbol", + "type": "string" + }, + { + "internalType": "uint8", + "name": "rewardTokenDecimals", + "type": "uint8" + } + ], + "internalType": "struct ExtensiveDistributionParameters[]", + "name": "", + "type": "tuple[]" + }, + { + "internalType": "uint256", + "name": "lastIndexDistribution", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint32", + "name": "epochStart", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "epochEnd", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "skip", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "first", + "type": "uint32" + } + ], + "name": "getDistributionsBetweenEpochs", + "outputs": [ + { + "components": [ + { + "components": [ + { + "internalType": "bytes32", + "name": "rewardId", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "uniV3Pool", + "type": "address" + }, + { + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address[]", + "name": "positionWrappers", + "type": "address[]" + }, + { + "internalType": "uint32[]", + "name": "wrapperTypes", + "type": "uint32[]" + }, + { + "internalType": "uint32", + "name": "propToken0", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propToken1", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propFees", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "epochStart", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "numEpoch", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "isOutOfRangeIncentivized", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "boostedReward", + "type": "uint32" + }, + { + "internalType": "address", + "name": "boostingAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "additionalData", + "type": "bytes" + } + ], + "internalType": "struct DistributionParameters", + "name": "base", + "type": "tuple" + }, + { + "internalType": "uint24", + "name": "poolFee", + "type": "uint24" + }, + { + "components": [ + { + "internalType": "address", + "name": "add", + "type": "address" + }, + { + "internalType": "uint8", + "name": "decimals", + "type": "uint8" + }, + { + "internalType": "string", + "name": "symbol", + "type": "string" + }, + { + "internalType": "uint256", + "name": "poolBalance", + "type": "uint256" + } + ], + "internalType": "struct UniswapTokenData", + "name": "token0", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "address", + "name": "add", + "type": "address" + }, + { + "internalType": "uint8", + "name": "decimals", + "type": "uint8" + }, + { + "internalType": "string", + "name": "symbol", + "type": "string" + }, + { + "internalType": "uint256", + "name": "poolBalance", + "type": "uint256" + } + ], + "internalType": "struct UniswapTokenData", + "name": "token1", + "type": "tuple" + }, + { + "internalType": "string", + "name": "rewardTokenSymbol", + "type": "string" + }, + { + "internalType": "uint8", + "name": "rewardTokenDecimals", + "type": "uint8" + } + ], + "internalType": "struct ExtensiveDistributionParameters[]", + "name": "", + "type": "tuple[]" + }, + { + "internalType": "uint256", + "name": "lastIndexDistribution", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint32", + "name": "epochStart", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "epochEnd", + "type": "uint32" + } + ], + "name": "getDistributionsBetweenEpochs", + "outputs": [ + { + "components": [ + { + "components": [ + { + "internalType": "bytes32", + "name": "rewardId", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "uniV3Pool", + "type": "address" + }, + { + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address[]", + "name": "positionWrappers", + "type": "address[]" + }, + { + "internalType": "uint32[]", + "name": "wrapperTypes", + "type": "uint32[]" + }, + { + "internalType": "uint32", + "name": "propToken0", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propToken1", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propFees", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "epochStart", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "numEpoch", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "isOutOfRangeIncentivized", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "boostedReward", + "type": "uint32" + }, + { + "internalType": "address", + "name": "boostingAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "additionalData", + "type": "bytes" + } + ], + "internalType": "struct DistributionParameters", + "name": "base", + "type": "tuple" + }, + { + "internalType": "uint24", + "name": "poolFee", + "type": "uint24" + }, + { + "components": [ + { + "internalType": "address", + "name": "add", + "type": "address" + }, + { + "internalType": "uint8", + "name": "decimals", + "type": "uint8" + }, + { + "internalType": "string", + "name": "symbol", + "type": "string" + }, + { + "internalType": "uint256", + "name": "poolBalance", + "type": "uint256" + } + ], + "internalType": "struct UniswapTokenData", + "name": "token0", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "address", + "name": "add", + "type": "address" + }, + { + "internalType": "uint8", + "name": "decimals", + "type": "uint8" + }, + { + "internalType": "string", + "name": "symbol", + "type": "string" + }, + { + "internalType": "uint256", + "name": "poolBalance", + "type": "uint256" + } + ], + "internalType": "struct UniswapTokenData", + "name": "token1", + "type": "tuple" + }, + { + "internalType": "string", + "name": "rewardTokenSymbol", + "type": "string" + }, + { + "internalType": "uint8", + "name": "rewardTokenDecimals", + "type": "uint8" + } + ], + "internalType": "struct ExtensiveDistributionParameters[]", + "name": "searchDistributions", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint32", + "name": "epoch", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "skip", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "first", + "type": "uint32" + } + ], + "name": "getDistributionsForEpoch", + "outputs": [ + { + "components": [ + { + "components": [ + { + "internalType": "bytes32", + "name": "rewardId", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "uniV3Pool", + "type": "address" + }, + { + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address[]", + "name": "positionWrappers", + "type": "address[]" + }, + { + "internalType": "uint32[]", + "name": "wrapperTypes", + "type": "uint32[]" + }, + { + "internalType": "uint32", + "name": "propToken0", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propToken1", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propFees", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "epochStart", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "numEpoch", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "isOutOfRangeIncentivized", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "boostedReward", + "type": "uint32" + }, + { + "internalType": "address", + "name": "boostingAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "additionalData", + "type": "bytes" + } + ], + "internalType": "struct DistributionParameters", + "name": "base", + "type": "tuple" + }, + { + "internalType": "uint24", + "name": "poolFee", + "type": "uint24" + }, + { + "components": [ + { + "internalType": "address", + "name": "add", + "type": "address" + }, + { + "internalType": "uint8", + "name": "decimals", + "type": "uint8" + }, + { + "internalType": "string", + "name": "symbol", + "type": "string" + }, + { + "internalType": "uint256", + "name": "poolBalance", + "type": "uint256" + } + ], + "internalType": "struct UniswapTokenData", + "name": "token0", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "address", + "name": "add", + "type": "address" + }, + { + "internalType": "uint8", + "name": "decimals", + "type": "uint8" + }, + { + "internalType": "string", + "name": "symbol", + "type": "string" + }, + { + "internalType": "uint256", + "name": "poolBalance", + "type": "uint256" + } + ], + "internalType": "struct UniswapTokenData", + "name": "token1", + "type": "tuple" + }, + { + "internalType": "string", + "name": "rewardTokenSymbol", + "type": "string" + }, + { + "internalType": "uint8", + "name": "rewardTokenDecimals", + "type": "uint8" + } + ], + "internalType": "struct ExtensiveDistributionParameters[]", + "name": "", + "type": "tuple[]" + }, + { + "internalType": "uint256", + "name": "lastIndexDistribution", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint32", + "name": "epoch", + "type": "uint32" + } + ], + "name": "getDistributionsForEpoch", + "outputs": [ + { + "components": [ + { + "components": [ + { + "internalType": "bytes32", + "name": "rewardId", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "uniV3Pool", + "type": "address" + }, + { + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address[]", + "name": "positionWrappers", + "type": "address[]" + }, + { + "internalType": "uint32[]", + "name": "wrapperTypes", + "type": "uint32[]" + }, + { + "internalType": "uint32", + "name": "propToken0", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propToken1", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propFees", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "epochStart", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "numEpoch", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "isOutOfRangeIncentivized", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "boostedReward", + "type": "uint32" + }, + { + "internalType": "address", + "name": "boostingAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "additionalData", + "type": "bytes" + } + ], + "internalType": "struct DistributionParameters", + "name": "base", + "type": "tuple" + }, + { + "internalType": "uint24", + "name": "poolFee", + "type": "uint24" + }, + { + "components": [ + { + "internalType": "address", + "name": "add", + "type": "address" + }, + { + "internalType": "uint8", + "name": "decimals", + "type": "uint8" + }, + { + "internalType": "string", + "name": "symbol", + "type": "string" + }, + { + "internalType": "uint256", + "name": "poolBalance", + "type": "uint256" + } + ], + "internalType": "struct UniswapTokenData", + "name": "token0", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "address", + "name": "add", + "type": "address" + }, + { + "internalType": "uint8", + "name": "decimals", + "type": "uint8" + }, + { + "internalType": "string", + "name": "symbol", + "type": "string" + }, + { + "internalType": "uint256", + "name": "poolBalance", + "type": "uint256" + } + ], + "internalType": "struct UniswapTokenData", + "name": "token1", + "type": "tuple" + }, + { + "internalType": "string", + "name": "rewardTokenSymbol", + "type": "string" + }, + { + "internalType": "uint8", + "name": "rewardTokenDecimals", + "type": "uint8" + } + ], + "internalType": "struct ExtensiveDistributionParameters[]", + "name": "searchDistributions", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "bytes32", + "name": "rewardId", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "uniV3Pool", + "type": "address" + }, + { + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address[]", + "name": "positionWrappers", + "type": "address[]" + }, + { + "internalType": "uint32[]", + "name": "wrapperTypes", + "type": "uint32[]" + }, + { + "internalType": "uint32", + "name": "propToken0", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propToken1", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propFees", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "epochStart", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "numEpoch", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "isOutOfRangeIncentivized", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "boostedReward", + "type": "uint32" + }, + { + "internalType": "address", + "name": "boostingAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "additionalData", + "type": "bytes" + } + ], + "internalType": "struct DistributionParameters", + "name": "distribution", + "type": "tuple" + } + ], + "name": "getExtensiveDistributionParameters", + "outputs": [ + { + "components": [ + { + "components": [ + { + "internalType": "bytes32", + "name": "rewardId", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "uniV3Pool", + "type": "address" + }, + { + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address[]", + "name": "positionWrappers", + "type": "address[]" + }, + { + "internalType": "uint32[]", + "name": "wrapperTypes", + "type": "uint32[]" + }, + { + "internalType": "uint32", + "name": "propToken0", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propToken1", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propFees", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "epochStart", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "numEpoch", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "isOutOfRangeIncentivized", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "boostedReward", + "type": "uint32" + }, + { + "internalType": "address", + "name": "boostingAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "additionalData", + "type": "bytes" + } + ], + "internalType": "struct DistributionParameters", + "name": "base", + "type": "tuple" + }, + { + "internalType": "uint24", + "name": "poolFee", + "type": "uint24" + }, + { + "components": [ + { + "internalType": "address", + "name": "add", + "type": "address" + }, + { + "internalType": "uint8", + "name": "decimals", + "type": "uint8" + }, + { + "internalType": "string", + "name": "symbol", + "type": "string" + }, + { + "internalType": "uint256", + "name": "poolBalance", + "type": "uint256" + } + ], + "internalType": "struct UniswapTokenData", + "name": "token0", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "address", + "name": "add", + "type": "address" + }, + { + "internalType": "uint8", + "name": "decimals", + "type": "uint8" + }, + { + "internalType": "string", + "name": "symbol", + "type": "string" + }, + { + "internalType": "uint256", + "name": "poolBalance", + "type": "uint256" + } + ], + "internalType": "struct UniswapTokenData", + "name": "token1", + "type": "tuple" + }, + { + "internalType": "string", + "name": "rewardTokenSymbol", + "type": "string" + }, + { + "internalType": "uint8", + "name": "rewardTokenDecimals", + "type": "uint8" + } + ], + "internalType": "struct ExtensiveDistributionParameters", + "name": "extensiveParams", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "uniV3Pool", + "type": "address" + }, + { + "internalType": "uint32", + "name": "epochStart", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "skip", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "first", + "type": "uint32" + } + ], + "name": "getPoolDistributionsAfterEpoch", + "outputs": [ + { + "components": [ + { + "components": [ + { + "internalType": "bytes32", + "name": "rewardId", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "uniV3Pool", + "type": "address" + }, + { + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address[]", + "name": "positionWrappers", + "type": "address[]" + }, + { + "internalType": "uint32[]", + "name": "wrapperTypes", + "type": "uint32[]" + }, + { + "internalType": "uint32", + "name": "propToken0", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propToken1", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propFees", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "epochStart", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "numEpoch", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "isOutOfRangeIncentivized", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "boostedReward", + "type": "uint32" + }, + { + "internalType": "address", + "name": "boostingAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "additionalData", + "type": "bytes" + } + ], + "internalType": "struct DistributionParameters", + "name": "base", + "type": "tuple" + }, + { + "internalType": "uint24", + "name": "poolFee", + "type": "uint24" + }, + { + "components": [ + { + "internalType": "address", + "name": "add", + "type": "address" + }, + { + "internalType": "uint8", + "name": "decimals", + "type": "uint8" + }, + { + "internalType": "string", + "name": "symbol", + "type": "string" + }, + { + "internalType": "uint256", + "name": "poolBalance", + "type": "uint256" + } + ], + "internalType": "struct UniswapTokenData", + "name": "token0", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "address", + "name": "add", + "type": "address" + }, + { + "internalType": "uint8", + "name": "decimals", + "type": "uint8" + }, + { + "internalType": "string", + "name": "symbol", + "type": "string" + }, + { + "internalType": "uint256", + "name": "poolBalance", + "type": "uint256" + } + ], + "internalType": "struct UniswapTokenData", + "name": "token1", + "type": "tuple" + }, + { + "internalType": "string", + "name": "rewardTokenSymbol", + "type": "string" + }, + { + "internalType": "uint8", + "name": "rewardTokenDecimals", + "type": "uint8" + } + ], + "internalType": "struct ExtensiveDistributionParameters[]", + "name": "", + "type": "tuple[]" + }, + { + "internalType": "uint256", + "name": "lastIndexDistribution", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "uniV3Pool", + "type": "address" + }, + { + "internalType": "uint32", + "name": "epochStart", + "type": "uint32" + } + ], + "name": "getPoolDistributionsAfterEpoch", + "outputs": [ + { + "components": [ + { + "components": [ + { + "internalType": "bytes32", + "name": "rewardId", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "uniV3Pool", + "type": "address" + }, + { + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address[]", + "name": "positionWrappers", + "type": "address[]" + }, + { + "internalType": "uint32[]", + "name": "wrapperTypes", + "type": "uint32[]" + }, + { + "internalType": "uint32", + "name": "propToken0", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propToken1", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propFees", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "epochStart", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "numEpoch", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "isOutOfRangeIncentivized", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "boostedReward", + "type": "uint32" + }, + { + "internalType": "address", + "name": "boostingAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "additionalData", + "type": "bytes" + } + ], + "internalType": "struct DistributionParameters", + "name": "base", + "type": "tuple" + }, + { + "internalType": "uint24", + "name": "poolFee", + "type": "uint24" + }, + { + "components": [ + { + "internalType": "address", + "name": "add", + "type": "address" + }, + { + "internalType": "uint8", + "name": "decimals", + "type": "uint8" + }, + { + "internalType": "string", + "name": "symbol", + "type": "string" + }, + { + "internalType": "uint256", + "name": "poolBalance", + "type": "uint256" + } + ], + "internalType": "struct UniswapTokenData", + "name": "token0", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "address", + "name": "add", + "type": "address" + }, + { + "internalType": "uint8", + "name": "decimals", + "type": "uint8" + }, + { + "internalType": "string", + "name": "symbol", + "type": "string" + }, + { + "internalType": "uint256", + "name": "poolBalance", + "type": "uint256" + } + ], + "internalType": "struct UniswapTokenData", + "name": "token1", + "type": "tuple" + }, + { + "internalType": "string", + "name": "rewardTokenSymbol", + "type": "string" + }, + { + "internalType": "uint8", + "name": "rewardTokenDecimals", + "type": "uint8" + } + ], + "internalType": "struct ExtensiveDistributionParameters[]", + "name": "searchDistributions", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "uniV3Pool", + "type": "address" + }, + { + "internalType": "uint32", + "name": "epochStart", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "epochEnd", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "skip", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "first", + "type": "uint32" + } + ], + "name": "getPoolDistributionsBetweenEpochs", + "outputs": [ + { + "components": [ + { + "components": [ + { + "internalType": "bytes32", + "name": "rewardId", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "uniV3Pool", + "type": "address" + }, + { + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address[]", + "name": "positionWrappers", + "type": "address[]" + }, + { + "internalType": "uint32[]", + "name": "wrapperTypes", + "type": "uint32[]" + }, + { + "internalType": "uint32", + "name": "propToken0", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propToken1", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propFees", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "epochStart", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "numEpoch", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "isOutOfRangeIncentivized", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "boostedReward", + "type": "uint32" + }, + { + "internalType": "address", + "name": "boostingAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "additionalData", + "type": "bytes" + } + ], + "internalType": "struct DistributionParameters", + "name": "base", + "type": "tuple" + }, + { + "internalType": "uint24", + "name": "poolFee", + "type": "uint24" + }, + { + "components": [ + { + "internalType": "address", + "name": "add", + "type": "address" + }, + { + "internalType": "uint8", + "name": "decimals", + "type": "uint8" + }, + { + "internalType": "string", + "name": "symbol", + "type": "string" + }, + { + "internalType": "uint256", + "name": "poolBalance", + "type": "uint256" + } + ], + "internalType": "struct UniswapTokenData", + "name": "token0", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "address", + "name": "add", + "type": "address" + }, + { + "internalType": "uint8", + "name": "decimals", + "type": "uint8" + }, + { + "internalType": "string", + "name": "symbol", + "type": "string" + }, + { + "internalType": "uint256", + "name": "poolBalance", + "type": "uint256" + } + ], + "internalType": "struct UniswapTokenData", + "name": "token1", + "type": "tuple" + }, + { + "internalType": "string", + "name": "rewardTokenSymbol", + "type": "string" + }, + { + "internalType": "uint8", + "name": "rewardTokenDecimals", + "type": "uint8" + } + ], + "internalType": "struct ExtensiveDistributionParameters[]", + "name": "", + "type": "tuple[]" + }, + { + "internalType": "uint256", + "name": "lastIndexDistribution", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "uniV3Pool", + "type": "address" + }, + { + "internalType": "uint32", + "name": "epochStart", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "epochEnd", + "type": "uint32" + } + ], + "name": "getPoolDistributionsBetweenEpochs", + "outputs": [ + { + "components": [ + { + "components": [ + { + "internalType": "bytes32", + "name": "rewardId", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "uniV3Pool", + "type": "address" + }, + { + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address[]", + "name": "positionWrappers", + "type": "address[]" + }, + { + "internalType": "uint32[]", + "name": "wrapperTypes", + "type": "uint32[]" + }, + { + "internalType": "uint32", + "name": "propToken0", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propToken1", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propFees", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "epochStart", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "numEpoch", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "isOutOfRangeIncentivized", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "boostedReward", + "type": "uint32" + }, + { + "internalType": "address", + "name": "boostingAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "additionalData", + "type": "bytes" + } + ], + "internalType": "struct DistributionParameters", + "name": "base", + "type": "tuple" + }, + { + "internalType": "uint24", + "name": "poolFee", + "type": "uint24" + }, + { + "components": [ + { + "internalType": "address", + "name": "add", + "type": "address" + }, + { + "internalType": "uint8", + "name": "decimals", + "type": "uint8" + }, + { + "internalType": "string", + "name": "symbol", + "type": "string" + }, + { + "internalType": "uint256", + "name": "poolBalance", + "type": "uint256" + } + ], + "internalType": "struct UniswapTokenData", + "name": "token0", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "address", + "name": "add", + "type": "address" + }, + { + "internalType": "uint8", + "name": "decimals", + "type": "uint8" + }, + { + "internalType": "string", + "name": "symbol", + "type": "string" + }, + { + "internalType": "uint256", + "name": "poolBalance", + "type": "uint256" + } + ], + "internalType": "struct UniswapTokenData", + "name": "token1", + "type": "tuple" + }, + { + "internalType": "string", + "name": "rewardTokenSymbol", + "type": "string" + }, + { + "internalType": "uint8", + "name": "rewardTokenDecimals", + "type": "uint8" + } + ], + "internalType": "struct ExtensiveDistributionParameters[]", + "name": "searchDistributions", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "uniV3Pool", + "type": "address" + }, + { + "internalType": "uint32", + "name": "epoch", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "skip", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "first", + "type": "uint32" + } + ], + "name": "getPoolDistributionsForEpoch", + "outputs": [ + { + "components": [ + { + "components": [ + { + "internalType": "bytes32", + "name": "rewardId", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "uniV3Pool", + "type": "address" + }, + { + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address[]", + "name": "positionWrappers", + "type": "address[]" + }, + { + "internalType": "uint32[]", + "name": "wrapperTypes", + "type": "uint32[]" + }, + { + "internalType": "uint32", + "name": "propToken0", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propToken1", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propFees", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "epochStart", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "numEpoch", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "isOutOfRangeIncentivized", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "boostedReward", + "type": "uint32" + }, + { + "internalType": "address", + "name": "boostingAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "additionalData", + "type": "bytes" + } + ], + "internalType": "struct DistributionParameters", + "name": "base", + "type": "tuple" + }, + { + "internalType": "uint24", + "name": "poolFee", + "type": "uint24" + }, + { + "components": [ + { + "internalType": "address", + "name": "add", + "type": "address" + }, + { + "internalType": "uint8", + "name": "decimals", + "type": "uint8" + }, + { + "internalType": "string", + "name": "symbol", + "type": "string" + }, + { + "internalType": "uint256", + "name": "poolBalance", + "type": "uint256" + } + ], + "internalType": "struct UniswapTokenData", + "name": "token0", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "address", + "name": "add", + "type": "address" + }, + { + "internalType": "uint8", + "name": "decimals", + "type": "uint8" + }, + { + "internalType": "string", + "name": "symbol", + "type": "string" + }, + { + "internalType": "uint256", + "name": "poolBalance", + "type": "uint256" + } + ], + "internalType": "struct UniswapTokenData", + "name": "token1", + "type": "tuple" + }, + { + "internalType": "string", + "name": "rewardTokenSymbol", + "type": "string" + }, + { + "internalType": "uint8", + "name": "rewardTokenDecimals", + "type": "uint8" + } + ], + "internalType": "struct ExtensiveDistributionParameters[]", + "name": "", + "type": "tuple[]" + }, + { + "internalType": "uint256", + "name": "lastIndexDistribution", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "uniV3Pool", + "type": "address" + }, + { + "internalType": "uint32", + "name": "epoch", + "type": "uint32" + } + ], + "name": "getPoolDistributionsForEpoch", + "outputs": [ + { + "components": [ + { + "components": [ + { + "internalType": "bytes32", + "name": "rewardId", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "uniV3Pool", + "type": "address" + }, + { + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address[]", + "name": "positionWrappers", + "type": "address[]" + }, + { + "internalType": "uint32[]", + "name": "wrapperTypes", + "type": "uint32[]" + }, + { + "internalType": "uint32", + "name": "propToken0", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propToken1", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propFees", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "epochStart", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "numEpoch", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "isOutOfRangeIncentivized", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "boostedReward", + "type": "uint32" + }, + { + "internalType": "address", + "name": "boostingAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "additionalData", + "type": "bytes" + } + ], + "internalType": "struct DistributionParameters", + "name": "base", + "type": "tuple" + }, + { + "internalType": "uint24", + "name": "poolFee", + "type": "uint24" + }, + { + "components": [ + { + "internalType": "address", + "name": "add", + "type": "address" + }, + { + "internalType": "uint8", + "name": "decimals", + "type": "uint8" + }, + { + "internalType": "string", + "name": "symbol", + "type": "string" + }, + { + "internalType": "uint256", + "name": "poolBalance", + "type": "uint256" + } + ], + "internalType": "struct UniswapTokenData", + "name": "token0", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "address", + "name": "add", + "type": "address" + }, + { + "internalType": "uint8", + "name": "decimals", + "type": "uint8" + }, + { + "internalType": "string", + "name": "symbol", + "type": "string" + }, + { + "internalType": "uint256", + "name": "poolBalance", + "type": "uint256" + } + ], + "internalType": "struct UniswapTokenData", + "name": "token1", + "type": "tuple" + }, + { + "internalType": "string", + "name": "rewardTokenSymbol", + "type": "string" + }, + { + "internalType": "uint8", + "name": "rewardTokenDecimals", + "type": "uint8" + } + ], + "internalType": "struct ExtensiveDistributionParameters[]", + "name": "searchDistributions", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getValidRewardTokens", + "outputs": [ + { + "components": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "minimumAmountPerEpoch", + "type": "uint256" + } + ], + "internalType": "struct RewardTokenAmounts[]", + "name": "", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract ICore", + "name": "_core", + "type": "address" + }, + { + "internalType": "address", + "name": "_distributor", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_fees", + "type": "uint256" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "isWhitelistedToken", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "message", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "messageHash", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "nonces", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "proxiableUUID", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IERC20[]", + "name": "tokens", + "type": "address[]" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + } + ], + "name": "recoverFees", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "rewardTokenMinAmounts", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "rewardTokens", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_feeRecipient", + "type": "address" + } + ], + "name": "setFeeRecipient", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_fees", + "type": "uint256" + } + ], + "name": "setFees", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "_message", + "type": "string" + } + ], + "name": "setMessage", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_distributor", + "type": "address" + } + ], + "name": "setNewDistributor", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "tokens", + "type": "address[]" + }, + { + "internalType": "uint256[]", + "name": "amounts", + "type": "uint256[]" + } + ], + "name": "setRewardTokenMinAmounts", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "internalType": "uint256", + "name": "userFeeRebate", + "type": "uint256" + } + ], + "name": "setUserFeeRebate", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "signature", + "type": "bytes" + } + ], + "name": "sign", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "bytes32", + "name": "rewardId", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "uniV3Pool", + "type": "address" + }, + { + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address[]", + "name": "positionWrappers", + "type": "address[]" + }, + { + "internalType": "uint32[]", + "name": "wrapperTypes", + "type": "uint32[]" + }, + { + "internalType": "uint32", + "name": "propToken0", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propToken1", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propFees", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "epochStart", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "numEpoch", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "isOutOfRangeIncentivized", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "boostedReward", + "type": "uint32" + }, + { + "internalType": "address", + "name": "boostingAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "additionalData", + "type": "bytes" + } + ], + "internalType": "struct DistributionParameters", + "name": "distribution", + "type": "tuple" + }, + { + "internalType": "bytes", + "name": "signature", + "type": "bytes" + } + ], + "name": "signAndCreateDistribution", + "outputs": [ + { + "internalType": "uint256", + "name": "distributionAmount", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "user", + "type": "address" + } + ], + "name": "toggleSigningWhitelist", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + } + ], + "name": "toggleTokenWhitelist", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "bytes32", + "name": "rewardId", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "uniV3Pool", + "type": "address" + }, + { + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address[]", + "name": "positionWrappers", + "type": "address[]" + }, + { + "internalType": "uint32[]", + "name": "wrapperTypes", + "type": "uint32[]" + }, + { + "internalType": "uint32", + "name": "propToken0", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propToken1", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propFees", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "epochStart", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "numEpoch", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "isOutOfRangeIncentivized", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "boostedReward", + "type": "uint32" + }, + { + "internalType": "address", + "name": "boostingAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "additionalData", + "type": "bytes" + } + ], + "internalType": "struct DistributionParameters", + "name": "distribution", + "type": "tuple" + } + ], + "name": "tryGetExtensiveDistributionParameters", + "outputs": [ + { + "internalType": "bool", + "name": "success", + "type": "bool" + }, + { + "components": [ + { + "components": [ + { + "internalType": "bytes32", + "name": "rewardId", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "uniV3Pool", + "type": "address" + }, + { + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address[]", + "name": "positionWrappers", + "type": "address[]" + }, + { + "internalType": "uint32[]", + "name": "wrapperTypes", + "type": "uint32[]" + }, + { + "internalType": "uint32", + "name": "propToken0", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propToken1", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propFees", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "epochStart", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "numEpoch", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "isOutOfRangeIncentivized", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "boostedReward", + "type": "uint32" + }, + { + "internalType": "address", + "name": "boostingAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "additionalData", + "type": "bytes" + } + ], + "internalType": "struct DistributionParameters", + "name": "base", + "type": "tuple" + }, + { + "internalType": "uint24", + "name": "poolFee", + "type": "uint24" + }, + { + "components": [ + { + "internalType": "address", + "name": "add", + "type": "address" + }, + { + "internalType": "uint8", + "name": "decimals", + "type": "uint8" + }, + { + "internalType": "string", + "name": "symbol", + "type": "string" + }, + { + "internalType": "uint256", + "name": "poolBalance", + "type": "uint256" + } + ], + "internalType": "struct UniswapTokenData", + "name": "token0", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "address", + "name": "add", + "type": "address" + }, + { + "internalType": "uint8", + "name": "decimals", + "type": "uint8" + }, + { + "internalType": "string", + "name": "symbol", + "type": "string" + }, + { + "internalType": "uint256", + "name": "poolBalance", + "type": "uint256" + } + ], + "internalType": "struct UniswapTokenData", + "name": "token1", + "type": "tuple" + }, + { + "internalType": "string", + "name": "rewardTokenSymbol", + "type": "string" + }, + { + "internalType": "uint8", + "name": "rewardTokenDecimals", + "type": "uint8" + } + ], + "internalType": "struct ExtensiveDistributionParameters", + "name": "extensiveParams", + "type": "tuple" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "upgradeTo", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "upgradeToAndCall", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "userSignatureWhitelist", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "userSignatures", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "transactionHash": "0x6e148a55089a602947e2352bf90d6ead5759fb7b903575a35464f539165f5934", + "receipt": { + "to": null, + "from": "0x9f76a95AA7535bb0893cf88A146396e00ed21A12", + "contractAddress": "0x7Db28175B63f154587BbB1Cae62D39Ea80A23383", + "transactionIndex": 2, + "gasUsed": "4939166", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000", + "blockHash": "0x518221002a8872095c6e072a87c9cf0111d299abdc207f64b50a91e663023393", + "transactionHash": "0x6e148a55089a602947e2352bf90d6ead5759fb7b903575a35464f539165f5934", + "logs": [ + { + "transactionIndex": 2, + "blockNumber": 8867926, + "transactionHash": "0x6e148a55089a602947e2352bf90d6ead5759fb7b903575a35464f539165f5934", + "address": "0x7Db28175B63f154587BbB1Cae62D39Ea80A23383", + "topics": [ + "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000000001", + "logIndex": 1, + "blockHash": "0x518221002a8872095c6e072a87c9cf0111d299abdc207f64b50a91e663023393" + }, + { + "transactionIndex": 2, + "blockNumber": 8867926, + "transactionHash": "0x6e148a55089a602947e2352bf90d6ead5759fb7b903575a35464f539165f5934", + "address": "0x7Db28175B63f154587BbB1Cae62D39Ea80A23383", + "topics": [ + "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000000001", + "logIndex": 2, + "blockHash": "0x518221002a8872095c6e072a87c9cf0111d299abdc207f64b50a91e663023393" + } + ], + "blockNumber": 8867926, + "cumulativeGasUsed": "5095913", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 1, + "solcInputHash": "69984a2380fa2fad0c3afbbb08b5652b", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"InvalidLengths\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidParam\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidReward\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidSignature\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotGovernorOrGuardian\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotSigned\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ZeroAddress\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"previousAdmin\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"AdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"beacon\",\"type\":\"address\"}],\"name\":\"BeaconUpgraded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_distributor\",\"type\":\"address\"}],\"name\":\"DistributorUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"userFeeRebate\",\"type\":\"uint256\"}],\"name\":\"FeeRebateUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_feeRecipient\",\"type\":\"address\"}],\"name\":\"FeeRecipientUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_fees\",\"type\":\"uint256\"}],\"name\":\"FeesSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"_messageHash\",\"type\":\"bytes32\"}],\"name\":\"MessageUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"rewardId\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"uniV3Pool\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"rewardToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"positionWrappers\",\"type\":\"address[]\"},{\"internalType\":\"uint32[]\",\"name\":\"wrapperTypes\",\"type\":\"uint32[]\"},{\"internalType\":\"uint32\",\"name\":\"propToken0\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propToken1\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propFees\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"epochStart\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"numEpoch\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"isOutOfRangeIncentivized\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"boostedReward\",\"type\":\"uint32\"},{\"internalType\":\"address\",\"name\":\"boostingAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"additionalData\",\"type\":\"bytes\"}],\"indexed\":false,\"internalType\":\"struct DistributionParameters\",\"name\":\"distribution\",\"type\":\"tuple\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"NewDistribution\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"RewardTokenMinimumAmountUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"toggleStatus\",\"type\":\"uint256\"}],\"name\":\"TokenWhitelistToggled\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"implementation\",\"type\":\"address\"}],\"name\":\"Upgraded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"messageHash\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"}],\"name\":\"UserSigned\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"toggleStatus\",\"type\":\"uint256\"}],\"name\":\"UserSigningWhitelistToggled\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"BASE_9\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"EPOCH_DURATION\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"core\",\"outputs\":[{\"internalType\":\"contract ICore\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"rewardId\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"uniV3Pool\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"rewardToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"positionWrappers\",\"type\":\"address[]\"},{\"internalType\":\"uint32[]\",\"name\":\"wrapperTypes\",\"type\":\"uint32[]\"},{\"internalType\":\"uint32\",\"name\":\"propToken0\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propToken1\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propFees\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"epochStart\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"numEpoch\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"isOutOfRangeIncentivized\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"boostedReward\",\"type\":\"uint32\"},{\"internalType\":\"address\",\"name\":\"boostingAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"additionalData\",\"type\":\"bytes\"}],\"internalType\":\"struct DistributionParameters\",\"name\":\"distribution\",\"type\":\"tuple\"}],\"name\":\"createDistribution\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"distributionAmount\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"rewardId\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"uniV3Pool\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"rewardToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"positionWrappers\",\"type\":\"address[]\"},{\"internalType\":\"uint32[]\",\"name\":\"wrapperTypes\",\"type\":\"uint32[]\"},{\"internalType\":\"uint32\",\"name\":\"propToken0\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propToken1\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propFees\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"epochStart\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"numEpoch\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"isOutOfRangeIncentivized\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"boostedReward\",\"type\":\"uint32\"},{\"internalType\":\"address\",\"name\":\"boostingAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"additionalData\",\"type\":\"bytes\"}],\"internalType\":\"struct DistributionParameters[]\",\"name\":\"distributions\",\"type\":\"tuple[]\"}],\"name\":\"createDistributions\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"\",\"type\":\"uint256[]\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"distributionList\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"rewardId\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"uniV3Pool\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"rewardToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"uint32\",\"name\":\"propToken0\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propToken1\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propFees\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"epochStart\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"numEpoch\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"isOutOfRangeIncentivized\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"boostedReward\",\"type\":\"uint32\"},{\"internalType\":\"address\",\"name\":\"boostingAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"additionalData\",\"type\":\"bytes\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"distributor\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"feeRebate\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"feeRecipient\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"fees\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getActiveDistributions\",\"outputs\":[{\"components\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"rewardId\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"uniV3Pool\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"rewardToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"positionWrappers\",\"type\":\"address[]\"},{\"internalType\":\"uint32[]\",\"name\":\"wrapperTypes\",\"type\":\"uint32[]\"},{\"internalType\":\"uint32\",\"name\":\"propToken0\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propToken1\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propFees\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"epochStart\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"numEpoch\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"isOutOfRangeIncentivized\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"boostedReward\",\"type\":\"uint32\"},{\"internalType\":\"address\",\"name\":\"boostingAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"additionalData\",\"type\":\"bytes\"}],\"internalType\":\"struct DistributionParameters\",\"name\":\"base\",\"type\":\"tuple\"},{\"internalType\":\"uint24\",\"name\":\"poolFee\",\"type\":\"uint24\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"add\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"decimals\",\"type\":\"uint8\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"poolBalance\",\"type\":\"uint256\"}],\"internalType\":\"struct UniswapTokenData\",\"name\":\"token0\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"add\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"decimals\",\"type\":\"uint8\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"poolBalance\",\"type\":\"uint256\"}],\"internalType\":\"struct UniswapTokenData\",\"name\":\"token1\",\"type\":\"tuple\"},{\"internalType\":\"string\",\"name\":\"rewardTokenSymbol\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"rewardTokenDecimals\",\"type\":\"uint8\"}],\"internalType\":\"struct ExtensiveDistributionParameters[]\",\"name\":\"searchDistributions\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"skip\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"first\",\"type\":\"uint32\"}],\"name\":\"getActiveDistributions\",\"outputs\":[{\"components\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"rewardId\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"uniV3Pool\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"rewardToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"positionWrappers\",\"type\":\"address[]\"},{\"internalType\":\"uint32[]\",\"name\":\"wrapperTypes\",\"type\":\"uint32[]\"},{\"internalType\":\"uint32\",\"name\":\"propToken0\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propToken1\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propFees\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"epochStart\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"numEpoch\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"isOutOfRangeIncentivized\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"boostedReward\",\"type\":\"uint32\"},{\"internalType\":\"address\",\"name\":\"boostingAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"additionalData\",\"type\":\"bytes\"}],\"internalType\":\"struct DistributionParameters\",\"name\":\"base\",\"type\":\"tuple\"},{\"internalType\":\"uint24\",\"name\":\"poolFee\",\"type\":\"uint24\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"add\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"decimals\",\"type\":\"uint8\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"poolBalance\",\"type\":\"uint256\"}],\"internalType\":\"struct UniswapTokenData\",\"name\":\"token0\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"add\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"decimals\",\"type\":\"uint8\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"poolBalance\",\"type\":\"uint256\"}],\"internalType\":\"struct UniswapTokenData\",\"name\":\"token1\",\"type\":\"tuple\"},{\"internalType\":\"string\",\"name\":\"rewardTokenSymbol\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"rewardTokenDecimals\",\"type\":\"uint8\"}],\"internalType\":\"struct ExtensiveDistributionParameters[]\",\"name\":\"searchDistributions\",\"type\":\"tuple[]\"},{\"internalType\":\"uint256\",\"name\":\"lastIndexDistribution\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"uniV3Pool\",\"type\":\"address\"}],\"name\":\"getActivePoolDistributions\",\"outputs\":[{\"components\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"rewardId\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"uniV3Pool\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"rewardToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"positionWrappers\",\"type\":\"address[]\"},{\"internalType\":\"uint32[]\",\"name\":\"wrapperTypes\",\"type\":\"uint32[]\"},{\"internalType\":\"uint32\",\"name\":\"propToken0\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propToken1\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propFees\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"epochStart\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"numEpoch\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"isOutOfRangeIncentivized\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"boostedReward\",\"type\":\"uint32\"},{\"internalType\":\"address\",\"name\":\"boostingAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"additionalData\",\"type\":\"bytes\"}],\"internalType\":\"struct DistributionParameters\",\"name\":\"base\",\"type\":\"tuple\"},{\"internalType\":\"uint24\",\"name\":\"poolFee\",\"type\":\"uint24\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"add\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"decimals\",\"type\":\"uint8\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"poolBalance\",\"type\":\"uint256\"}],\"internalType\":\"struct UniswapTokenData\",\"name\":\"token0\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"add\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"decimals\",\"type\":\"uint8\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"poolBalance\",\"type\":\"uint256\"}],\"internalType\":\"struct UniswapTokenData\",\"name\":\"token1\",\"type\":\"tuple\"},{\"internalType\":\"string\",\"name\":\"rewardTokenSymbol\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"rewardTokenDecimals\",\"type\":\"uint8\"}],\"internalType\":\"struct ExtensiveDistributionParameters[]\",\"name\":\"searchDistributions\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"uniV3Pool\",\"type\":\"address\"},{\"internalType\":\"uint32\",\"name\":\"skip\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"first\",\"type\":\"uint32\"}],\"name\":\"getActivePoolDistributions\",\"outputs\":[{\"components\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"rewardId\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"uniV3Pool\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"rewardToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"positionWrappers\",\"type\":\"address[]\"},{\"internalType\":\"uint32[]\",\"name\":\"wrapperTypes\",\"type\":\"uint32[]\"},{\"internalType\":\"uint32\",\"name\":\"propToken0\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propToken1\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propFees\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"epochStart\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"numEpoch\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"isOutOfRangeIncentivized\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"boostedReward\",\"type\":\"uint32\"},{\"internalType\":\"address\",\"name\":\"boostingAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"additionalData\",\"type\":\"bytes\"}],\"internalType\":\"struct DistributionParameters\",\"name\":\"base\",\"type\":\"tuple\"},{\"internalType\":\"uint24\",\"name\":\"poolFee\",\"type\":\"uint24\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"add\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"decimals\",\"type\":\"uint8\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"poolBalance\",\"type\":\"uint256\"}],\"internalType\":\"struct UniswapTokenData\",\"name\":\"token0\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"add\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"decimals\",\"type\":\"uint8\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"poolBalance\",\"type\":\"uint256\"}],\"internalType\":\"struct UniswapTokenData\",\"name\":\"token1\",\"type\":\"tuple\"},{\"internalType\":\"string\",\"name\":\"rewardTokenSymbol\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"rewardTokenDecimals\",\"type\":\"uint8\"}],\"internalType\":\"struct ExtensiveDistributionParameters[]\",\"name\":\"\",\"type\":\"tuple[]\"},{\"internalType\":\"uint256\",\"name\":\"lastIndexDistribution\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getAllDistributions\",\"outputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"rewardId\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"uniV3Pool\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"rewardToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"positionWrappers\",\"type\":\"address[]\"},{\"internalType\":\"uint32[]\",\"name\":\"wrapperTypes\",\"type\":\"uint32[]\"},{\"internalType\":\"uint32\",\"name\":\"propToken0\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propToken1\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propFees\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"epochStart\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"numEpoch\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"isOutOfRangeIncentivized\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"boostedReward\",\"type\":\"uint32\"},{\"internalType\":\"address\",\"name\":\"boostingAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"additionalData\",\"type\":\"bytes\"}],\"internalType\":\"struct DistributionParameters[]\",\"name\":\"\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"epochStart\",\"type\":\"uint32\"}],\"name\":\"getDistributionsAfterEpoch\",\"outputs\":[{\"components\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"rewardId\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"uniV3Pool\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"rewardToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"positionWrappers\",\"type\":\"address[]\"},{\"internalType\":\"uint32[]\",\"name\":\"wrapperTypes\",\"type\":\"uint32[]\"},{\"internalType\":\"uint32\",\"name\":\"propToken0\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propToken1\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propFees\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"epochStart\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"numEpoch\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"isOutOfRangeIncentivized\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"boostedReward\",\"type\":\"uint32\"},{\"internalType\":\"address\",\"name\":\"boostingAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"additionalData\",\"type\":\"bytes\"}],\"internalType\":\"struct DistributionParameters\",\"name\":\"base\",\"type\":\"tuple\"},{\"internalType\":\"uint24\",\"name\":\"poolFee\",\"type\":\"uint24\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"add\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"decimals\",\"type\":\"uint8\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"poolBalance\",\"type\":\"uint256\"}],\"internalType\":\"struct UniswapTokenData\",\"name\":\"token0\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"add\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"decimals\",\"type\":\"uint8\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"poolBalance\",\"type\":\"uint256\"}],\"internalType\":\"struct UniswapTokenData\",\"name\":\"token1\",\"type\":\"tuple\"},{\"internalType\":\"string\",\"name\":\"rewardTokenSymbol\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"rewardTokenDecimals\",\"type\":\"uint8\"}],\"internalType\":\"struct ExtensiveDistributionParameters[]\",\"name\":\"searchDistributions\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"epochStart\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"skip\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"first\",\"type\":\"uint32\"}],\"name\":\"getDistributionsAfterEpoch\",\"outputs\":[{\"components\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"rewardId\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"uniV3Pool\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"rewardToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"positionWrappers\",\"type\":\"address[]\"},{\"internalType\":\"uint32[]\",\"name\":\"wrapperTypes\",\"type\":\"uint32[]\"},{\"internalType\":\"uint32\",\"name\":\"propToken0\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propToken1\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propFees\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"epochStart\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"numEpoch\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"isOutOfRangeIncentivized\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"boostedReward\",\"type\":\"uint32\"},{\"internalType\":\"address\",\"name\":\"boostingAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"additionalData\",\"type\":\"bytes\"}],\"internalType\":\"struct DistributionParameters\",\"name\":\"base\",\"type\":\"tuple\"},{\"internalType\":\"uint24\",\"name\":\"poolFee\",\"type\":\"uint24\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"add\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"decimals\",\"type\":\"uint8\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"poolBalance\",\"type\":\"uint256\"}],\"internalType\":\"struct UniswapTokenData\",\"name\":\"token0\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"add\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"decimals\",\"type\":\"uint8\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"poolBalance\",\"type\":\"uint256\"}],\"internalType\":\"struct UniswapTokenData\",\"name\":\"token1\",\"type\":\"tuple\"},{\"internalType\":\"string\",\"name\":\"rewardTokenSymbol\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"rewardTokenDecimals\",\"type\":\"uint8\"}],\"internalType\":\"struct ExtensiveDistributionParameters[]\",\"name\":\"\",\"type\":\"tuple[]\"},{\"internalType\":\"uint256\",\"name\":\"lastIndexDistribution\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"epochStart\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"epochEnd\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"skip\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"first\",\"type\":\"uint32\"}],\"name\":\"getDistributionsBetweenEpochs\",\"outputs\":[{\"components\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"rewardId\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"uniV3Pool\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"rewardToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"positionWrappers\",\"type\":\"address[]\"},{\"internalType\":\"uint32[]\",\"name\":\"wrapperTypes\",\"type\":\"uint32[]\"},{\"internalType\":\"uint32\",\"name\":\"propToken0\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propToken1\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propFees\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"epochStart\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"numEpoch\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"isOutOfRangeIncentivized\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"boostedReward\",\"type\":\"uint32\"},{\"internalType\":\"address\",\"name\":\"boostingAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"additionalData\",\"type\":\"bytes\"}],\"internalType\":\"struct DistributionParameters\",\"name\":\"base\",\"type\":\"tuple\"},{\"internalType\":\"uint24\",\"name\":\"poolFee\",\"type\":\"uint24\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"add\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"decimals\",\"type\":\"uint8\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"poolBalance\",\"type\":\"uint256\"}],\"internalType\":\"struct UniswapTokenData\",\"name\":\"token0\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"add\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"decimals\",\"type\":\"uint8\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"poolBalance\",\"type\":\"uint256\"}],\"internalType\":\"struct UniswapTokenData\",\"name\":\"token1\",\"type\":\"tuple\"},{\"internalType\":\"string\",\"name\":\"rewardTokenSymbol\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"rewardTokenDecimals\",\"type\":\"uint8\"}],\"internalType\":\"struct ExtensiveDistributionParameters[]\",\"name\":\"\",\"type\":\"tuple[]\"},{\"internalType\":\"uint256\",\"name\":\"lastIndexDistribution\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"epochStart\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"epochEnd\",\"type\":\"uint32\"}],\"name\":\"getDistributionsBetweenEpochs\",\"outputs\":[{\"components\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"rewardId\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"uniV3Pool\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"rewardToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"positionWrappers\",\"type\":\"address[]\"},{\"internalType\":\"uint32[]\",\"name\":\"wrapperTypes\",\"type\":\"uint32[]\"},{\"internalType\":\"uint32\",\"name\":\"propToken0\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propToken1\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propFees\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"epochStart\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"numEpoch\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"isOutOfRangeIncentivized\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"boostedReward\",\"type\":\"uint32\"},{\"internalType\":\"address\",\"name\":\"boostingAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"additionalData\",\"type\":\"bytes\"}],\"internalType\":\"struct DistributionParameters\",\"name\":\"base\",\"type\":\"tuple\"},{\"internalType\":\"uint24\",\"name\":\"poolFee\",\"type\":\"uint24\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"add\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"decimals\",\"type\":\"uint8\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"poolBalance\",\"type\":\"uint256\"}],\"internalType\":\"struct UniswapTokenData\",\"name\":\"token0\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"add\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"decimals\",\"type\":\"uint8\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"poolBalance\",\"type\":\"uint256\"}],\"internalType\":\"struct UniswapTokenData\",\"name\":\"token1\",\"type\":\"tuple\"},{\"internalType\":\"string\",\"name\":\"rewardTokenSymbol\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"rewardTokenDecimals\",\"type\":\"uint8\"}],\"internalType\":\"struct ExtensiveDistributionParameters[]\",\"name\":\"searchDistributions\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"epoch\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"skip\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"first\",\"type\":\"uint32\"}],\"name\":\"getDistributionsForEpoch\",\"outputs\":[{\"components\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"rewardId\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"uniV3Pool\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"rewardToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"positionWrappers\",\"type\":\"address[]\"},{\"internalType\":\"uint32[]\",\"name\":\"wrapperTypes\",\"type\":\"uint32[]\"},{\"internalType\":\"uint32\",\"name\":\"propToken0\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propToken1\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propFees\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"epochStart\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"numEpoch\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"isOutOfRangeIncentivized\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"boostedReward\",\"type\":\"uint32\"},{\"internalType\":\"address\",\"name\":\"boostingAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"additionalData\",\"type\":\"bytes\"}],\"internalType\":\"struct DistributionParameters\",\"name\":\"base\",\"type\":\"tuple\"},{\"internalType\":\"uint24\",\"name\":\"poolFee\",\"type\":\"uint24\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"add\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"decimals\",\"type\":\"uint8\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"poolBalance\",\"type\":\"uint256\"}],\"internalType\":\"struct UniswapTokenData\",\"name\":\"token0\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"add\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"decimals\",\"type\":\"uint8\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"poolBalance\",\"type\":\"uint256\"}],\"internalType\":\"struct UniswapTokenData\",\"name\":\"token1\",\"type\":\"tuple\"},{\"internalType\":\"string\",\"name\":\"rewardTokenSymbol\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"rewardTokenDecimals\",\"type\":\"uint8\"}],\"internalType\":\"struct ExtensiveDistributionParameters[]\",\"name\":\"\",\"type\":\"tuple[]\"},{\"internalType\":\"uint256\",\"name\":\"lastIndexDistribution\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"epoch\",\"type\":\"uint32\"}],\"name\":\"getDistributionsForEpoch\",\"outputs\":[{\"components\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"rewardId\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"uniV3Pool\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"rewardToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"positionWrappers\",\"type\":\"address[]\"},{\"internalType\":\"uint32[]\",\"name\":\"wrapperTypes\",\"type\":\"uint32[]\"},{\"internalType\":\"uint32\",\"name\":\"propToken0\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propToken1\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propFees\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"epochStart\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"numEpoch\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"isOutOfRangeIncentivized\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"boostedReward\",\"type\":\"uint32\"},{\"internalType\":\"address\",\"name\":\"boostingAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"additionalData\",\"type\":\"bytes\"}],\"internalType\":\"struct DistributionParameters\",\"name\":\"base\",\"type\":\"tuple\"},{\"internalType\":\"uint24\",\"name\":\"poolFee\",\"type\":\"uint24\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"add\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"decimals\",\"type\":\"uint8\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"poolBalance\",\"type\":\"uint256\"}],\"internalType\":\"struct UniswapTokenData\",\"name\":\"token0\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"add\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"decimals\",\"type\":\"uint8\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"poolBalance\",\"type\":\"uint256\"}],\"internalType\":\"struct UniswapTokenData\",\"name\":\"token1\",\"type\":\"tuple\"},{\"internalType\":\"string\",\"name\":\"rewardTokenSymbol\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"rewardTokenDecimals\",\"type\":\"uint8\"}],\"internalType\":\"struct ExtensiveDistributionParameters[]\",\"name\":\"searchDistributions\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"rewardId\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"uniV3Pool\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"rewardToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"positionWrappers\",\"type\":\"address[]\"},{\"internalType\":\"uint32[]\",\"name\":\"wrapperTypes\",\"type\":\"uint32[]\"},{\"internalType\":\"uint32\",\"name\":\"propToken0\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propToken1\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propFees\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"epochStart\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"numEpoch\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"isOutOfRangeIncentivized\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"boostedReward\",\"type\":\"uint32\"},{\"internalType\":\"address\",\"name\":\"boostingAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"additionalData\",\"type\":\"bytes\"}],\"internalType\":\"struct DistributionParameters\",\"name\":\"distribution\",\"type\":\"tuple\"}],\"name\":\"getExtensiveDistributionParameters\",\"outputs\":[{\"components\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"rewardId\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"uniV3Pool\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"rewardToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"positionWrappers\",\"type\":\"address[]\"},{\"internalType\":\"uint32[]\",\"name\":\"wrapperTypes\",\"type\":\"uint32[]\"},{\"internalType\":\"uint32\",\"name\":\"propToken0\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propToken1\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propFees\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"epochStart\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"numEpoch\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"isOutOfRangeIncentivized\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"boostedReward\",\"type\":\"uint32\"},{\"internalType\":\"address\",\"name\":\"boostingAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"additionalData\",\"type\":\"bytes\"}],\"internalType\":\"struct DistributionParameters\",\"name\":\"base\",\"type\":\"tuple\"},{\"internalType\":\"uint24\",\"name\":\"poolFee\",\"type\":\"uint24\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"add\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"decimals\",\"type\":\"uint8\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"poolBalance\",\"type\":\"uint256\"}],\"internalType\":\"struct UniswapTokenData\",\"name\":\"token0\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"add\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"decimals\",\"type\":\"uint8\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"poolBalance\",\"type\":\"uint256\"}],\"internalType\":\"struct UniswapTokenData\",\"name\":\"token1\",\"type\":\"tuple\"},{\"internalType\":\"string\",\"name\":\"rewardTokenSymbol\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"rewardTokenDecimals\",\"type\":\"uint8\"}],\"internalType\":\"struct ExtensiveDistributionParameters\",\"name\":\"extensiveParams\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"uniV3Pool\",\"type\":\"address\"},{\"internalType\":\"uint32\",\"name\":\"epochStart\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"skip\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"first\",\"type\":\"uint32\"}],\"name\":\"getPoolDistributionsAfterEpoch\",\"outputs\":[{\"components\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"rewardId\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"uniV3Pool\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"rewardToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"positionWrappers\",\"type\":\"address[]\"},{\"internalType\":\"uint32[]\",\"name\":\"wrapperTypes\",\"type\":\"uint32[]\"},{\"internalType\":\"uint32\",\"name\":\"propToken0\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propToken1\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propFees\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"epochStart\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"numEpoch\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"isOutOfRangeIncentivized\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"boostedReward\",\"type\":\"uint32\"},{\"internalType\":\"address\",\"name\":\"boostingAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"additionalData\",\"type\":\"bytes\"}],\"internalType\":\"struct DistributionParameters\",\"name\":\"base\",\"type\":\"tuple\"},{\"internalType\":\"uint24\",\"name\":\"poolFee\",\"type\":\"uint24\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"add\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"decimals\",\"type\":\"uint8\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"poolBalance\",\"type\":\"uint256\"}],\"internalType\":\"struct UniswapTokenData\",\"name\":\"token0\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"add\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"decimals\",\"type\":\"uint8\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"poolBalance\",\"type\":\"uint256\"}],\"internalType\":\"struct UniswapTokenData\",\"name\":\"token1\",\"type\":\"tuple\"},{\"internalType\":\"string\",\"name\":\"rewardTokenSymbol\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"rewardTokenDecimals\",\"type\":\"uint8\"}],\"internalType\":\"struct ExtensiveDistributionParameters[]\",\"name\":\"\",\"type\":\"tuple[]\"},{\"internalType\":\"uint256\",\"name\":\"lastIndexDistribution\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"uniV3Pool\",\"type\":\"address\"},{\"internalType\":\"uint32\",\"name\":\"epochStart\",\"type\":\"uint32\"}],\"name\":\"getPoolDistributionsAfterEpoch\",\"outputs\":[{\"components\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"rewardId\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"uniV3Pool\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"rewardToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"positionWrappers\",\"type\":\"address[]\"},{\"internalType\":\"uint32[]\",\"name\":\"wrapperTypes\",\"type\":\"uint32[]\"},{\"internalType\":\"uint32\",\"name\":\"propToken0\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propToken1\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propFees\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"epochStart\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"numEpoch\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"isOutOfRangeIncentivized\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"boostedReward\",\"type\":\"uint32\"},{\"internalType\":\"address\",\"name\":\"boostingAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"additionalData\",\"type\":\"bytes\"}],\"internalType\":\"struct DistributionParameters\",\"name\":\"base\",\"type\":\"tuple\"},{\"internalType\":\"uint24\",\"name\":\"poolFee\",\"type\":\"uint24\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"add\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"decimals\",\"type\":\"uint8\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"poolBalance\",\"type\":\"uint256\"}],\"internalType\":\"struct UniswapTokenData\",\"name\":\"token0\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"add\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"decimals\",\"type\":\"uint8\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"poolBalance\",\"type\":\"uint256\"}],\"internalType\":\"struct UniswapTokenData\",\"name\":\"token1\",\"type\":\"tuple\"},{\"internalType\":\"string\",\"name\":\"rewardTokenSymbol\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"rewardTokenDecimals\",\"type\":\"uint8\"}],\"internalType\":\"struct ExtensiveDistributionParameters[]\",\"name\":\"searchDistributions\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"uniV3Pool\",\"type\":\"address\"},{\"internalType\":\"uint32\",\"name\":\"epochStart\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"epochEnd\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"skip\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"first\",\"type\":\"uint32\"}],\"name\":\"getPoolDistributionsBetweenEpochs\",\"outputs\":[{\"components\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"rewardId\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"uniV3Pool\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"rewardToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"positionWrappers\",\"type\":\"address[]\"},{\"internalType\":\"uint32[]\",\"name\":\"wrapperTypes\",\"type\":\"uint32[]\"},{\"internalType\":\"uint32\",\"name\":\"propToken0\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propToken1\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propFees\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"epochStart\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"numEpoch\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"isOutOfRangeIncentivized\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"boostedReward\",\"type\":\"uint32\"},{\"internalType\":\"address\",\"name\":\"boostingAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"additionalData\",\"type\":\"bytes\"}],\"internalType\":\"struct DistributionParameters\",\"name\":\"base\",\"type\":\"tuple\"},{\"internalType\":\"uint24\",\"name\":\"poolFee\",\"type\":\"uint24\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"add\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"decimals\",\"type\":\"uint8\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"poolBalance\",\"type\":\"uint256\"}],\"internalType\":\"struct UniswapTokenData\",\"name\":\"token0\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"add\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"decimals\",\"type\":\"uint8\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"poolBalance\",\"type\":\"uint256\"}],\"internalType\":\"struct UniswapTokenData\",\"name\":\"token1\",\"type\":\"tuple\"},{\"internalType\":\"string\",\"name\":\"rewardTokenSymbol\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"rewardTokenDecimals\",\"type\":\"uint8\"}],\"internalType\":\"struct ExtensiveDistributionParameters[]\",\"name\":\"\",\"type\":\"tuple[]\"},{\"internalType\":\"uint256\",\"name\":\"lastIndexDistribution\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"uniV3Pool\",\"type\":\"address\"},{\"internalType\":\"uint32\",\"name\":\"epochStart\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"epochEnd\",\"type\":\"uint32\"}],\"name\":\"getPoolDistributionsBetweenEpochs\",\"outputs\":[{\"components\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"rewardId\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"uniV3Pool\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"rewardToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"positionWrappers\",\"type\":\"address[]\"},{\"internalType\":\"uint32[]\",\"name\":\"wrapperTypes\",\"type\":\"uint32[]\"},{\"internalType\":\"uint32\",\"name\":\"propToken0\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propToken1\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propFees\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"epochStart\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"numEpoch\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"isOutOfRangeIncentivized\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"boostedReward\",\"type\":\"uint32\"},{\"internalType\":\"address\",\"name\":\"boostingAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"additionalData\",\"type\":\"bytes\"}],\"internalType\":\"struct DistributionParameters\",\"name\":\"base\",\"type\":\"tuple\"},{\"internalType\":\"uint24\",\"name\":\"poolFee\",\"type\":\"uint24\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"add\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"decimals\",\"type\":\"uint8\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"poolBalance\",\"type\":\"uint256\"}],\"internalType\":\"struct UniswapTokenData\",\"name\":\"token0\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"add\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"decimals\",\"type\":\"uint8\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"poolBalance\",\"type\":\"uint256\"}],\"internalType\":\"struct UniswapTokenData\",\"name\":\"token1\",\"type\":\"tuple\"},{\"internalType\":\"string\",\"name\":\"rewardTokenSymbol\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"rewardTokenDecimals\",\"type\":\"uint8\"}],\"internalType\":\"struct ExtensiveDistributionParameters[]\",\"name\":\"searchDistributions\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"uniV3Pool\",\"type\":\"address\"},{\"internalType\":\"uint32\",\"name\":\"epoch\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"skip\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"first\",\"type\":\"uint32\"}],\"name\":\"getPoolDistributionsForEpoch\",\"outputs\":[{\"components\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"rewardId\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"uniV3Pool\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"rewardToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"positionWrappers\",\"type\":\"address[]\"},{\"internalType\":\"uint32[]\",\"name\":\"wrapperTypes\",\"type\":\"uint32[]\"},{\"internalType\":\"uint32\",\"name\":\"propToken0\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propToken1\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propFees\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"epochStart\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"numEpoch\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"isOutOfRangeIncentivized\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"boostedReward\",\"type\":\"uint32\"},{\"internalType\":\"address\",\"name\":\"boostingAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"additionalData\",\"type\":\"bytes\"}],\"internalType\":\"struct DistributionParameters\",\"name\":\"base\",\"type\":\"tuple\"},{\"internalType\":\"uint24\",\"name\":\"poolFee\",\"type\":\"uint24\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"add\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"decimals\",\"type\":\"uint8\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"poolBalance\",\"type\":\"uint256\"}],\"internalType\":\"struct UniswapTokenData\",\"name\":\"token0\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"add\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"decimals\",\"type\":\"uint8\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"poolBalance\",\"type\":\"uint256\"}],\"internalType\":\"struct UniswapTokenData\",\"name\":\"token1\",\"type\":\"tuple\"},{\"internalType\":\"string\",\"name\":\"rewardTokenSymbol\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"rewardTokenDecimals\",\"type\":\"uint8\"}],\"internalType\":\"struct ExtensiveDistributionParameters[]\",\"name\":\"\",\"type\":\"tuple[]\"},{\"internalType\":\"uint256\",\"name\":\"lastIndexDistribution\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"uniV3Pool\",\"type\":\"address\"},{\"internalType\":\"uint32\",\"name\":\"epoch\",\"type\":\"uint32\"}],\"name\":\"getPoolDistributionsForEpoch\",\"outputs\":[{\"components\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"rewardId\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"uniV3Pool\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"rewardToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"positionWrappers\",\"type\":\"address[]\"},{\"internalType\":\"uint32[]\",\"name\":\"wrapperTypes\",\"type\":\"uint32[]\"},{\"internalType\":\"uint32\",\"name\":\"propToken0\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propToken1\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propFees\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"epochStart\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"numEpoch\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"isOutOfRangeIncentivized\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"boostedReward\",\"type\":\"uint32\"},{\"internalType\":\"address\",\"name\":\"boostingAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"additionalData\",\"type\":\"bytes\"}],\"internalType\":\"struct DistributionParameters\",\"name\":\"base\",\"type\":\"tuple\"},{\"internalType\":\"uint24\",\"name\":\"poolFee\",\"type\":\"uint24\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"add\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"decimals\",\"type\":\"uint8\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"poolBalance\",\"type\":\"uint256\"}],\"internalType\":\"struct UniswapTokenData\",\"name\":\"token0\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"add\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"decimals\",\"type\":\"uint8\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"poolBalance\",\"type\":\"uint256\"}],\"internalType\":\"struct UniswapTokenData\",\"name\":\"token1\",\"type\":\"tuple\"},{\"internalType\":\"string\",\"name\":\"rewardTokenSymbol\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"rewardTokenDecimals\",\"type\":\"uint8\"}],\"internalType\":\"struct ExtensiveDistributionParameters[]\",\"name\":\"searchDistributions\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getValidRewardTokens\",\"outputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"minimumAmountPerEpoch\",\"type\":\"uint256\"}],\"internalType\":\"struct RewardTokenAmounts[]\",\"name\":\"\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract ICore\",\"name\":\"_core\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_distributor\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_fees\",\"type\":\"uint256\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"isWhitelistedToken\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"message\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"messageHash\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"nonces\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"proxiableUUID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract IERC20[]\",\"name\":\"tokens\",\"type\":\"address[]\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"}],\"name\":\"recoverFees\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"rewardTokenMinAmounts\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"rewardTokens\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_feeRecipient\",\"type\":\"address\"}],\"name\":\"setFeeRecipient\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_fees\",\"type\":\"uint256\"}],\"name\":\"setFees\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_message\",\"type\":\"string\"}],\"name\":\"setMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_distributor\",\"type\":\"address\"}],\"name\":\"setNewDistributor\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"tokens\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"}],\"name\":\"setRewardTokenMinAmounts\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"userFeeRebate\",\"type\":\"uint256\"}],\"name\":\"setUserFeeRebate\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"signature\",\"type\":\"bytes\"}],\"name\":\"sign\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"rewardId\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"uniV3Pool\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"rewardToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"positionWrappers\",\"type\":\"address[]\"},{\"internalType\":\"uint32[]\",\"name\":\"wrapperTypes\",\"type\":\"uint32[]\"},{\"internalType\":\"uint32\",\"name\":\"propToken0\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propToken1\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propFees\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"epochStart\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"numEpoch\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"isOutOfRangeIncentivized\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"boostedReward\",\"type\":\"uint32\"},{\"internalType\":\"address\",\"name\":\"boostingAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"additionalData\",\"type\":\"bytes\"}],\"internalType\":\"struct DistributionParameters\",\"name\":\"distribution\",\"type\":\"tuple\"},{\"internalType\":\"bytes\",\"name\":\"signature\",\"type\":\"bytes\"}],\"name\":\"signAndCreateDistribution\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"distributionAmount\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"}],\"name\":\"toggleSigningWhitelist\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"}],\"name\":\"toggleTokenWhitelist\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"rewardId\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"uniV3Pool\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"rewardToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"positionWrappers\",\"type\":\"address[]\"},{\"internalType\":\"uint32[]\",\"name\":\"wrapperTypes\",\"type\":\"uint32[]\"},{\"internalType\":\"uint32\",\"name\":\"propToken0\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propToken1\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propFees\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"epochStart\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"numEpoch\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"isOutOfRangeIncentivized\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"boostedReward\",\"type\":\"uint32\"},{\"internalType\":\"address\",\"name\":\"boostingAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"additionalData\",\"type\":\"bytes\"}],\"internalType\":\"struct DistributionParameters\",\"name\":\"distribution\",\"type\":\"tuple\"}],\"name\":\"tryGetExtensiveDistributionParameters\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"success\",\"type\":\"bool\"},{\"components\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"rewardId\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"uniV3Pool\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"rewardToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"positionWrappers\",\"type\":\"address[]\"},{\"internalType\":\"uint32[]\",\"name\":\"wrapperTypes\",\"type\":\"uint32[]\"},{\"internalType\":\"uint32\",\"name\":\"propToken0\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propToken1\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propFees\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"epochStart\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"numEpoch\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"isOutOfRangeIncentivized\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"boostedReward\",\"type\":\"uint32\"},{\"internalType\":\"address\",\"name\":\"boostingAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"additionalData\",\"type\":\"bytes\"}],\"internalType\":\"struct DistributionParameters\",\"name\":\"base\",\"type\":\"tuple\"},{\"internalType\":\"uint24\",\"name\":\"poolFee\",\"type\":\"uint24\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"add\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"decimals\",\"type\":\"uint8\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"poolBalance\",\"type\":\"uint256\"}],\"internalType\":\"struct UniswapTokenData\",\"name\":\"token0\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"add\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"decimals\",\"type\":\"uint8\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"poolBalance\",\"type\":\"uint256\"}],\"internalType\":\"struct UniswapTokenData\",\"name\":\"token1\",\"type\":\"tuple\"},{\"internalType\":\"string\",\"name\":\"rewardTokenSymbol\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"rewardTokenDecimals\",\"type\":\"uint8\"}],\"internalType\":\"struct ExtensiveDistributionParameters\",\"name\":\"extensiveParams\",\"type\":\"tuple\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"}],\"name\":\"upgradeTo\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"upgradeToAndCall\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"userSignatureWhitelist\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"userSignatures\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"author\":\"Angle Labs, Inc.\",\"details\":\"This contract is mostly a helper for APIs built on top of MerklPeople depositing rewards must have signed a `message` with the conditions for using the product\",\"kind\":\"dev\",\"methods\":{\"createDistribution((bytes32,address,address,uint256,address[],uint32[],uint32,uint32,uint32,uint32,uint32,uint32,uint32,address,bytes))\":{\"details\":\"If the address specified as a UniV3 pool is not effectively a pool, it will not be handled by the distribution script and rewards may be lostReward tokens sent as part of distributions must have been whitelisted before and amounts sent should be bigger than a minimum amount specific to each tokenThe `positionWrappers` specified in the `distribution` struct need to be supported by the script List of supported `positionWrappers` can be found in the docs.If the pool incentivized contains one whitelisted token, then no fees are taken on the rewardsThis function reverts if the sender has not signed the message `messageHash` once through one of the functions enabling to sign\",\"returns\":{\"distributionAmount\":\"How many reward tokens are actually taken into consideration in the contract\"}},\"createDistributions((bytes32,address,address,uint256,address[],uint32[],uint32,uint32,uint32,uint32,uint32,uint32,uint32,address,bytes)[])\":{\"returns\":{\"_0\":\"List of all the distribution amounts actually deposited for each `distribution` in the `distributions` list\"}},\"getActiveDistributions(uint32,uint32)\":{\"params\":{\"first\":\"Limit the length of the returned array to `first`\",\"skip\":\"Disregard distibutions with a global index lower than `skip`\"},\"returns\":{\"lastIndexDistribution\":\"Index of the last distribution assessed in the list of all distributions For pagniation purpose, in case of out of gas, you can call back the same function but with `skip` set to `lastIndexDistribution`\",\"searchDistributions\":\"Eligible distributions\"}},\"getActivePoolDistributions(address,uint32,uint32)\":{\"params\":{\"first\":\"Limit the length of the returned array to `first`\",\"skip\":\"Disregard distibutions with a global index lower than `skip`\"},\"returns\":{\"_0\":\"searchDistributions Eligible distributions\",\"lastIndexDistribution\":\"Index of the last distribution assessed in the list of all distributions For pagniation purpose, in case of out of gas, you can call back the same function but with `skip` set to `lastIndexDistribution`\"}},\"getDistributionsAfterEpoch(uint32,uint32,uint32)\":{\"params\":{\"first\":\"Limit the length of the returned array to `first`\",\"skip\":\"Disregard distibutions with a global index lower than `skip`\"},\"returns\":{\"_0\":\"searchDistributions Eligible distributions\",\"lastIndexDistribution\":\"Index of the last distribution assessed in the list of all distributions For pagniation purpose, in case of out of gas, you can call back the same function but with `skip` set to `lastIndexDistribution`\"}},\"getDistributionsBetweenEpochs(uint32,uint32)\":{\"details\":\"If a distribution starts during `epochEnd`, it is not be returned by this functionConversely, if a distribution starts after `epochStart` and ends before `epochEnd`, it is returned by this function\"},\"getDistributionsBetweenEpochs(uint32,uint32,uint32,uint32)\":{\"params\":{\"first\":\"Limit the length of the returned array to `first`\",\"skip\":\"Disregard distibutions with a global index lower than `skip`\"},\"returns\":{\"_0\":\"searchDistributions Eligible distributions\",\"lastIndexDistribution\":\"Index of the last distribution assessed in the list of all distributions For pagniation purpose, in case of out of gas, you can call back the same function but with `skip` set to `lastIndexDistribution`\"}},\"getDistributionsForEpoch(uint32,uint32,uint32)\":{\"params\":{\"first\":\"Limit the length of the returned array to `first`\",\"skip\":\"Disregard distibutions with a global index lower than `skip`\"},\"returns\":{\"_0\":\"searchDistributions Eligible distributions\",\"lastIndexDistribution\":\"Index of the last distribution assessed in the list of all distributions For pagniation purpose, in case of out of gas, you can call back the same function but with `skip` set to `lastIndexDistribution`\"}},\"getPoolDistributionsAfterEpoch(address,uint32,uint32,uint32)\":{\"params\":{\"first\":\"Limit the length of the returned array to `first`\",\"skip\":\"Disregard distibutions with a global index lower than `skip`\"},\"returns\":{\"_0\":\"searchDistributions Eligible distributions\",\"lastIndexDistribution\":\"Index of the last distribution assessed in the list of all distributions For pagniation purpose, in case of out of gas, you can call back the same function but with `skip` set to `lastIndexDistribution`\"}},\"getPoolDistributionsBetweenEpochs(address,uint32,uint32,uint32,uint32)\":{\"params\":{\"first\":\"Limit the length of the returned array to `first`\",\"skip\":\"Disregard distibutions with a global index lower than `skip`\"},\"returns\":{\"_0\":\"searchDistributions Eligible distributions\",\"lastIndexDistribution\":\"Index of the last distribution assessed in the list of all distributions For pagniation purpose, in case of out of gas, you can call back the same function but with `skip` set to `lastIndexDistribution`\"}},\"getPoolDistributionsForEpoch(address,uint32,uint32,uint32)\":{\"params\":{\"first\":\"Limit the length of the returned array to `first`\",\"skip\":\"Disregard distibutions with a global index lower than `skip`\"},\"returns\":{\"_0\":\"searchDistributions Eligible distributions\",\"lastIndexDistribution\":\"Index of the last distribution assessed in the list of all distributions For pagniation purpose, in case of out of gas, you can call back the same function but with `skip` set to `lastIndexDistribution`\"}},\"proxiableUUID()\":{\"details\":\"Implementation of the ERC1822 {proxiableUUID} function. This returns the storage slot used by the implementation. It is used to validate the implementation's compatibility when performing an upgrade. IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this function revert if invoked through a proxy. This is guaranteed by the `notDelegated` modifier.\"},\"sign(bytes)\":{\"details\":\"If you signed the message once, and the message has not been modified, then you do not need to sign again\"},\"upgradeTo(address)\":{\"details\":\"Upgrade the implementation of the proxy to `newImplementation`. Calls {_authorizeUpgrade}. Emits an {Upgraded} event.\"},\"upgradeToAndCall(address,bytes)\":{\"details\":\"Upgrade the implementation of the proxy to `newImplementation`, and subsequently execute the function call encoded in `data`. Calls {_authorizeUpgrade}. Emits an {Upgraded} event.\"}},\"stateVariables\":{\"distributionList\":{\"details\":\"An attacker could try to populate this list. It shouldn't be an issue as only view functions iterate on it\"},\"rewardTokenMinAmounts\":{\"details\":\"If `rewardTokenMinAmounts[token] == 0`, then `token` cannot be used as a reward\"}},\"title\":\"DistributionCreator\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"BASE_9()\":{\"notice\":\"Base for fee computation\"},\"EPOCH_DURATION()\":{\"notice\":\"Epoch duration\"},\"core()\":{\"notice\":\"`Core` contract handling access control\"},\"createDistribution((bytes32,address,address,uint256,address[],uint32[],uint32,uint32,uint32,uint32,uint32,uint32,uint32,address,bytes))\":{\"notice\":\"Creates a `distribution` to incentivize a given pool for a specific period of time\"},\"createDistributions((bytes32,address,address,uint256,address[],uint32[],uint32,uint32,uint32,uint32,uint32,uint32,uint32,address,bytes)[])\":{\"notice\":\"Same as the function above but for multiple distributions at once\"},\"distributionList(uint256)\":{\"notice\":\"List of all rewards ever distributed or to be distributed in the contract\"},\"distributor()\":{\"notice\":\"User contract for distributing rewards\"},\"feeRebate(address)\":{\"notice\":\"Maps an address to its fee rebate\"},\"feeRecipient()\":{\"notice\":\"Address to which fees are forwarded\"},\"fees()\":{\"notice\":\"Value (in base 10**9) of the fees taken when creating a distribution for a pool which do not have a whitelisted token in it\"},\"getActiveDistributions()\":{\"notice\":\"Returns the list of all currently active distributions on pools of supported AMMs (like Uniswap V3)\"},\"getActiveDistributions(uint32,uint32)\":{\"notice\":\"Similar to `getActiveDistributions()` with additional parameters to prevent out of gas error\"},\"getActivePoolDistributions(address)\":{\"notice\":\"Returns the list of all currently active distributions for a specific UniswapV3 pool\"},\"getActivePoolDistributions(address,uint32,uint32)\":{\"notice\":\"Similar to `getActivePoolDistributions(address uniV3Pool)` with additional parameters to prevent out of gas error\"},\"getAllDistributions()\":{\"notice\":\"Returns the list of all distributions ever made or to be done in the future\"},\"getDistributionsAfterEpoch(uint32)\":{\"notice\":\"Returns the list of all distributions that were or will be live after `epochStart` (included)\"},\"getDistributionsAfterEpoch(uint32,uint32,uint32)\":{\"notice\":\"Similar to `getDistributionsAfterEpoch(uint256 epochStart)` with additional parameters to prevent out of gas error\"},\"getDistributionsBetweenEpochs(uint32,uint32)\":{\"notice\":\"Gets the distributions that were or will be live at some point between `epochStart` (included) and `epochEnd` (excluded)\"},\"getDistributionsBetweenEpochs(uint32,uint32,uint32,uint32)\":{\"notice\":\"Similar to `getDistributionsBetweenEpochs(uint256 epochStart, uint256 epochEnd)` with additional parameters to prevent out of gas error\"},\"getDistributionsForEpoch(uint32)\":{\"notice\":\"Returns the list of all the distributions that were or that are going to be live at a specific epoch\"},\"getDistributionsForEpoch(uint32,uint32,uint32)\":{\"notice\":\"Similar to `getDistributionsForEpoch(uint256 epoch)` with additional parameters to prevent out of gas error\"},\"getExtensiveDistributionParameters((bytes32,address,address,uint256,address[],uint32[],uint32,uint32,uint32,uint32,uint32,uint32,uint32,address,bytes))\":{\"notice\":\"Fetches extra data about the parameters in a distribution\"},\"getPoolDistributionsAfterEpoch(address,uint32)\":{\"notice\":\"Returns the list of all distributions that were or will be live after `epochStart` (included) for a specific pool\"},\"getPoolDistributionsAfterEpoch(address,uint32,uint32,uint32)\":{\"notice\":\"Similar to `getPoolDistributionsAfterEpoch(address uniV3Pool,uint32 epochStart)` with additional parameters to prevent out of gas error\"},\"getPoolDistributionsBetweenEpochs(address,uint32,uint32)\":{\"notice\":\"Returns the list of all distributions that were or will be live at some point between `epochStart` (included) and `epochEnd` (excluded) for a specific pool\"},\"getPoolDistributionsBetweenEpochs(address,uint32,uint32,uint32,uint32)\":{\"notice\":\"Similar to `getPoolDistributionsBetweenEpochs(address uniV3Pool,uint32 epochStart, uint32 epochEnd)` with additional parameters to prevent out of gas error\"},\"getPoolDistributionsForEpoch(address,uint32)\":{\"notice\":\"Returns the list of all the distributions that were or that are going to be live at a specific epoch and for a specific pool\"},\"getPoolDistributionsForEpoch(address,uint32,uint32,uint32)\":{\"notice\":\"Similar to `getPoolDistributionsForEpoch(address uniV3Pool,uint32 epoch)` with additional parameters to prevent out of gas error\"},\"getValidRewardTokens()\":{\"notice\":\"Returns the list of all the reward tokens supported as well as their minimum amounts\"},\"isWhitelistedToken(address)\":{\"notice\":\"Maps a token to whether it is whitelisted or not. No fees are to be paid for incentives given on pools with whitelisted tokens\"},\"message()\":{\"notice\":\"Message that needs to be acknowledged by users creating a distribution\"},\"messageHash()\":{\"notice\":\"Hash of the message that needs to be signed\"},\"nonces(address)\":{\"notice\":\"Maps an address to its nonce for creating a distribution\"},\"recoverFees(address[],address)\":{\"notice\":\"Recovers fees accrued on the contract for a list of `tokens`\"},\"rewardTokenMinAmounts(address)\":{\"notice\":\"Maps a token to the minimum amount that must be sent per epoch for a distribution to be valid\"},\"rewardTokens(uint256)\":{\"notice\":\"List of all reward tokens that have at some point been accepted\"},\"setFeeRecipient(address)\":{\"notice\":\"Sets a new address to receive fees\"},\"setFees(uint256)\":{\"notice\":\"Sets the fees on deposit\"},\"setMessage(string)\":{\"notice\":\"Sets the message that needs to be signed by users before posting rewards\"},\"setNewDistributor(address)\":{\"notice\":\"Sets a new `distributor` to which rewards should be distributed\"},\"setRewardTokenMinAmounts(address[],uint256[])\":{\"notice\":\"Sets the minimum amounts per distribution epoch for different reward tokens\"},\"setUserFeeRebate(address,uint256)\":{\"notice\":\"Sets fee rebates for a given user\"},\"sign(bytes)\":{\"notice\":\"Checks whether the `msg.sender`'s `signature` is compatible with the message to sign and stores the signature\"},\"signAndCreateDistribution((bytes32,address,address,uint256,address[],uint32[],uint32,uint32,uint32,uint32,uint32,uint32,uint32,address,bytes),bytes)\":{\"notice\":\"Combines signing the message and creating a distribution\"},\"toggleSigningWhitelist(address)\":{\"notice\":\"Toggles the whitelist status for `user` when it comes to signing messages before depositing rewards.\"},\"toggleTokenWhitelist(address)\":{\"notice\":\"Toggles the fee whitelist for `token`\"},\"tryGetExtensiveDistributionParameters((bytes32,address,address,uint256,address[],uint32[],uint32,uint32,uint32,uint32,uint32,uint32,uint32,address,bytes))\":{\"notice\":\"Tries to fetch extra data about the parameters in a distribution\"},\"userSignatureWhitelist(address)\":{\"notice\":\"Maps a user to whether it is whitelisted for not signing\"},\"userSignatures(address)\":{\"notice\":\"Maps an address to the last valid hash signed\"}},\"notice\":\"Manages the distribution of rewards across different pools with concentrated liquidity (like on Uniswap V3)\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/DistributionCreator.sol\":\"DistributionCreator\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":100},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts-upgradeable/interfaces/draft-IERC1822Upgradeable.sol\":{\"keccak256\":\"0x77c89f893e403efc6929ba842b7ccf6534d4ffe03afe31670b4a528c0ad78c0f\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://496bd9b3df2455d571018c09f0c6badd29713fdeb907c6aa09d8d28cb603f053\",\"dweb:/ipfs/QmXdJDyYs6WMwMh21dez2BYPxhSUaUYFMDtVNcn2cgFR79\"]},\"@openzeppelin/contracts-upgradeable/proxy/ERC1967/ERC1967UpgradeUpgradeable.sol\":{\"keccak256\":\"0x315887e846f1e5f8d8fa535a229d318bb9290aaa69485117f1ee8a9a6b3be823\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://29dda00da6d269685b555e710e4abf1c3eb6d00c15b888a7880a2f8dd3c4fdc2\",\"dweb:/ipfs/QmSqcjtdECygtT1Gy7uEo42x8542srpgGEeKKHfcnQqXgn\"]},\"@openzeppelin/contracts-upgradeable/proxy/beacon/IBeaconUpgradeable.sol\":{\"keccak256\":\"0x24b86ac8c005b8c654fbf6ac34a5a4f61580d7273541e83e013e89d66fbf0908\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://4dbfe1a3b3b3fb64294ce41fd2ad362e7b7012208117864f42c1a67620a6d5c1\",\"dweb:/ipfs/QmVMU5tWt7zBQMmf5cpMX8UMHV86T3kFeTxBTBjFqVWfoJ\"]},\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\":{\"keccak256\":\"0x037c334add4b033ad3493038c25be1682d78c00992e1acb0e2795caff3925271\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://8a313cf42389440e2706837c91370323b85971c06afd6d056d21e2bc86459618\",\"dweb:/ipfs/QmT8XUrUvQ9aZaPKrqgRU2JVGWnaxBcUYJA7Q7K5KcLBSZ\"]},\"@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol\":{\"keccak256\":\"0x7967d130887c4b40666cd88f8744691d4527039a1b2a38aa0de41481ef646778\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://40e60cbf0e2efede4d9c169e66336a64615af7b719a896ef1f37ae8cd4614ec1\",\"dweb:/ipfs/QmYNiwY22ifhfa8yK6mLCEKfj39caYUHLqe2VBtzDnvdsV\"]},\"@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol\":{\"keccak256\":\"0x2b3005a0064cfc558bdf64b2bae94b565f4574a536aadd61c13838d4f2157790\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://622c3eb87563e71585c9f538d1a196fe2d154dcc5b8f335e8770a8acc95e1f3a\",\"dweb:/ipfs/QmSnDqJJLzv3mirjGB1vrk5X7hegFdS7BKpscpxyqj7sWu\"]},\"@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol\":{\"keccak256\":\"0x2edcb41c121abc510932e8d83ff8b82cf9cdde35e7c297622f5c29ef0af25183\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://72460c66cd1c3b1c11b863e0d8df0a1c56f37743019e468dc312c754f43e3b06\",\"dweb:/ipfs/QmPExYKiNb9PUsgktQBupPaM33kzDHxaYoVeJdLhv8s879\"]},\"@openzeppelin/contracts-upgradeable/utils/StorageSlotUpgradeable.sol\":{\"keccak256\":\"0x09864aea84f01e39313375b5610c73a3c1c68abbdc51e5ccdd25ff977fdadf9a\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://aedb48081190fa828d243529ce25c708202c7d4ccfe99f0e4ecd6bc0cfcd03f3\",\"dweb:/ipfs/QmWyiDQHPZA56iqsAwTmiJoxvNeRQLUVr4gTfzpdpXivpo\"]},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"keccak256\":\"0x9750c6b834f7b43000631af5cc30001c5f547b3ceb3635488f140f60e897ea6b\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://5a7d5b1ef5d8d5889ad2ed89d8619c09383b80b72ab226e0fe7bde1636481e34\",\"dweb:/ipfs/QmebXWgtEfumQGBdVeM6c71McLixYXQP5Bk6kKXuoY4Bmr\"]},\"@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol\":{\"keccak256\":\"0x8de418a5503946cabe331f35fe242d3201a73f67f77aaeb7110acb1f30423aca\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://5a376d3dda2cb70536c0a45c208b29b34ac560c4cb4f513a42079f96ba47d2dd\",\"dweb:/ipfs/QmZQg6gn1sUpM8wHzwNvSnihumUCAhxD119MpXeKp8B9s8\"]},\"@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol\":{\"keccak256\":\"0xf41ca991f30855bf80ffd11e9347856a517b977f0a6c2d52e6421a99b7840329\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://b2717fd2bdac99daa960a6de500754ea1b932093c946388c381da48658234b95\",\"dweb:/ipfs/QmP6QVMn6UeA3ByahyJbYQr5M6coHKBKsf3ySZSfbyA8R7\"]},\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\":{\"keccak256\":\"0x9b72f93be69ca894d8492c244259615c4a742afc8d63720dbc8bb81087d9b238\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://f5a7b96e511be78d5cdf635c784e6ab8cdd38625bb8cafb8a80914a1c89cf0f6\",\"dweb:/ipfs/QmVzTCwJxQAkjRQHboT5QrvsVJGWQHgfEjeTbvyxoKBrds\"]},\"@openzeppelin/contracts/utils/Address.sol\":{\"keccak256\":\"0xf96f969e24029d43d0df89e59d365f277021dac62b48e1c1e3ebe0acdd7f1ca1\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://ec772b45a624be516f1c81970caa8a2e144301e9d0921cbc1a2789fef39a1269\",\"dweb:/ipfs/QmNyjwxCrGhQMyzLD93oUobJXVe9ceJvRvfXwbEtuxPiEj\"]},\"@openzeppelin/contracts/utils/Strings.sol\":{\"keccak256\":\"0xa4d1d62251f8574deb032a35fc948386a9b4de74b812d4f545a1ac120486b48a\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://8c969013129ba9e651a20735ef659fef6d8a1139ea3607bd4b26ddea2d645634\",\"dweb:/ipfs/QmVhVa6LGuzAcB8qgDtVHRkucn4ihj5UZr8xBLcJkP6ucb\"]},\"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\":{\"keccak256\":\"0xda898fa084aa1ddfdb346e6a40459e00a59d87071cce7c315a46d648dd71d0ba\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://ce501a941f4aa1555c04dabb5e07992503bb6a9b32ff8f7cdcefdb4a742210cb\",\"dweb:/ipfs/QmeScPrUpdrGYs9BytV3Z5ZWJcBXtuAgCW4BLHua4xFUxx\"]},\"@openzeppelin/contracts/utils/math/Math.sol\":{\"keccak256\":\"0xa1e8e83cd0087785df04ac79fb395d9f3684caeaf973d9e2c71caef723a3a5d6\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://33bbf48cc069be677705037ba7520c22b1b622c23b33e1a71495f2d36549d40b\",\"dweb:/ipfs/Qmct36zWXv3j7LZB83uwbg7TXwnZSN1fqHNDZ93GG98bGz\"]},\"contracts/DistributionCreator.sol\":{\"keccak256\":\"0x6206a0425bde62264e0e250a94e72ff6145f79ce0eeb6cd33cb279536a40d336\",\"license\":\"BUSL-1.1\",\"urls\":[\"bzz-raw://7f8f4f7ce914408ce1aa8332bfae69a9f5f3a9f7e5eec1e2941a11f2a093891d\",\"dweb:/ipfs/QmUEPRnwZs3sVqt9tZnreR4ucHwSpWQY7f8qoEjUfX4hK6\"]},\"contracts/interfaces/ICore.sol\":{\"keccak256\":\"0x11e92b745193d16934aaeb873c0388041dce2ef3e359a9c3315b668b05903100\",\"license\":\"GPL-3.0\",\"urls\":[\"bzz-raw://2958b2c0b9b0365a3ddf0d39c3623c4b41cf9d1797d4aeee3bfd02ad255692d9\",\"dweb:/ipfs/QmUkyhLEfW3YfVKcnZ3CxBQj33EdBKsx5rijkezNmGVALL\"]},\"contracts/interfaces/external/uniswap/IUniswapV3Pool.sol\":{\"keccak256\":\"0x7035bcab3bfd00a984c1bedd1f78a6cd358a423a60f40666837b740dd2f73fe1\",\"license\":\"GPL-3.0\",\"urls\":[\"bzz-raw://3bbeeb4bd1317b6f1f1600e8b34960d41e91175c0008fb54eb5d15bef66b5b4f\",\"dweb:/ipfs/QmWtDrwF9WDMWbZCGTrXnk4yqynE9Pa1Zg3Ari1h4bbH5W\"]},\"contracts/struct/DistributionParameters.sol\":{\"keccak256\":\"0x9016781bc2054ab54b6efa88c63b029e916d32c747eb68797a0d2e1e87c32a17\",\"license\":\"BUSL-1.1\",\"urls\":[\"bzz-raw://284bd75af1c924723af7b2a21f5dc464477502b3fcde86e0077c6e9ace0a9007\",\"dweb:/ipfs/QmdCwWGQRhwkB8WjUG26TAtb5oqWmrBztqfVATZ4t8C75e\"]},\"contracts/struct/ExtensiveDistributionParameters.sol\":{\"keccak256\":\"0xeef63ebff3bb084f84a40268b06ab2788a161e5da92e0fdaac01658cc017939a\",\"license\":\"BUSL-1.1\",\"urls\":[\"bzz-raw://5872b78b62038a41f3e26384ed3e5d81941410177f16cd61fc752d6cb9889c82\",\"dweb:/ipfs/QmaACJ2SNNUtwFer3EqyG3nVSvD7rDZjjnJfp2FpwJ48oV\"]},\"contracts/struct/RewardTokenAmounts.sol\":{\"keccak256\":\"0x76b12fb56b989673bcead693bc7d925f21b8ab3b9c5e900fe8e8b42d85286f1d\",\"license\":\"BUSL-1.1\",\"urls\":[\"bzz-raw://f1f2c214dba600b041f9cb380350caa391213beada03b549b3e95c0ac3cb17ca\",\"dweb:/ipfs/QmR3deQ7bd1Ys3YQpF7DVkduNVMv3naKnkALepNaxqD1ih\"]},\"contracts/utils/Errors.sol\":{\"keccak256\":\"0x7cd16f5988dee579532a71ff4afd8668c75add546e7e4724c1aaadd888355139\",\"license\":\"GPL-3.0\",\"urls\":[\"bzz-raw://b3cbf955071047ef422c3d4107e3dc0dc2459e3de14d434c069b502cae4c578c\",\"dweb:/ipfs/QmcutpxLceyCRUg8E3krJnn1oKdbp71RpQb63onPT3Akym\"]},\"contracts/utils/UUPSHelper.sol\":{\"keccak256\":\"0xb8011db6d148c8a111678c8074343c82114b923806aee0f60c48ed05f8bd6c40\",\"license\":\"GPL-3.0\",\"urls\":[\"bzz-raw://50c3ecca8c5e46c57a3abc32bb4e74c5983f83722842018715ced14b68528efd\",\"dweb:/ipfs/QmYBTwe1sCieZ3nBLUc3zq1x78rBB9rRDVo9LSDnMTySdv\"]}},\"version\":1}", + "bytecode": "0x60a0604052306080523480156200001557600080fd5b50600054610100900460ff1615808015620000375750600054600160ff909116105b8062000067575062000054306200022060201b620025051760201c565b15801562000067575060005460ff166001145b620000bf5760405162461bcd60e51b815260206004820152602e6024820152600080516020620059fb83398151915260448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084015b60405180910390fd5b6000805460ff191660011790558015620000e3576000805461ff0019166101001790555b801562000119576000805461ff00191690556040516001815260008051602062005a1b8339815191529060200160405180910390a15b50600054610100900460ff16158080156200013b5750600054600160ff909116105b806200016b575062000158306200022060201b620025051760201c565b1580156200016b575060005460ff166001145b620001bf5760405162461bcd60e51b815260206004820152602e6024820152600080516020620059fb83398151915260448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401620000b6565b6000805460ff191660011790558015620001e3576000805461ff0019166101001790555b801562000219576000805461ff00191690556040516001815260008051602062005a1b8339815191529060200160405180910390a15b506200022f565b6001600160a01b03163b151590565b608051615794620002676000396000818161121501528181611255015281816114da0152818161151a015261159601526157946000f3fe6080604052600436106102ca5760003560e01c80637bb7bed11161017b578063b9d81abc116100d7578063e1394f7d11610085578063e1394f7d14610922578063e21f37ce14610942578063e74b981b14610964578063f2f4eb2614610984578063f6e6bb62146109a4578063fb1d2329146109c4578063feba1ed2146109e457600080fd5b8063b9d81abc1461080e578063ba5c3a9d1461082e578063bfe1092814610867578063c14007a014610887578063c53e7dab146108b5578063d0ff94b2146108d5578063d7fa5625146108f557600080fd5b80639af1d35a116101345780639af1d35a14610720578063a218404014610736578063a2686e2314610756578063a70b9f0c14610776578063aa529617146107a1578063ab37f486146107c1578063ae23bf28146107ee57600080fd5b80637bb7bed1146106445780637ecebe00146106645780638a4bd4b21461069157806392ccb581146106b157806395d3d5d8146106d157806396b3ce54146106f357600080fd5b80633d18678e1161022a57806358beb884116101e357806358beb8841461055d5780636c1550b11461057d5780636cca84bd146105aa578063734e7fb9146105ca578063752e8749146105ea57806376cd7cbc146106025780637b74691e1461062257600080fd5b80633d18678e146104a857806346904840146104c85780634d5aedbf146104f55780634f1ef2861461051557806352d1902d14610528578063586db1f51461053d57600080fd5b806317418a221161028757806317418a22146103c25780631794bb3c146103d75780632acd7ec4146103f7578063304440171461043257806334f150b7146104485780633659cfe614610468578063368b87721461048857600080fd5b80630241d8f9146102cf57806303d2944c146102f15780630db38252146103115780630f44380d146103475780631136b89514610374578063141df503146103a2575b600080fd5b3480156102db57600080fd5b506102ef6102ea366004613f96565b610a11565b005b3480156102fd57600080fd5b506102ef61030c366004613fc2565b610af8565b34801561031d57600080fd5b5061033161032c36600461436e565b610bf7565b60405161033e919061466d565b60405180910390f35b34801561035357600080fd5b50610367610362366004614680565b610e2e565b60405161033e91906146f2565b34801561038057600080fd5b5061039461038f366004614705565b610e56565b60405161033e929190614750565b3480156103ae57600080fd5b506102ef6103bd3660046147b6565b610e8c565b3480156103ce57600080fd5b50610367611003565b3480156103e357600080fd5b506102ef6103f2366004614801565b611030565b34801561040357600080fd5b50610424610412366004613fc2565b60a36020526000908152604090205481565b60405190815260200161033e565b34801561043e57600080fd5b50610424609c5481565b34801561045457600080fd5b50610394610463366004614842565b6111dc565b34801561047457600080fd5b506102ef610483366004613fc2565b61120b565b34801561049457600080fd5b506102ef6104a336600461487b565b6112d3565b3480156104b457600080fd5b506102ef6104c33660046148c3565b6113b8565b3480156104d457600080fd5b506099546104e8906001600160a01b031681565b60405161033e91906148dc565b34801561050157600080fd5b506103946105103660046148f0565b6114a5565b6102ef61052336600461494c565b6114d0565b34801561053457600080fd5b50610424611589565b34801561054957600080fd5b5061039461055836600461499b565b611637565b34801561056957600080fd5b506104246105783660046149fd565b611659565b34801561058957600080fd5b5061059d610598366004614a65565b611678565b60405161033e9190614b15565b3480156105b657600080fd5b506102ef6105c5366004613fc2565b6117a1565b3480156105d657600080fd5b506103676105e5366004614842565b6118a4565b3480156105f657600080fd5b50610424633b9aca0081565b34801561060e57600080fd5b506102ef61061d366004614b59565b6118c5565b34801561062e57600080fd5b506106376118cf565b60405161033e9190614b9a565b34801561065057600080fd5b506104e861065f3660046148c3565b611b52565b34801561067057600080fd5b5061042461067f366004613fc2565b60a06020526000908152604090205481565b34801561069d57600080fd5b506103676106ac366004613fc2565b611b7c565b3480156106bd57600080fd5b506103946106cc366004614bfc565b611b9c565b3480156106dd57600080fd5b506106e6611bbd565b60405161033e9190614c1c565b3480156106ff57600080fd5b5061042461070e366004613fc2565b60a16020526000908152604090205481565b34801561072c57600080fd5b50610424609a5481565b34801561074257600080fd5b506102ef610751366004614c67565b611cde565b34801561076257600080fd5b506102ef610771366004613fc2565b611f30565b34801561078257600080fd5b5061078c610e1081565b60405163ffffffff909116815260200161033e565b3480156107ad57600080fd5b506103946107bc3660046148f0565b612033565b3480156107cd57600080fd5b506104246107dc366004613fc2565b609f6020526000908152604090205481565b3480156107fa57600080fd5b50610367610809366004614cd2565b612062565b34801561081a57600080fd5b5061042461082936600461436e565b61208b565b34801561083a57600080fd5b5061084e6108493660046148c3565b61211c565b60405161033e9d9c9b9a99989796959493929190614cf0565b34801561087357600080fd5b506098546104e8906001600160a01b031681565b34801561089357600080fd5b506108a76108a236600461436e565b612249565b60405161033e929190614d9c565b3480156108c157600080fd5b506103946108d0366004614db7565b612323565b3480156108e157600080fd5b506103676108f0366004614cd2565b612342565b34801561090157600080fd5b50610424610910366004613fc2565b60a26020526000908152604090205481565b34801561092e57600080fd5b5061036761093d366004614680565b612351565b34801561094e57600080fd5b50610957612372565b60405161033e9190614e28565b34801561097057600080fd5b506102ef61097f366004613fc2565b612400565b34801561099057600080fd5b506097546104e8906001600160a01b031681565b3480156109b057600080fd5b506103946109bf366004614705565b6124d8565b3480156109d057600080fd5b506103676109df366004614bfc565b6124f6565b3480156109f057600080fd5b506104246109ff366004613fc2565b609e6020526000908152604090205481565b60975460405163521d4de960e01b81526001600160a01b039091169063521d4de990610a419033906004016148dc565b602060405180830381865afa158015610a5e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a829190614e4b565b610a9f57604051632678482f60e21b815260040160405180910390fd5b6001600160a01b0382166000818152609e602052604090819020839055517fab1d37d0b21937f334fc4164d147abbfdbfd7ef37ab9ea0ae73f2a58ffb7f1cc90610aec9084815260200190565b60405180910390a25050565b60975460405163521d4de960e01b81526001600160a01b039091169063521d4de990610b289033906004016148dc565b602060405180830381865afa158015610b45573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b699190614e4b565b610b8657604051632678482f60e21b815260040160405180910390fd5b6001600160a01b038116610bad57604051633494a40d60e21b815260040160405180910390fd5b609880546001600160a01b0319166001600160a01b0383169081179091556040517fc0ebb188f905d128bcd7e4282dd1f9cf24cd331b69071002e488349aca6a867b90600090a250565b610bff613d6c565b81816000018190525081602001516001600160a01b031663ddca3f436040518163ffffffff1660e01b8152600401602060405180830381865afa925050508015610c66575060408051601f3d908101601f19168201909252610c6391810190614e79565b60015b610c765760006020820152610c81565b62ffffff1660208201525b610cf482602001516001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa158015610cc6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cea9190614e9f565b8360200151612514565b8160400181905250610d4182602001516001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa158015610cc6573d6000803e3d6000fd5b816060018190525081604001516001600160a01b03166395d89b416040518163ffffffff1660e01b8152600401600060405180830381865afa158015610d8b573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610db39190810190614f01565b816080018190525081604001516001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015610dfd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e219190614f46565b60ff1660a0820152919050565b6060610e4f6000610e3e8461267c565b63ffffffff600063ffffffff612695565b5092915050565b6060600080610e648661267c565b9050610e7f600082610e78610e1082614f77565b8888612695565b9250925050935093915050565b60975460405163521d4de960e01b81526001600160a01b039091169063521d4de990610ebc9033906004016148dc565b602060405180830381865afa158015610ed9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610efd9190614e4b565b610f1a57604051632678482f60e21b815260040160405180910390fd5b8160005b81811015610ffc57610ff483868684818110610f3c57610f3c614f94565b9050602002016020810190610f519190613fc2565b6001600160a01b03166370a08231306040518263ffffffff1660e01b8152600401610f7c91906148dc565b602060405180830381865afa158015610f99573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fbd9190614faa565b878785818110610fcf57610fcf614f94565b9050602002016020810190610fe49190613fc2565b6001600160a01b03169190612a9c565b600101610f1e565b5050505050565b606060006110104261267c565b9050610e4f600082611024610e1082614f77565b600063ffffffff612695565b600054610100900460ff16158080156110505750600054600160ff909116105b80611071575061105f30612505565b158015611071575060005460ff166001145b6110d95760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084015b60405180910390fd5b6000805460ff1916600117905580156110fc576000805461ff0019166101001790555b6001600160a01b038416158061111957506001600160a01b038316155b156111375760405163d92e233d60e01b815260040160405180910390fd5b633b9aca00821061115b57604051633494a40d60e21b815260040160405180910390fd5b609880546001600160a01b038086166001600160a01b0319928316179092556097805492871692909116919091179055609a82905580156111d6576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50505050565b60606000806111ea4261267c565b90506111fe600082610e78610e1082614f77565b92509250505b9250929050565b6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001630036112535760405162461bcd60e51b81526004016110d090614fc3565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316611285612b04565b6001600160a01b0316146112ab5760405162461bcd60e51b81526004016110d09061500f565b6112b481612b20565b604080516000808252602082019092526112d091839190612bc3565b50565b60975460405163521d4de960e01b81526001600160a01b039091169063521d4de9906113039033906004016148dc565b602060405180830381865afa158015611320573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113449190614e4b565b61136157604051632678482f60e21b815260040160405180910390fd5b609b61136d82826150db565b50600061137982612d2e565b609c8190556040518181529091507fde3dc3335dea4d1a1060ef6cefcfcc109eb0a1e78ce151818d3f17a01e1f8a059060200160405180910390a15050565b60975460405163521d4de960e01b81526001600160a01b039091169063521d4de9906113e89033906004016148dc565b602060405180830381865afa158015611405573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114299190614e4b565b61144657604051632678482f60e21b815260040160405180910390fd5b633b9aca00811061146a57604051633494a40d60e21b815260040160405180910390fd5b609a8190556040518181527f3346af6da1932164d501f2ec28f8c5d686db5828a36b77f2da4332d89184fe7b9060200160405180910390a150565b606060006114c2866114b68761267c565b63ffffffff8787612695565b915091505b94509492505050565b6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001630036115185760405162461bcd60e51b81526004016110d090614fc3565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031661154a612b04565b6001600160a01b0316146115705760405162461bcd60e51b81526004016110d09061500f565b61157982612b20565b61158582826001612bc3565b5050565b6000306001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146116245760405162461bcd60e51b815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c6044820152771b1959081d1a1c9bdd59da0819195b1959d85d1958d85b1b60421b60648201526084016110d0565b5060008051602061571883398151915290565b606060006114c260006116498861267c565b6116528861267c565b8787612695565b60006116658383612d69565b61166e84612e25565b90505b9392505050565b33600090815260a260205260409020546060901580156116a95750609c5433600090815260a1602052604090205414155b80156116c2575032600090815260a26020526040902054155b80156116df5750609c5432600090815260a1602052604090205414155b156116fd576040516314e52a5b60e31b815260040160405180910390fd5b81516000816001600160401b0381111561171957611719613fdf565b604051908082528060200260200182016040528015611742578160200160208202803683370190505b50905060005b828110156117975761177285828151811061176557611765614f94565b6020026020010151612e25565b82828151811061178457611784614f94565b6020908102919091010152600101611748565b509150505b919050565b60975460405163521d4de960e01b81526001600160a01b039091169063521d4de9906117d19033906004016148dc565b602060405180830381865afa1580156117ee573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118129190614e4b565b61182f57604051632678482f60e21b815260040160405180910390fd5b6001600160a01b0381166000908152609f602052604081205461185390600161519a565b6001600160a01b0383166000818152609f60205260409081902083905551919250907fc6cd32b1acffa550abf886a9b443ff3ce485bfdb05e35ef5b26e745739a1eac190610aec9084815260200190565b60606118bd60006118b48561267c565b6110248561267c565b509392505050565b6115858282612d69565b6060609d805480602002602001604051908101604052809291908181526020016000905b82821015611b49576000848152602090819020604080516101e081018252600986029092018054835260018101546001600160a01b039081168486015260028201541683830152600381015460608401526004810180548351818702810187019094528084529394919360808601939283018282801561199c57602002820191906000526020600020905b81546001600160a01b0316815260019091019060200180831161197e575b5050505050815260200160058201805480602002602001604051908101604052809291908181526020018280548015611a2057602002820191906000526020600020906000905b82829054906101000a900463ffffffff1663ffffffff16815260200190600401906020826003010492830192600103820291508084116119e35790505b5050509183525050600682015463ffffffff8082166020840152600160201b820481166040840152600160401b820481166060840152600160601b820481166080840152600160801b8204811660a0840152600160a01b8204811660c0840152600160c01b9091041660e082015260078201546001600160a01b031661010082015260088201805461012090920191611ab89061505b565b80601f0160208091040260200160405190810160405280929190818152602001828054611ae49061505b565b8015611b315780601f10611b0657610100808354040283529160200191611b31565b820191906000526020600020905b815481529060010190602001808311611b1457829003601f168201915b505050505081525050815260200190600101906118f3565b50505050905090565b60a48181548110611b6257600080fd5b6000918252602090912001546001600160a01b0316905081565b60606000611b894261267c565b90506117978382611024610e1082614f77565b6060600080611baa4261267c565b9050610e7f8682610e78610e1082614f77565b60a45460609060009081816001600160401b03811115611bdf57611bdf613fdf565b604051908082528060200260200182016040528015611c2457816020015b6040805180820190915260008082526020820152815260200190600190039081611bfd5790505b50905060005b828163ffffffff161015611cd457600060a48263ffffffff1681548110611c5357611c53614f94565b60009182526020808320909101546001600160a01b031680835260a39091526040909120549091508015611cca576040518060400160405280836001600160a01b0316815260200182815250848781518110611cb157611cb1614f94565b6020908102919091010152611cc76001876151ad565b95505b5050600101611c2a565b5091825250919050565b60975460405163521d4de960e01b81526001600160a01b039091169063521d4de990611d0e9033906004016148dc565b602060405180830381865afa158015611d2b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d4f9190614e4b565b611d6c57604051632678482f60e21b815260040160405180910390fd5b82818114611d8d57604051631df89e8b60e01b815260040160405180910390fd5b60005b81811015611f28576000848483818110611dac57611dac614f94565b905060200201359050600081118015611e07575060a36000888885818110611dd657611dd6614f94565b9050602002016020810190611deb9190613fc2565b6001600160a01b03168152602081019190915260400160002054155b15611e685760a4878784818110611e2057611e20614f94565b9050602002016020810190611e359190613fc2565b81546001810183556000928352602090922090910180546001600160a01b0319166001600160a01b039092169190911790555b8060a36000898986818110611e7f57611e7f614f94565b9050602002016020810190611e949190613fc2565b6001600160a01b03168152602081019190915260400160002055868683818110611ec057611ec0614f94565b9050602002016020810190611ed59190613fc2565b6001600160a01b03167f3a5e6418e38cae10bf66eaf3e68c4e9c6b14df195e24fec169ab3a5b123c96e582604051611f0f91815260200190565b60405180910390a250611f21816151c0565b9050611d90565b505050505050565b60975460405163521d4de960e01b81526001600160a01b039091169063521d4de990611f609033906004016148dc565b602060405180830381865afa158015611f7d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fa19190614e4b565b611fbe57604051632678482f60e21b815260040160405180910390fd5b6001600160a01b038116600090815260a26020526040812054611fe290600161519a565b6001600160a01b038316600081815260a260205260409081902083905551919250907f9c759941da0b7ce56c059c1497218796e62035024afb77a00ff49a980a62078f90610aec9084815260200190565b60606000806120418661267c565b90506120548782610e78610e1082614f77565b925092505094509492505050565b6060600061206f8361267c565b90506120828482611024610e1082614f77565b50949350505050565b33600090815260a260205260408120541580156120b95750609c5433600090815260a1602052604090205414155b80156120d2575032600090815260a26020526040902054155b80156120ef5750609c5432600090815260a1602052604090205414155b1561210d576040516314e52a5b60e31b815260040160405180910390fd5b61211682612e25565b92915050565b609d818154811061212c57600080fd5b600091825260209091206009909102018054600182015460028301546003840154600685015460078601546008870180549698506001600160a01b039586169794861696939563ffffffff80851696600160201b8604821696600160401b8704831696600160601b8104841696600160801b8204851696600160a01b8304861696600160c01b90930490951694911692916121c69061505b565b80601f01602080910402602001604051908101604052809291908181526020018280546121f29061505b565b801561223f5780601f106122145761010080835404028352916020019161223f565b820191906000526020600020905b81548152906001019060200180831161222257829003601f168201915b505050505090508d565b6000612253613d6c565b600080306001600160a01b0316630db3825260e01b8660405160240161227991906151d9565b60408051601f198184030181529181526020820180516001600160e01b03166001600160e01b03199094169390931790925290516122b791906151ec565b600060405180830381855af49150503d80600081146122f2576040519150601f19603f3d011682016040523d82523d6000602084013e6122f7565b606091505b5091509150819350831561231c578080602001905181019061231991906155a3565b92505b5050915091565b60606000612334876116498861267c565b915091509550959350505050565b60606118bd83610e3e8461267c565b6060600061235e8361267c565b9050611797600082611024610e1082614f77565b609b805461237f9061505b565b80601f01602080910402602001604051908101604052809291908181526020018280546123ab9061505b565b80156123f85780601f106123cd576101008083540402835291602001916123f8565b820191906000526020600020905b8154815290600101906020018083116123db57829003601f168201915b505050505081565b60975460405163521d4de960e01b81526001600160a01b039091169063521d4de9906124309033906004016148dc565b602060405180830381865afa15801561244d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124719190614e4b565b61248e57604051632678482f60e21b815260040160405180910390fd5b609980546001600160a01b0319166001600160a01b0383169081179091556040517f7a7b5a0a132f9e0581eb8527f66eae9ee89c2a3e79d4ac7e41a1f1f4d48a7fc290600090a250565b606060006124ea60006114b68761267c565b91509150935093915050565b6060612082846118b48561267c565b6001600160a01b03163b151590565b61251c613e22565b6001600160a01b0383168082526040805163313ce56760e01b8152905163313ce567916004808201926020929091908290030181865afa158015612564573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125889190614f46565b60ff166020820152604080516395d89b4160e01b815290516001600160a01b038516916395d89b419160048083019260009291908290030181865afa1580156125d5573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526125fd9190810190614f01565b604080830191909152516370a0823160e01b81526001600160a01b038416906370a08231906126309085906004016148dc565b602060405180830381865afa15801561264d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126719190614faa565b606082015292915050565b6000610e1061268b81846155ed565b6121169190615610565b609d5460609060009081908163ffffffff861682106126ba578563ffffffff166126bc565b815b90506000816001600160401b038111156126d8576126d8613fdf565b60405190808252806020026020018201604052801561271157816020015b6126fe613d6c565b8152602001906001900390816126f65790505b509050875b838163ffffffff161015612a82576000609d8263ffffffff168154811061273f5761273f614f94565b6000918252602091829020604080516101e08101825260099093029091018054835260018101546001600160a01b03908116848601526002820154168383015260038101546060840152600481018054835181870281018701909452808452939491936080860193928301828280156127e157602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116127c3575b505050505081526020016005820180548060200260200160405190810160405280929190818152602001828054801561286557602002820191906000526020600020906000905b82829054906101000a900463ffffffff1663ffffffff16815260200190600401906020826003010492830192600103820291508084116128285790505b5050509183525050600682015463ffffffff8082166020840152600160201b820481166040840152600160401b820481166060840152600160601b820481166080840152600160801b8204811660a0840152600160a01b8204811660c0840152600160c01b9091041660e082015260078201546001600160a01b0316610100820152600882018054610120909201916128fd9061505b565b80601f01602080910402602001604051908101604052809291908181526020018280546129299061505b565b80156129765780601f1061294b57610100808354040283529160200191612976565b820191906000526020600020905b81548152906001019060200180831161295957829003601f168201915b505050505081525050905061298c818d8d613465565b80156129be57506001600160a01b038d1615806129be57508c6001600160a01b031681602001516001600160a01b0316145b15612a695760405163060a003d60e51b81526000908190309063c14007a0906129eb9086906004016151d9565b600060405180830381865afa158015612a08573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052612a309190810190615638565b915091508115612a665780858981518110612a4d57612a4d614f94565b6020908102919091010152612a636001896151ad565b97505b50505b816001019150838603612a7c5750612a82565b50612716565b9381529a63ffffffff909316995091975050505050505050565b6040516001600160a01b038316602482015260448101829052612aff90849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526134bb565b505050565b600080516020615718833981519152546001600160a01b031690565b6097546001600160a01b03168015801590612ba5575060405163521d4de960e01b81526001600160a01b0382169063521d4de990612b629033906004016148dc565b602060405180830381865afa158015612b7f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612ba39190614e4b565b155b1561158557604051632678482f60e21b815260040160405180910390fd5b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff1615612bf657612aff8361358d565b826001600160a01b03166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa925050508015612c50575060408051601f3d908101601f19168201909252612c4d91810190614faa565b60015b612cb35760405162461bcd60e51b815260206004820152602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201526d6f6e206973206e6f74205555505360901b60648201526084016110d0565b6000805160206157188339815191528114612d225760405162461bcd60e51b815260206004820152602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f786044820152681a58589b195555525160ba1b60648201526084016110d0565b50612aff838383613627565b6000612d3a825161364c565b82604051602001612d4c92919061567b565b604051602081830303815290604052805190602001209050919050565b609c54604080516020601f85018190048102820181019092528381523391612dad91849187908790819084018382808284376000920191909152506136de92505050565b6001600160a01b031614612dd457604051638baa579f60e01b815260040160405180910390fd5b33600081815260a1602052604090819020839055517fc48bbd4f009ad78a336beb65bf44688651e9aa52ac98d9054f0fce0573fefbc390612e189084815260200190565b60405180910390a2505050565b6000612e2f6136fa565b6000612e3f83610120015161267c565b6040808501516001600160a01b0316600090815260a3602052205463ffffffff821661012086015290915042612e77610e1084614f77565b63ffffffff161080612e92575061014084015163ffffffff16155b80612ec857508360e001518460c00151856101000151612eb29190614f77565b612ebc9190614f77565b63ffffffff1661271014155b80612ef757506101a08401516001600160a01b031615801590612ef7575061271084610180015163ffffffff16105b80612f0c57508360a001515184608001515114155b80612f15575080155b80612f3957508084610140015163ffffffff168560600151612f3791906156d6565b105b15612f57576040516314414f4160e11b815260040160405180910390fd5b6060840151336000908152609e6020526040902054909350633b9aca00811080156130035750609f600086602001516001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa158015612fc3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612fe79190614e9f565b6001600160a01b03168152602081019190915260400160002054155b80156130905750609f600086602001516001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa158015613050573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906130749190614e9f565b6001600160a01b03168152602081019190915260400160002054155b15613134576000633b9aca006130a6838261519a565b609a546130b391906156ea565b6130bd91906156d6565b90506000633b9aca006130d0838261519a565b6130da90886156ea565b6130e491906156d6565b6099549091506001600160a01b031680156130ff5780613101565b305b90506131283382613112858b61519a565b60408c01516001600160a01b0316929190613753565b50606087018190529450505b6098546040860151613155916001600160a01b039182169133911687613753565b33600090815260a060205260409020546131708160016151ad565b33600081815260a0602090815260409182902093909355516131b19284910160609290921b6bffffffffffffffffffffffff19168252601482015260340190565b60408051808303601f1901815291815281516020928301208852609d805460018101825560009190915288517fd26e832454299e9fabb89e0e5fffdc046d4e14431bc1bf607ffb2e8a1ddecf7b6009909202918201908155898401517fd26e832454299e9fabb89e0e5fffdc046d4e14431bc1bf607ffb2e8a1ddecf7c830180546001600160a01b03199081166001600160a01b0393841617909155938b01517fd26e832454299e9fabb89e0e5fffdc046d4e14431bc1bf607ffb2e8a1ddecf7d8401805490951691161790925560608901517fd26e832454299e9fabb89e0e5fffdc046d4e14431bc1bf607ffb2e8a1ddecf7e820155608089015180518a946132df937fd26e832454299e9fabb89e0e5fffdc046d4e14431bc1bf607ffb2e8a1ddecf7f01920190613e56565b5060a082015180516132fb916005840191602090910190613ebb565b5060c082015160068201805460e08501516101008601516101208701516101408801516101608901516101808a015163ffffffff98891667ffffffffffffffff1990971696909617600160201b958916959095029490941767ffffffffffffffff60401b1916600160401b9388169390930263ffffffff60601b191692909217600160601b918716919091021767ffffffffffffffff60801b1916600160801b9186169190910263ffffffff60a01b191617600160a01b918516919091021763ffffffff60c01b1916600160c01b93909116929092029190911790556101a08201516007820180546001600160a01b0319166001600160a01b039092169190911790556101c0820151600882019061341390826150db565b505050336001600160a01b03167f5280c74029ecceb35e4fecf34adee487fd5a9a3d6c8e70b7374a1c133370e83a8760405161344f91906151d9565b60405180910390a25050505061179c6001606555565b60008084610120015163ffffffff1690508363ffffffff16610e108661014001516134909190615610565b6134a09063ffffffff16836151ad565b1180156134b257508263ffffffff1681105b95945050505050565b6000613510826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661378b9092919063ffffffff16565b805190915015612aff578080602001905181019061352e9190614e4b565b612aff5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016110d0565b61359681612505565b6135f85760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b60648201526084016110d0565b60008051602061571883398151915280546001600160a01b0319166001600160a01b0392909216919091179055565b6136308361379a565b60008251118061363d5750805b15612aff576111d683836137da565b60606000613659836138c3565b60010190506000816001600160401b0381111561367857613678613fdf565b6040519080825280601f01601f1916602001820160405280156136a2576020820181803683370190505b5090508181016020015b600019016f181899199a1a9b1b9c1cb0b131b232b360811b600a86061a8153600a85049450846136ac57509392505050565b60008060006136ed858561399b565b915091506118bd816139dd565b60026065540361374c5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016110d0565b6002606555565b6040516001600160a01b03808516602483015283166044820152606481018290526111d69085906323b872dd60e01b90608401612ac8565b606061166e8484600085613b22565b6137a38161358d565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b60606137e583612505565b6138405760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b60648201526084016110d0565b600080846001600160a01b03168460405161385b91906151ec565b600060405180830381855af49150503d8060008114613896576040519150601f19603f3d011682016040523d82523d6000602084013e61389b565b606091505b50915091506134b2828260405180606001604052806027815260200161573860279139613bff565b60008072184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b83106139025772184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b830492506040015b6d04ee2d6d415b85acef8100000000831061392e576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc10000831061394c57662386f26fc10000830492506010015b6305f5e1008310613964576305f5e100830492506008015b612710831061397857612710830492506004015b6064831061398a576064830492506002015b600a83106121165760010192915050565b60008082516041036139d15760208301516040840151606085015160001a6139c587828585613c18565b94509450505050611204565b50600090506002611204565b60008160048111156139f1576139f1615701565b036139f95750565b6001816004811115613a0d57613a0d615701565b03613a555760405162461bcd60e51b815260206004820152601860248201527745434453413a20696e76616c6964207369676e617475726560401b60448201526064016110d0565b6002816004811115613a6957613a69615701565b03613ab65760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e6774680060448201526064016110d0565b6003816004811115613aca57613aca615701565b036112d05760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b60648201526084016110d0565b606082471015613b835760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016110d0565b600080866001600160a01b03168587604051613b9f91906151ec565b60006040518083038185875af1925050503d8060008114613bdc576040519150601f19603f3d011682016040523d82523d6000602084013e613be1565b606091505b5091509150613bf287838387613ccf565b925050505b949350505050565b60608315613c0e575081611671565b6116718383613d42565b6000806fa2a8918ca85bafe22016d0b997e4df60600160ff1b03831115613c4557506000905060036114c7565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015613c99573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116613cc2576000600192509250506114c7565b9660009650945050505050565b60608315613d3c578251600003613d3557613ce985612505565b613d355760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016110d0565b5081613bf7565b613bf783835b815115613d525781518083602001fd5b8060405162461bcd60e51b81526004016110d09190614e28565b604080516102a081018252600060c0820181815260e083018290526101008301829052610120830182905260606101408401819052610160840181905261018084018390526101a084018390526101c084018390526101e08401839052610200840183905261022084018390526102408401839052610260840183905261028084015282526020820152908101613e01613e22565b8152602001613e0e613e22565b815260606020820152600060409091015290565b604051806080016040528060006001600160a01b03168152602001600060ff16815260200160608152602001600081525090565b828054828255906000526020600020908101928215613eab579160200282015b82811115613eab57825182546001600160a01b0319166001600160a01b03909116178255602090920191600190910190613e76565b50613eb7929150613f61565b5090565b82805482825590600052602060002090600701600890048101928215613eab5791602002820160005b83821115613f2857835183826101000a81548163ffffffff021916908363ffffffff1602179055509260200192600401602081600301049283019260010302613ee4565b8015613f585782816101000a81549063ffffffff0219169055600401602081600301049283019260010302613f28565b5050613eb79291505b5b80821115613eb75760008155600101613f62565b6001600160a01b03811681146112d057600080fd5b803561179c81613f76565b60008060408385031215613fa957600080fd5b8235613fb481613f76565b946020939093013593505050565b600060208284031215613fd457600080fd5b813561167181613f76565b634e487b7160e01b600052604160045260246000fd5b6040516101e081016001600160401b038111828210171561401857614018613fdf565b60405290565b60405160c081016001600160401b038111828210171561401857614018613fdf565b604051601f8201601f191681016001600160401b038111828210171561406857614068613fdf565b604052919050565b60006001600160401b0382111561408957614089613fdf565b5060051b60200190565b600082601f8301126140a457600080fd5b813560206140b96140b483614070565b614040565b82815260059290921b840181019181810190868411156140d857600080fd5b8286015b848110156140fc5780356140ef81613f76565b83529183019183016140dc565b509695505050505050565b63ffffffff811681146112d057600080fd5b803561179c81614107565b600082601f83011261413557600080fd5b813560206141456140b483614070565b82815260059290921b8401810191818101908684111561416457600080fd5b8286015b848110156140fc57803561417b81614107565b8352918301918301614168565b60006001600160401b038211156141a1576141a1613fdf565b50601f01601f191660200190565b60006141bd6140b484614188565b90508281528383830111156141d157600080fd5b828260208301376000602084830101529392505050565b600082601f8301126141f957600080fd5b611671838335602085016141af565b60006101e0828403121561421b57600080fd5b614223613ff5565b90508135815261423560208301613f8b565b602082015261424660408301613f8b565b60408201526060820135606082015260808201356001600160401b038082111561426f57600080fd5b61427b85838601614093565b608084015260a084013591508082111561429457600080fd5b6142a085838601614124565b60a08401526142b160c08501614119565b60c08401526142c260e08501614119565b60e084015261010091506142d7828501614119565b8284015261012091506142eb828501614119565b8284015261014091506142ff828501614119565b828401526101609150614313828501614119565b828401526101809150614327828501614119565b828401526101a0915061433b828501613f8b565b828401526101c09150818401358181111561435557600080fd5b614361868287016141e8565b8385015250505092915050565b60006020828403121561438057600080fd5b81356001600160401b0381111561439657600080fd5b613bf784828501614208565b600081518084526020808501945080840160005b838110156143db5781516001600160a01b0316875295820195908201906001016143b6565b509495945050505050565b600081518084526020808501945080840160005b838110156143db57815163ffffffff16875295820195908201906001016143fa565b60005b8381101561443757818101518382015260200161441f565b50506000910152565b6000815180845261445881602086016020860161441c565b601f01601f19169290920160200192915050565b60006101e082518452602083015161448f60208601826001600160a01b03169052565b5060408301516144aa60408601826001600160a01b03169052565b506060830151606085015260808301518160808601526144cc828601826143a2565b91505060a083015184820360a08601526144e682826143e6565b91505060c083015161450060c086018263ffffffff169052565b5060e083015161451860e086018263ffffffff169052565b506101008381015163ffffffff9081169186019190915261012080850151821690860152610140808501518216908601526101608085015182169086015261018080850151909116908501526101a0808401516001600160a01b0316908501526101c080840151858303828701526145908382614440565b9695505050505050565b60018060a01b03815116825260ff602082015116602083015260006040820151608060408501526145ce6080850182614440565b606093840151949093019390935250919050565b6000815160c084526145f760c085018261446c565b905062ffffff60208401511660208501526040830151848203604086015261461f828261459a565b91505060608301518482036060860152614639828261459a565b915050608083015184820360808601526146538282614440565b91505060ff60a08401511660a08501528091505092915050565b60208152600061167160208301846145e2565b60006020828403121561469257600080fd5b813561167181614107565b600081518084526020808501808196508360051b8101915082860160005b858110156146e55782840389526146d38483516145e2565b988501989350908401906001016146bb565b5091979650505050505050565b602081526000611671602083018461469d565b60008060006060848603121561471a57600080fd5b833561472581614107565b9250602084013561473581614107565b9150604084013561474581614107565b809150509250925092565b604081526000614763604083018561469d565b90508260208301529392505050565b60008083601f84011261478457600080fd5b5081356001600160401b0381111561479b57600080fd5b6020830191508360208260051b850101111561120457600080fd5b6000806000604084860312156147cb57600080fd5b83356001600160401b038111156147e157600080fd5b6147ed86828701614772565b909450925050602084013561474581613f76565b60008060006060848603121561481657600080fd5b833561482181613f76565b9250602084013561483181613f76565b929592945050506040919091013590565b6000806040838503121561485557600080fd5b823561486081614107565b9150602083013561487081614107565b809150509250929050565b60006020828403121561488d57600080fd5b81356001600160401b038111156148a357600080fd5b8201601f810184136148b457600080fd5b613bf7848235602084016141af565b6000602082840312156148d557600080fd5b5035919050565b6001600160a01b0391909116815260200190565b6000806000806080858703121561490657600080fd5b843561491181613f76565b9350602085013561492181614107565b9250604085013561493181614107565b9150606085013561494181614107565b939692955090935050565b6000806040838503121561495f57600080fd5b823561496a81613f76565b915060208301356001600160401b0381111561498557600080fd5b614991858286016141e8565b9150509250929050565b600080600080608085870312156149b157600080fd5b843561491181614107565b60008083601f8401126149ce57600080fd5b5081356001600160401b038111156149e557600080fd5b60208301915083602082850101111561120457600080fd5b600080600060408486031215614a1257600080fd5b83356001600160401b0380821115614a2957600080fd5b614a3587838801614208565b94506020860135915080821115614a4b57600080fd5b50614a58868287016149bc565b9497909650939450505050565b60006020808385031215614a7857600080fd5b82356001600160401b0380821115614a8f57600080fd5b818501915085601f830112614aa357600080fd5b8135614ab16140b482614070565b81815260059190911b83018401908481019088831115614ad057600080fd5b8585015b83811015614b0857803585811115614aec5760008081fd5b614afa8b89838a0101614208565b845250918601918601614ad4565b5098975050505050505050565b6020808252825182820181905260009190848201906040850190845b81811015614b4d57835183529284019291840191600101614b31565b50909695505050505050565b60008060208385031215614b6c57600080fd5b82356001600160401b03811115614b8257600080fd5b614b8e858286016149bc565b90969095509350505050565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b82811015614bef57603f19888603018452614bdd85835161446c565b94509285019290850190600101614bc1565b5092979650505050505050565b600080600060608486031215614c1157600080fd5b833561472581613f76565b602080825282518282018190526000919060409081850190868401855b828110156146e557815180516001600160a01b03168552860151868501529284019290850190600101614c39565b60008060008060408587031215614c7d57600080fd5b84356001600160401b0380821115614c9457600080fd5b614ca088838901614772565b90965094506020870135915080821115614cb957600080fd5b50614cc687828801614772565b95989497509550505050565b60008060408385031215614ce557600080fd5b823561486081613f76565b8d81526001600160a01b038d811660208301528c166040820152606081018b905263ffffffff8a8116608083015289811660a0830152881660c0820152600063ffffffff881660e083015263ffffffff871661010083015263ffffffff861661012083015263ffffffff85166101408301526001600160a01b0384166101608301526101a0610180830152614d896101a0830184614440565b9f9e505050505050505050505050505050565b821515815260406020820152600061166e60408301846145e2565b600080600080600060a08688031215614dcf57600080fd5b8535614dda81613f76565b94506020860135614dea81614107565b93506040860135614dfa81614107565b92506060860135614e0a81614107565b91506080860135614e1a81614107565b809150509295509295909350565b6020815260006116716020830184614440565b8051801515811461179c57600080fd5b600060208284031215614e5d57600080fd5b61167182614e3b565b805162ffffff8116811461179c57600080fd5b600060208284031215614e8b57600080fd5b61167182614e66565b805161179c81613f76565b600060208284031215614eb157600080fd5b815161167181613f76565b600082601f830112614ecd57600080fd5b8151614edb6140b482614188565b818152846020838601011115614ef057600080fd5b613bf782602083016020870161441c565b600060208284031215614f1357600080fd5b81516001600160401b03811115614f2957600080fd5b613bf784828501614ebc565b805160ff8116811461179c57600080fd5b600060208284031215614f5857600080fd5b61167182614f35565b634e487b7160e01b600052601160045260246000fd5b63ffffffff818116838216019080821115610e4f57610e4f614f61565b634e487b7160e01b600052603260045260246000fd5b600060208284031215614fbc57600080fd5b5051919050565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b19195b1959d85d1958d85b1b60a21b606082015260800190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b6163746976652070726f787960a01b606082015260800190565b600181811c9082168061506f57607f821691505b60208210810361508f57634e487b7160e01b600052602260045260246000fd5b50919050565b601f821115612aff57600081815260208120601f850160051c810160208610156150bc5750805b601f850160051c820191505b81811015611f28578281556001016150c8565b81516001600160401b038111156150f4576150f4613fdf565b61510881615102845461505b565b84615095565b602080601f83116001811461513d57600084156151255750858301515b600019600386901b1c1916600185901b178555611f28565b600085815260208120601f198616915b8281101561516c5788860151825594840194600190910190840161514d565b508582101561518a5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b8181038181111561211657612116614f61565b8082018082111561211657612116614f61565b6000600182016151d2576151d2614f61565b5060010190565b602081526000611671602083018461446c565b600082516151fe81846020870161441c565b9190910192915050565b600082601f83011261521957600080fd5b815160206152296140b483614070565b82815260059290921b8401810191818101908684111561524857600080fd5b8286015b848110156140fc57805161525f81613f76565b835291830191830161524c565b805161179c81614107565b600082601f83011261528857600080fd5b815160206152986140b483614070565b82815260059290921b840181019181810190868411156152b757600080fd5b8286015b848110156140fc5780516152ce81614107565b83529183019183016152bb565b60006101e082840312156152ee57600080fd5b6152f6613ff5565b90508151815261530860208301614e94565b602082015261531960408301614e94565b60408201526060820151606082015260808201516001600160401b038082111561534257600080fd5b61534e85838601615208565b608084015260a084015191508082111561536757600080fd5b61537385838601615277565b60a084015261538460c0850161526c565b60c084015261539560e0850161526c565b60e084015261010091506153aa82850161526c565b8284015261012091506153be82850161526c565b8284015261014091506153d282850161526c565b8284015261016091506153e682850161526c565b8284015261018091506153fa82850161526c565b828401526101a0915061540e828501614e94565b828401526101c09150818401518181111561542857600080fd5b61436186828701614ebc565b60006080828403121561544657600080fd5b604051608081016001600160401b03828210818311171561546957615469613fdf565b816040528293508451915061547d82613f76565b81835261548c60208601614f35565b602084015260408501519150808211156154a557600080fd5b506154b285828601614ebc565b604083015250606083015160608201525092915050565b600060c082840312156154db57600080fd5b6154e361401e565b905081516001600160401b03808211156154fc57600080fd5b615508858386016152db565b835261551660208501614e66565b6020840152604084015191508082111561552f57600080fd5b61553b85838601615434565b6040840152606084015191508082111561555457600080fd5b61556085838601615434565b6060840152608084015191508082111561557957600080fd5b5061558684828501614ebc565b60808301525061559860a08301614f35565b60a082015292915050565b6000602082840312156155b557600080fd5b81516001600160401b038111156155cb57600080fd5b613bf7848285016154c9565b634e487b7160e01b600052601260045260246000fd5b600063ffffffff80841680615604576156046155d7565b92169190910492915050565b63ffffffff81811683821602808216919082811461563057615630614f61565b505092915050565b6000806040838503121561564b57600080fd5b61565483614e3b565b915060208301516001600160401b0381111561566f57600080fd5b614991858286016154c9565b7f19457468657265756d205369676e6564204d6573736167653a0a0000000000008152600083516156b381601a85016020880161441c565b8351908301906156ca81601a84016020880161441c565b01601a01949350505050565b6000826156e5576156e56155d7565b500490565b808202811582820484141761211657612116614f61565b634e487b7160e01b600052602160045260246000fdfe360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220623545b3dab397b31826b23d976cdd61294c2b5d63977c281b5bba2b46d587ee64736f6c63430008110033496e697469616c697a61626c653a20636f6e747261637420697320616c7265617f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498", + "deployedBytecode": "0x6080604052600436106102ca5760003560e01c80637bb7bed11161017b578063b9d81abc116100d7578063e1394f7d11610085578063e1394f7d14610922578063e21f37ce14610942578063e74b981b14610964578063f2f4eb2614610984578063f6e6bb62146109a4578063fb1d2329146109c4578063feba1ed2146109e457600080fd5b8063b9d81abc1461080e578063ba5c3a9d1461082e578063bfe1092814610867578063c14007a014610887578063c53e7dab146108b5578063d0ff94b2146108d5578063d7fa5625146108f557600080fd5b80639af1d35a116101345780639af1d35a14610720578063a218404014610736578063a2686e2314610756578063a70b9f0c14610776578063aa529617146107a1578063ab37f486146107c1578063ae23bf28146107ee57600080fd5b80637bb7bed1146106445780637ecebe00146106645780638a4bd4b21461069157806392ccb581146106b157806395d3d5d8146106d157806396b3ce54146106f357600080fd5b80633d18678e1161022a57806358beb884116101e357806358beb8841461055d5780636c1550b11461057d5780636cca84bd146105aa578063734e7fb9146105ca578063752e8749146105ea57806376cd7cbc146106025780637b74691e1461062257600080fd5b80633d18678e146104a857806346904840146104c85780634d5aedbf146104f55780634f1ef2861461051557806352d1902d14610528578063586db1f51461053d57600080fd5b806317418a221161028757806317418a22146103c25780631794bb3c146103d75780632acd7ec4146103f7578063304440171461043257806334f150b7146104485780633659cfe614610468578063368b87721461048857600080fd5b80630241d8f9146102cf57806303d2944c146102f15780630db38252146103115780630f44380d146103475780631136b89514610374578063141df503146103a2575b600080fd5b3480156102db57600080fd5b506102ef6102ea366004613f96565b610a11565b005b3480156102fd57600080fd5b506102ef61030c366004613fc2565b610af8565b34801561031d57600080fd5b5061033161032c36600461436e565b610bf7565b60405161033e919061466d565b60405180910390f35b34801561035357600080fd5b50610367610362366004614680565b610e2e565b60405161033e91906146f2565b34801561038057600080fd5b5061039461038f366004614705565b610e56565b60405161033e929190614750565b3480156103ae57600080fd5b506102ef6103bd3660046147b6565b610e8c565b3480156103ce57600080fd5b50610367611003565b3480156103e357600080fd5b506102ef6103f2366004614801565b611030565b34801561040357600080fd5b50610424610412366004613fc2565b60a36020526000908152604090205481565b60405190815260200161033e565b34801561043e57600080fd5b50610424609c5481565b34801561045457600080fd5b50610394610463366004614842565b6111dc565b34801561047457600080fd5b506102ef610483366004613fc2565b61120b565b34801561049457600080fd5b506102ef6104a336600461487b565b6112d3565b3480156104b457600080fd5b506102ef6104c33660046148c3565b6113b8565b3480156104d457600080fd5b506099546104e8906001600160a01b031681565b60405161033e91906148dc565b34801561050157600080fd5b506103946105103660046148f0565b6114a5565b6102ef61052336600461494c565b6114d0565b34801561053457600080fd5b50610424611589565b34801561054957600080fd5b5061039461055836600461499b565b611637565b34801561056957600080fd5b506104246105783660046149fd565b611659565b34801561058957600080fd5b5061059d610598366004614a65565b611678565b60405161033e9190614b15565b3480156105b657600080fd5b506102ef6105c5366004613fc2565b6117a1565b3480156105d657600080fd5b506103676105e5366004614842565b6118a4565b3480156105f657600080fd5b50610424633b9aca0081565b34801561060e57600080fd5b506102ef61061d366004614b59565b6118c5565b34801561062e57600080fd5b506106376118cf565b60405161033e9190614b9a565b34801561065057600080fd5b506104e861065f3660046148c3565b611b52565b34801561067057600080fd5b5061042461067f366004613fc2565b60a06020526000908152604090205481565b34801561069d57600080fd5b506103676106ac366004613fc2565b611b7c565b3480156106bd57600080fd5b506103946106cc366004614bfc565b611b9c565b3480156106dd57600080fd5b506106e6611bbd565b60405161033e9190614c1c565b3480156106ff57600080fd5b5061042461070e366004613fc2565b60a16020526000908152604090205481565b34801561072c57600080fd5b50610424609a5481565b34801561074257600080fd5b506102ef610751366004614c67565b611cde565b34801561076257600080fd5b506102ef610771366004613fc2565b611f30565b34801561078257600080fd5b5061078c610e1081565b60405163ffffffff909116815260200161033e565b3480156107ad57600080fd5b506103946107bc3660046148f0565b612033565b3480156107cd57600080fd5b506104246107dc366004613fc2565b609f6020526000908152604090205481565b3480156107fa57600080fd5b50610367610809366004614cd2565b612062565b34801561081a57600080fd5b5061042461082936600461436e565b61208b565b34801561083a57600080fd5b5061084e6108493660046148c3565b61211c565b60405161033e9d9c9b9a99989796959493929190614cf0565b34801561087357600080fd5b506098546104e8906001600160a01b031681565b34801561089357600080fd5b506108a76108a236600461436e565b612249565b60405161033e929190614d9c565b3480156108c157600080fd5b506103946108d0366004614db7565b612323565b3480156108e157600080fd5b506103676108f0366004614cd2565b612342565b34801561090157600080fd5b50610424610910366004613fc2565b60a26020526000908152604090205481565b34801561092e57600080fd5b5061036761093d366004614680565b612351565b34801561094e57600080fd5b50610957612372565b60405161033e9190614e28565b34801561097057600080fd5b506102ef61097f366004613fc2565b612400565b34801561099057600080fd5b506097546104e8906001600160a01b031681565b3480156109b057600080fd5b506103946109bf366004614705565b6124d8565b3480156109d057600080fd5b506103676109df366004614bfc565b6124f6565b3480156109f057600080fd5b506104246109ff366004613fc2565b609e6020526000908152604090205481565b60975460405163521d4de960e01b81526001600160a01b039091169063521d4de990610a419033906004016148dc565b602060405180830381865afa158015610a5e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a829190614e4b565b610a9f57604051632678482f60e21b815260040160405180910390fd5b6001600160a01b0382166000818152609e602052604090819020839055517fab1d37d0b21937f334fc4164d147abbfdbfd7ef37ab9ea0ae73f2a58ffb7f1cc90610aec9084815260200190565b60405180910390a25050565b60975460405163521d4de960e01b81526001600160a01b039091169063521d4de990610b289033906004016148dc565b602060405180830381865afa158015610b45573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b699190614e4b565b610b8657604051632678482f60e21b815260040160405180910390fd5b6001600160a01b038116610bad57604051633494a40d60e21b815260040160405180910390fd5b609880546001600160a01b0319166001600160a01b0383169081179091556040517fc0ebb188f905d128bcd7e4282dd1f9cf24cd331b69071002e488349aca6a867b90600090a250565b610bff613d6c565b81816000018190525081602001516001600160a01b031663ddca3f436040518163ffffffff1660e01b8152600401602060405180830381865afa925050508015610c66575060408051601f3d908101601f19168201909252610c6391810190614e79565b60015b610c765760006020820152610c81565b62ffffff1660208201525b610cf482602001516001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa158015610cc6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cea9190614e9f565b8360200151612514565b8160400181905250610d4182602001516001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa158015610cc6573d6000803e3d6000fd5b816060018190525081604001516001600160a01b03166395d89b416040518163ffffffff1660e01b8152600401600060405180830381865afa158015610d8b573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610db39190810190614f01565b816080018190525081604001516001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015610dfd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e219190614f46565b60ff1660a0820152919050565b6060610e4f6000610e3e8461267c565b63ffffffff600063ffffffff612695565b5092915050565b6060600080610e648661267c565b9050610e7f600082610e78610e1082614f77565b8888612695565b9250925050935093915050565b60975460405163521d4de960e01b81526001600160a01b039091169063521d4de990610ebc9033906004016148dc565b602060405180830381865afa158015610ed9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610efd9190614e4b565b610f1a57604051632678482f60e21b815260040160405180910390fd5b8160005b81811015610ffc57610ff483868684818110610f3c57610f3c614f94565b9050602002016020810190610f519190613fc2565b6001600160a01b03166370a08231306040518263ffffffff1660e01b8152600401610f7c91906148dc565b602060405180830381865afa158015610f99573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fbd9190614faa565b878785818110610fcf57610fcf614f94565b9050602002016020810190610fe49190613fc2565b6001600160a01b03169190612a9c565b600101610f1e565b5050505050565b606060006110104261267c565b9050610e4f600082611024610e1082614f77565b600063ffffffff612695565b600054610100900460ff16158080156110505750600054600160ff909116105b80611071575061105f30612505565b158015611071575060005460ff166001145b6110d95760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084015b60405180910390fd5b6000805460ff1916600117905580156110fc576000805461ff0019166101001790555b6001600160a01b038416158061111957506001600160a01b038316155b156111375760405163d92e233d60e01b815260040160405180910390fd5b633b9aca00821061115b57604051633494a40d60e21b815260040160405180910390fd5b609880546001600160a01b038086166001600160a01b0319928316179092556097805492871692909116919091179055609a82905580156111d6576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50505050565b60606000806111ea4261267c565b90506111fe600082610e78610e1082614f77565b92509250505b9250929050565b6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001630036112535760405162461bcd60e51b81526004016110d090614fc3565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316611285612b04565b6001600160a01b0316146112ab5760405162461bcd60e51b81526004016110d09061500f565b6112b481612b20565b604080516000808252602082019092526112d091839190612bc3565b50565b60975460405163521d4de960e01b81526001600160a01b039091169063521d4de9906113039033906004016148dc565b602060405180830381865afa158015611320573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113449190614e4b565b61136157604051632678482f60e21b815260040160405180910390fd5b609b61136d82826150db565b50600061137982612d2e565b609c8190556040518181529091507fde3dc3335dea4d1a1060ef6cefcfcc109eb0a1e78ce151818d3f17a01e1f8a059060200160405180910390a15050565b60975460405163521d4de960e01b81526001600160a01b039091169063521d4de9906113e89033906004016148dc565b602060405180830381865afa158015611405573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114299190614e4b565b61144657604051632678482f60e21b815260040160405180910390fd5b633b9aca00811061146a57604051633494a40d60e21b815260040160405180910390fd5b609a8190556040518181527f3346af6da1932164d501f2ec28f8c5d686db5828a36b77f2da4332d89184fe7b9060200160405180910390a150565b606060006114c2866114b68761267c565b63ffffffff8787612695565b915091505b94509492505050565b6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001630036115185760405162461bcd60e51b81526004016110d090614fc3565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031661154a612b04565b6001600160a01b0316146115705760405162461bcd60e51b81526004016110d09061500f565b61157982612b20565b61158582826001612bc3565b5050565b6000306001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146116245760405162461bcd60e51b815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c6044820152771b1959081d1a1c9bdd59da0819195b1959d85d1958d85b1b60421b60648201526084016110d0565b5060008051602061571883398151915290565b606060006114c260006116498861267c565b6116528861267c565b8787612695565b60006116658383612d69565b61166e84612e25565b90505b9392505050565b33600090815260a260205260409020546060901580156116a95750609c5433600090815260a1602052604090205414155b80156116c2575032600090815260a26020526040902054155b80156116df5750609c5432600090815260a1602052604090205414155b156116fd576040516314e52a5b60e31b815260040160405180910390fd5b81516000816001600160401b0381111561171957611719613fdf565b604051908082528060200260200182016040528015611742578160200160208202803683370190505b50905060005b828110156117975761177285828151811061176557611765614f94565b6020026020010151612e25565b82828151811061178457611784614f94565b6020908102919091010152600101611748565b509150505b919050565b60975460405163521d4de960e01b81526001600160a01b039091169063521d4de9906117d19033906004016148dc565b602060405180830381865afa1580156117ee573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118129190614e4b565b61182f57604051632678482f60e21b815260040160405180910390fd5b6001600160a01b0381166000908152609f602052604081205461185390600161519a565b6001600160a01b0383166000818152609f60205260409081902083905551919250907fc6cd32b1acffa550abf886a9b443ff3ce485bfdb05e35ef5b26e745739a1eac190610aec9084815260200190565b60606118bd60006118b48561267c565b6110248561267c565b509392505050565b6115858282612d69565b6060609d805480602002602001604051908101604052809291908181526020016000905b82821015611b49576000848152602090819020604080516101e081018252600986029092018054835260018101546001600160a01b039081168486015260028201541683830152600381015460608401526004810180548351818702810187019094528084529394919360808601939283018282801561199c57602002820191906000526020600020905b81546001600160a01b0316815260019091019060200180831161197e575b5050505050815260200160058201805480602002602001604051908101604052809291908181526020018280548015611a2057602002820191906000526020600020906000905b82829054906101000a900463ffffffff1663ffffffff16815260200190600401906020826003010492830192600103820291508084116119e35790505b5050509183525050600682015463ffffffff8082166020840152600160201b820481166040840152600160401b820481166060840152600160601b820481166080840152600160801b8204811660a0840152600160a01b8204811660c0840152600160c01b9091041660e082015260078201546001600160a01b031661010082015260088201805461012090920191611ab89061505b565b80601f0160208091040260200160405190810160405280929190818152602001828054611ae49061505b565b8015611b315780601f10611b0657610100808354040283529160200191611b31565b820191906000526020600020905b815481529060010190602001808311611b1457829003601f168201915b505050505081525050815260200190600101906118f3565b50505050905090565b60a48181548110611b6257600080fd5b6000918252602090912001546001600160a01b0316905081565b60606000611b894261267c565b90506117978382611024610e1082614f77565b6060600080611baa4261267c565b9050610e7f8682610e78610e1082614f77565b60a45460609060009081816001600160401b03811115611bdf57611bdf613fdf565b604051908082528060200260200182016040528015611c2457816020015b6040805180820190915260008082526020820152815260200190600190039081611bfd5790505b50905060005b828163ffffffff161015611cd457600060a48263ffffffff1681548110611c5357611c53614f94565b60009182526020808320909101546001600160a01b031680835260a39091526040909120549091508015611cca576040518060400160405280836001600160a01b0316815260200182815250848781518110611cb157611cb1614f94565b6020908102919091010152611cc76001876151ad565b95505b5050600101611c2a565b5091825250919050565b60975460405163521d4de960e01b81526001600160a01b039091169063521d4de990611d0e9033906004016148dc565b602060405180830381865afa158015611d2b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d4f9190614e4b565b611d6c57604051632678482f60e21b815260040160405180910390fd5b82818114611d8d57604051631df89e8b60e01b815260040160405180910390fd5b60005b81811015611f28576000848483818110611dac57611dac614f94565b905060200201359050600081118015611e07575060a36000888885818110611dd657611dd6614f94565b9050602002016020810190611deb9190613fc2565b6001600160a01b03168152602081019190915260400160002054155b15611e685760a4878784818110611e2057611e20614f94565b9050602002016020810190611e359190613fc2565b81546001810183556000928352602090922090910180546001600160a01b0319166001600160a01b039092169190911790555b8060a36000898986818110611e7f57611e7f614f94565b9050602002016020810190611e949190613fc2565b6001600160a01b03168152602081019190915260400160002055868683818110611ec057611ec0614f94565b9050602002016020810190611ed59190613fc2565b6001600160a01b03167f3a5e6418e38cae10bf66eaf3e68c4e9c6b14df195e24fec169ab3a5b123c96e582604051611f0f91815260200190565b60405180910390a250611f21816151c0565b9050611d90565b505050505050565b60975460405163521d4de960e01b81526001600160a01b039091169063521d4de990611f609033906004016148dc565b602060405180830381865afa158015611f7d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fa19190614e4b565b611fbe57604051632678482f60e21b815260040160405180910390fd5b6001600160a01b038116600090815260a26020526040812054611fe290600161519a565b6001600160a01b038316600081815260a260205260409081902083905551919250907f9c759941da0b7ce56c059c1497218796e62035024afb77a00ff49a980a62078f90610aec9084815260200190565b60606000806120418661267c565b90506120548782610e78610e1082614f77565b925092505094509492505050565b6060600061206f8361267c565b90506120828482611024610e1082614f77565b50949350505050565b33600090815260a260205260408120541580156120b95750609c5433600090815260a1602052604090205414155b80156120d2575032600090815260a26020526040902054155b80156120ef5750609c5432600090815260a1602052604090205414155b1561210d576040516314e52a5b60e31b815260040160405180910390fd5b61211682612e25565b92915050565b609d818154811061212c57600080fd5b600091825260209091206009909102018054600182015460028301546003840154600685015460078601546008870180549698506001600160a01b039586169794861696939563ffffffff80851696600160201b8604821696600160401b8704831696600160601b8104841696600160801b8204851696600160a01b8304861696600160c01b90930490951694911692916121c69061505b565b80601f01602080910402602001604051908101604052809291908181526020018280546121f29061505b565b801561223f5780601f106122145761010080835404028352916020019161223f565b820191906000526020600020905b81548152906001019060200180831161222257829003601f168201915b505050505090508d565b6000612253613d6c565b600080306001600160a01b0316630db3825260e01b8660405160240161227991906151d9565b60408051601f198184030181529181526020820180516001600160e01b03166001600160e01b03199094169390931790925290516122b791906151ec565b600060405180830381855af49150503d80600081146122f2576040519150601f19603f3d011682016040523d82523d6000602084013e6122f7565b606091505b5091509150819350831561231c578080602001905181019061231991906155a3565b92505b5050915091565b60606000612334876116498861267c565b915091509550959350505050565b60606118bd83610e3e8461267c565b6060600061235e8361267c565b9050611797600082611024610e1082614f77565b609b805461237f9061505b565b80601f01602080910402602001604051908101604052809291908181526020018280546123ab9061505b565b80156123f85780601f106123cd576101008083540402835291602001916123f8565b820191906000526020600020905b8154815290600101906020018083116123db57829003601f168201915b505050505081565b60975460405163521d4de960e01b81526001600160a01b039091169063521d4de9906124309033906004016148dc565b602060405180830381865afa15801561244d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124719190614e4b565b61248e57604051632678482f60e21b815260040160405180910390fd5b609980546001600160a01b0319166001600160a01b0383169081179091556040517f7a7b5a0a132f9e0581eb8527f66eae9ee89c2a3e79d4ac7e41a1f1f4d48a7fc290600090a250565b606060006124ea60006114b68761267c565b91509150935093915050565b6060612082846118b48561267c565b6001600160a01b03163b151590565b61251c613e22565b6001600160a01b0383168082526040805163313ce56760e01b8152905163313ce567916004808201926020929091908290030181865afa158015612564573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125889190614f46565b60ff166020820152604080516395d89b4160e01b815290516001600160a01b038516916395d89b419160048083019260009291908290030181865afa1580156125d5573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526125fd9190810190614f01565b604080830191909152516370a0823160e01b81526001600160a01b038416906370a08231906126309085906004016148dc565b602060405180830381865afa15801561264d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126719190614faa565b606082015292915050565b6000610e1061268b81846155ed565b6121169190615610565b609d5460609060009081908163ffffffff861682106126ba578563ffffffff166126bc565b815b90506000816001600160401b038111156126d8576126d8613fdf565b60405190808252806020026020018201604052801561271157816020015b6126fe613d6c565b8152602001906001900390816126f65790505b509050875b838163ffffffff161015612a82576000609d8263ffffffff168154811061273f5761273f614f94565b6000918252602091829020604080516101e08101825260099093029091018054835260018101546001600160a01b03908116848601526002820154168383015260038101546060840152600481018054835181870281018701909452808452939491936080860193928301828280156127e157602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116127c3575b505050505081526020016005820180548060200260200160405190810160405280929190818152602001828054801561286557602002820191906000526020600020906000905b82829054906101000a900463ffffffff1663ffffffff16815260200190600401906020826003010492830192600103820291508084116128285790505b5050509183525050600682015463ffffffff8082166020840152600160201b820481166040840152600160401b820481166060840152600160601b820481166080840152600160801b8204811660a0840152600160a01b8204811660c0840152600160c01b9091041660e082015260078201546001600160a01b0316610100820152600882018054610120909201916128fd9061505b565b80601f01602080910402602001604051908101604052809291908181526020018280546129299061505b565b80156129765780601f1061294b57610100808354040283529160200191612976565b820191906000526020600020905b81548152906001019060200180831161295957829003601f168201915b505050505081525050905061298c818d8d613465565b80156129be57506001600160a01b038d1615806129be57508c6001600160a01b031681602001516001600160a01b0316145b15612a695760405163060a003d60e51b81526000908190309063c14007a0906129eb9086906004016151d9565b600060405180830381865afa158015612a08573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052612a309190810190615638565b915091508115612a665780858981518110612a4d57612a4d614f94565b6020908102919091010152612a636001896151ad565b97505b50505b816001019150838603612a7c5750612a82565b50612716565b9381529a63ffffffff909316995091975050505050505050565b6040516001600160a01b038316602482015260448101829052612aff90849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526134bb565b505050565b600080516020615718833981519152546001600160a01b031690565b6097546001600160a01b03168015801590612ba5575060405163521d4de960e01b81526001600160a01b0382169063521d4de990612b629033906004016148dc565b602060405180830381865afa158015612b7f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612ba39190614e4b565b155b1561158557604051632678482f60e21b815260040160405180910390fd5b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff1615612bf657612aff8361358d565b826001600160a01b03166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa925050508015612c50575060408051601f3d908101601f19168201909252612c4d91810190614faa565b60015b612cb35760405162461bcd60e51b815260206004820152602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201526d6f6e206973206e6f74205555505360901b60648201526084016110d0565b6000805160206157188339815191528114612d225760405162461bcd60e51b815260206004820152602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f786044820152681a58589b195555525160ba1b60648201526084016110d0565b50612aff838383613627565b6000612d3a825161364c565b82604051602001612d4c92919061567b565b604051602081830303815290604052805190602001209050919050565b609c54604080516020601f85018190048102820181019092528381523391612dad91849187908790819084018382808284376000920191909152506136de92505050565b6001600160a01b031614612dd457604051638baa579f60e01b815260040160405180910390fd5b33600081815260a1602052604090819020839055517fc48bbd4f009ad78a336beb65bf44688651e9aa52ac98d9054f0fce0573fefbc390612e189084815260200190565b60405180910390a2505050565b6000612e2f6136fa565b6000612e3f83610120015161267c565b6040808501516001600160a01b0316600090815260a3602052205463ffffffff821661012086015290915042612e77610e1084614f77565b63ffffffff161080612e92575061014084015163ffffffff16155b80612ec857508360e001518460c00151856101000151612eb29190614f77565b612ebc9190614f77565b63ffffffff1661271014155b80612ef757506101a08401516001600160a01b031615801590612ef7575061271084610180015163ffffffff16105b80612f0c57508360a001515184608001515114155b80612f15575080155b80612f3957508084610140015163ffffffff168560600151612f3791906156d6565b105b15612f57576040516314414f4160e11b815260040160405180910390fd5b6060840151336000908152609e6020526040902054909350633b9aca00811080156130035750609f600086602001516001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa158015612fc3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612fe79190614e9f565b6001600160a01b03168152602081019190915260400160002054155b80156130905750609f600086602001516001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa158015613050573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906130749190614e9f565b6001600160a01b03168152602081019190915260400160002054155b15613134576000633b9aca006130a6838261519a565b609a546130b391906156ea565b6130bd91906156d6565b90506000633b9aca006130d0838261519a565b6130da90886156ea565b6130e491906156d6565b6099549091506001600160a01b031680156130ff5780613101565b305b90506131283382613112858b61519a565b60408c01516001600160a01b0316929190613753565b50606087018190529450505b6098546040860151613155916001600160a01b039182169133911687613753565b33600090815260a060205260409020546131708160016151ad565b33600081815260a0602090815260409182902093909355516131b19284910160609290921b6bffffffffffffffffffffffff19168252601482015260340190565b60408051808303601f1901815291815281516020928301208852609d805460018101825560009190915288517fd26e832454299e9fabb89e0e5fffdc046d4e14431bc1bf607ffb2e8a1ddecf7b6009909202918201908155898401517fd26e832454299e9fabb89e0e5fffdc046d4e14431bc1bf607ffb2e8a1ddecf7c830180546001600160a01b03199081166001600160a01b0393841617909155938b01517fd26e832454299e9fabb89e0e5fffdc046d4e14431bc1bf607ffb2e8a1ddecf7d8401805490951691161790925560608901517fd26e832454299e9fabb89e0e5fffdc046d4e14431bc1bf607ffb2e8a1ddecf7e820155608089015180518a946132df937fd26e832454299e9fabb89e0e5fffdc046d4e14431bc1bf607ffb2e8a1ddecf7f01920190613e56565b5060a082015180516132fb916005840191602090910190613ebb565b5060c082015160068201805460e08501516101008601516101208701516101408801516101608901516101808a015163ffffffff98891667ffffffffffffffff1990971696909617600160201b958916959095029490941767ffffffffffffffff60401b1916600160401b9388169390930263ffffffff60601b191692909217600160601b918716919091021767ffffffffffffffff60801b1916600160801b9186169190910263ffffffff60a01b191617600160a01b918516919091021763ffffffff60c01b1916600160c01b93909116929092029190911790556101a08201516007820180546001600160a01b0319166001600160a01b039092169190911790556101c0820151600882019061341390826150db565b505050336001600160a01b03167f5280c74029ecceb35e4fecf34adee487fd5a9a3d6c8e70b7374a1c133370e83a8760405161344f91906151d9565b60405180910390a25050505061179c6001606555565b60008084610120015163ffffffff1690508363ffffffff16610e108661014001516134909190615610565b6134a09063ffffffff16836151ad565b1180156134b257508263ffffffff1681105b95945050505050565b6000613510826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661378b9092919063ffffffff16565b805190915015612aff578080602001905181019061352e9190614e4b565b612aff5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016110d0565b61359681612505565b6135f85760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b60648201526084016110d0565b60008051602061571883398151915280546001600160a01b0319166001600160a01b0392909216919091179055565b6136308361379a565b60008251118061363d5750805b15612aff576111d683836137da565b60606000613659836138c3565b60010190506000816001600160401b0381111561367857613678613fdf565b6040519080825280601f01601f1916602001820160405280156136a2576020820181803683370190505b5090508181016020015b600019016f181899199a1a9b1b9c1cb0b131b232b360811b600a86061a8153600a85049450846136ac57509392505050565b60008060006136ed858561399b565b915091506118bd816139dd565b60026065540361374c5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016110d0565b6002606555565b6040516001600160a01b03808516602483015283166044820152606481018290526111d69085906323b872dd60e01b90608401612ac8565b606061166e8484600085613b22565b6137a38161358d565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b60606137e583612505565b6138405760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b60648201526084016110d0565b600080846001600160a01b03168460405161385b91906151ec565b600060405180830381855af49150503d8060008114613896576040519150601f19603f3d011682016040523d82523d6000602084013e61389b565b606091505b50915091506134b2828260405180606001604052806027815260200161573860279139613bff565b60008072184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b83106139025772184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b830492506040015b6d04ee2d6d415b85acef8100000000831061392e576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc10000831061394c57662386f26fc10000830492506010015b6305f5e1008310613964576305f5e100830492506008015b612710831061397857612710830492506004015b6064831061398a576064830492506002015b600a83106121165760010192915050565b60008082516041036139d15760208301516040840151606085015160001a6139c587828585613c18565b94509450505050611204565b50600090506002611204565b60008160048111156139f1576139f1615701565b036139f95750565b6001816004811115613a0d57613a0d615701565b03613a555760405162461bcd60e51b815260206004820152601860248201527745434453413a20696e76616c6964207369676e617475726560401b60448201526064016110d0565b6002816004811115613a6957613a69615701565b03613ab65760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e6774680060448201526064016110d0565b6003816004811115613aca57613aca615701565b036112d05760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b60648201526084016110d0565b606082471015613b835760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016110d0565b600080866001600160a01b03168587604051613b9f91906151ec565b60006040518083038185875af1925050503d8060008114613bdc576040519150601f19603f3d011682016040523d82523d6000602084013e613be1565b606091505b5091509150613bf287838387613ccf565b925050505b949350505050565b60608315613c0e575081611671565b6116718383613d42565b6000806fa2a8918ca85bafe22016d0b997e4df60600160ff1b03831115613c4557506000905060036114c7565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015613c99573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116613cc2576000600192509250506114c7565b9660009650945050505050565b60608315613d3c578251600003613d3557613ce985612505565b613d355760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016110d0565b5081613bf7565b613bf783835b815115613d525781518083602001fd5b8060405162461bcd60e51b81526004016110d09190614e28565b604080516102a081018252600060c0820181815260e083018290526101008301829052610120830182905260606101408401819052610160840181905261018084018390526101a084018390526101c084018390526101e08401839052610200840183905261022084018390526102408401839052610260840183905261028084015282526020820152908101613e01613e22565b8152602001613e0e613e22565b815260606020820152600060409091015290565b604051806080016040528060006001600160a01b03168152602001600060ff16815260200160608152602001600081525090565b828054828255906000526020600020908101928215613eab579160200282015b82811115613eab57825182546001600160a01b0319166001600160a01b03909116178255602090920191600190910190613e76565b50613eb7929150613f61565b5090565b82805482825590600052602060002090600701600890048101928215613eab5791602002820160005b83821115613f2857835183826101000a81548163ffffffff021916908363ffffffff1602179055509260200192600401602081600301049283019260010302613ee4565b8015613f585782816101000a81549063ffffffff0219169055600401602081600301049283019260010302613f28565b5050613eb79291505b5b80821115613eb75760008155600101613f62565b6001600160a01b03811681146112d057600080fd5b803561179c81613f76565b60008060408385031215613fa957600080fd5b8235613fb481613f76565b946020939093013593505050565b600060208284031215613fd457600080fd5b813561167181613f76565b634e487b7160e01b600052604160045260246000fd5b6040516101e081016001600160401b038111828210171561401857614018613fdf565b60405290565b60405160c081016001600160401b038111828210171561401857614018613fdf565b604051601f8201601f191681016001600160401b038111828210171561406857614068613fdf565b604052919050565b60006001600160401b0382111561408957614089613fdf565b5060051b60200190565b600082601f8301126140a457600080fd5b813560206140b96140b483614070565b614040565b82815260059290921b840181019181810190868411156140d857600080fd5b8286015b848110156140fc5780356140ef81613f76565b83529183019183016140dc565b509695505050505050565b63ffffffff811681146112d057600080fd5b803561179c81614107565b600082601f83011261413557600080fd5b813560206141456140b483614070565b82815260059290921b8401810191818101908684111561416457600080fd5b8286015b848110156140fc57803561417b81614107565b8352918301918301614168565b60006001600160401b038211156141a1576141a1613fdf565b50601f01601f191660200190565b60006141bd6140b484614188565b90508281528383830111156141d157600080fd5b828260208301376000602084830101529392505050565b600082601f8301126141f957600080fd5b611671838335602085016141af565b60006101e0828403121561421b57600080fd5b614223613ff5565b90508135815261423560208301613f8b565b602082015261424660408301613f8b565b60408201526060820135606082015260808201356001600160401b038082111561426f57600080fd5b61427b85838601614093565b608084015260a084013591508082111561429457600080fd5b6142a085838601614124565b60a08401526142b160c08501614119565b60c08401526142c260e08501614119565b60e084015261010091506142d7828501614119565b8284015261012091506142eb828501614119565b8284015261014091506142ff828501614119565b828401526101609150614313828501614119565b828401526101809150614327828501614119565b828401526101a0915061433b828501613f8b565b828401526101c09150818401358181111561435557600080fd5b614361868287016141e8565b8385015250505092915050565b60006020828403121561438057600080fd5b81356001600160401b0381111561439657600080fd5b613bf784828501614208565b600081518084526020808501945080840160005b838110156143db5781516001600160a01b0316875295820195908201906001016143b6565b509495945050505050565b600081518084526020808501945080840160005b838110156143db57815163ffffffff16875295820195908201906001016143fa565b60005b8381101561443757818101518382015260200161441f565b50506000910152565b6000815180845261445881602086016020860161441c565b601f01601f19169290920160200192915050565b60006101e082518452602083015161448f60208601826001600160a01b03169052565b5060408301516144aa60408601826001600160a01b03169052565b506060830151606085015260808301518160808601526144cc828601826143a2565b91505060a083015184820360a08601526144e682826143e6565b91505060c083015161450060c086018263ffffffff169052565b5060e083015161451860e086018263ffffffff169052565b506101008381015163ffffffff9081169186019190915261012080850151821690860152610140808501518216908601526101608085015182169086015261018080850151909116908501526101a0808401516001600160a01b0316908501526101c080840151858303828701526145908382614440565b9695505050505050565b60018060a01b03815116825260ff602082015116602083015260006040820151608060408501526145ce6080850182614440565b606093840151949093019390935250919050565b6000815160c084526145f760c085018261446c565b905062ffffff60208401511660208501526040830151848203604086015261461f828261459a565b91505060608301518482036060860152614639828261459a565b915050608083015184820360808601526146538282614440565b91505060ff60a08401511660a08501528091505092915050565b60208152600061167160208301846145e2565b60006020828403121561469257600080fd5b813561167181614107565b600081518084526020808501808196508360051b8101915082860160005b858110156146e55782840389526146d38483516145e2565b988501989350908401906001016146bb565b5091979650505050505050565b602081526000611671602083018461469d565b60008060006060848603121561471a57600080fd5b833561472581614107565b9250602084013561473581614107565b9150604084013561474581614107565b809150509250925092565b604081526000614763604083018561469d565b90508260208301529392505050565b60008083601f84011261478457600080fd5b5081356001600160401b0381111561479b57600080fd5b6020830191508360208260051b850101111561120457600080fd5b6000806000604084860312156147cb57600080fd5b83356001600160401b038111156147e157600080fd5b6147ed86828701614772565b909450925050602084013561474581613f76565b60008060006060848603121561481657600080fd5b833561482181613f76565b9250602084013561483181613f76565b929592945050506040919091013590565b6000806040838503121561485557600080fd5b823561486081614107565b9150602083013561487081614107565b809150509250929050565b60006020828403121561488d57600080fd5b81356001600160401b038111156148a357600080fd5b8201601f810184136148b457600080fd5b613bf7848235602084016141af565b6000602082840312156148d557600080fd5b5035919050565b6001600160a01b0391909116815260200190565b6000806000806080858703121561490657600080fd5b843561491181613f76565b9350602085013561492181614107565b9250604085013561493181614107565b9150606085013561494181614107565b939692955090935050565b6000806040838503121561495f57600080fd5b823561496a81613f76565b915060208301356001600160401b0381111561498557600080fd5b614991858286016141e8565b9150509250929050565b600080600080608085870312156149b157600080fd5b843561491181614107565b60008083601f8401126149ce57600080fd5b5081356001600160401b038111156149e557600080fd5b60208301915083602082850101111561120457600080fd5b600080600060408486031215614a1257600080fd5b83356001600160401b0380821115614a2957600080fd5b614a3587838801614208565b94506020860135915080821115614a4b57600080fd5b50614a58868287016149bc565b9497909650939450505050565b60006020808385031215614a7857600080fd5b82356001600160401b0380821115614a8f57600080fd5b818501915085601f830112614aa357600080fd5b8135614ab16140b482614070565b81815260059190911b83018401908481019088831115614ad057600080fd5b8585015b83811015614b0857803585811115614aec5760008081fd5b614afa8b89838a0101614208565b845250918601918601614ad4565b5098975050505050505050565b6020808252825182820181905260009190848201906040850190845b81811015614b4d57835183529284019291840191600101614b31565b50909695505050505050565b60008060208385031215614b6c57600080fd5b82356001600160401b03811115614b8257600080fd5b614b8e858286016149bc565b90969095509350505050565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b82811015614bef57603f19888603018452614bdd85835161446c565b94509285019290850190600101614bc1565b5092979650505050505050565b600080600060608486031215614c1157600080fd5b833561472581613f76565b602080825282518282018190526000919060409081850190868401855b828110156146e557815180516001600160a01b03168552860151868501529284019290850190600101614c39565b60008060008060408587031215614c7d57600080fd5b84356001600160401b0380821115614c9457600080fd5b614ca088838901614772565b90965094506020870135915080821115614cb957600080fd5b50614cc687828801614772565b95989497509550505050565b60008060408385031215614ce557600080fd5b823561486081613f76565b8d81526001600160a01b038d811660208301528c166040820152606081018b905263ffffffff8a8116608083015289811660a0830152881660c0820152600063ffffffff881660e083015263ffffffff871661010083015263ffffffff861661012083015263ffffffff85166101408301526001600160a01b0384166101608301526101a0610180830152614d896101a0830184614440565b9f9e505050505050505050505050505050565b821515815260406020820152600061166e60408301846145e2565b600080600080600060a08688031215614dcf57600080fd5b8535614dda81613f76565b94506020860135614dea81614107565b93506040860135614dfa81614107565b92506060860135614e0a81614107565b91506080860135614e1a81614107565b809150509295509295909350565b6020815260006116716020830184614440565b8051801515811461179c57600080fd5b600060208284031215614e5d57600080fd5b61167182614e3b565b805162ffffff8116811461179c57600080fd5b600060208284031215614e8b57600080fd5b61167182614e66565b805161179c81613f76565b600060208284031215614eb157600080fd5b815161167181613f76565b600082601f830112614ecd57600080fd5b8151614edb6140b482614188565b818152846020838601011115614ef057600080fd5b613bf782602083016020870161441c565b600060208284031215614f1357600080fd5b81516001600160401b03811115614f2957600080fd5b613bf784828501614ebc565b805160ff8116811461179c57600080fd5b600060208284031215614f5857600080fd5b61167182614f35565b634e487b7160e01b600052601160045260246000fd5b63ffffffff818116838216019080821115610e4f57610e4f614f61565b634e487b7160e01b600052603260045260246000fd5b600060208284031215614fbc57600080fd5b5051919050565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b19195b1959d85d1958d85b1b60a21b606082015260800190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b6163746976652070726f787960a01b606082015260800190565b600181811c9082168061506f57607f821691505b60208210810361508f57634e487b7160e01b600052602260045260246000fd5b50919050565b601f821115612aff57600081815260208120601f850160051c810160208610156150bc5750805b601f850160051c820191505b81811015611f28578281556001016150c8565b81516001600160401b038111156150f4576150f4613fdf565b61510881615102845461505b565b84615095565b602080601f83116001811461513d57600084156151255750858301515b600019600386901b1c1916600185901b178555611f28565b600085815260208120601f198616915b8281101561516c5788860151825594840194600190910190840161514d565b508582101561518a5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b8181038181111561211657612116614f61565b8082018082111561211657612116614f61565b6000600182016151d2576151d2614f61565b5060010190565b602081526000611671602083018461446c565b600082516151fe81846020870161441c565b9190910192915050565b600082601f83011261521957600080fd5b815160206152296140b483614070565b82815260059290921b8401810191818101908684111561524857600080fd5b8286015b848110156140fc57805161525f81613f76565b835291830191830161524c565b805161179c81614107565b600082601f83011261528857600080fd5b815160206152986140b483614070565b82815260059290921b840181019181810190868411156152b757600080fd5b8286015b848110156140fc5780516152ce81614107565b83529183019183016152bb565b60006101e082840312156152ee57600080fd5b6152f6613ff5565b90508151815261530860208301614e94565b602082015261531960408301614e94565b60408201526060820151606082015260808201516001600160401b038082111561534257600080fd5b61534e85838601615208565b608084015260a084015191508082111561536757600080fd5b61537385838601615277565b60a084015261538460c0850161526c565b60c084015261539560e0850161526c565b60e084015261010091506153aa82850161526c565b8284015261012091506153be82850161526c565b8284015261014091506153d282850161526c565b8284015261016091506153e682850161526c565b8284015261018091506153fa82850161526c565b828401526101a0915061540e828501614e94565b828401526101c09150818401518181111561542857600080fd5b61436186828701614ebc565b60006080828403121561544657600080fd5b604051608081016001600160401b03828210818311171561546957615469613fdf565b816040528293508451915061547d82613f76565b81835261548c60208601614f35565b602084015260408501519150808211156154a557600080fd5b506154b285828601614ebc565b604083015250606083015160608201525092915050565b600060c082840312156154db57600080fd5b6154e361401e565b905081516001600160401b03808211156154fc57600080fd5b615508858386016152db565b835261551660208501614e66565b6020840152604084015191508082111561552f57600080fd5b61553b85838601615434565b6040840152606084015191508082111561555457600080fd5b61556085838601615434565b6060840152608084015191508082111561557957600080fd5b5061558684828501614ebc565b60808301525061559860a08301614f35565b60a082015292915050565b6000602082840312156155b557600080fd5b81516001600160401b038111156155cb57600080fd5b613bf7848285016154c9565b634e487b7160e01b600052601260045260246000fd5b600063ffffffff80841680615604576156046155d7565b92169190910492915050565b63ffffffff81811683821602808216919082811461563057615630614f61565b505092915050565b6000806040838503121561564b57600080fd5b61565483614e3b565b915060208301516001600160401b0381111561566f57600080fd5b614991858286016154c9565b7f19457468657265756d205369676e6564204d6573736167653a0a0000000000008152600083516156b381601a85016020880161441c565b8351908301906156ca81601a84016020880161441c565b01601a01949350505050565b6000826156e5576156e56155d7565b500490565b808202811582820484141761211657612116614f61565b634e487b7160e01b600052602160045260246000fdfe360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220623545b3dab397b31826b23d976cdd61294c2b5d63977c281b5bba2b46d587ee64736f6c63430008110033" +} \ No newline at end of file diff --git a/deployments/coredao/Distributor.json b/deployments/coredao/Distributor.json new file mode 100644 index 0000000..2c7bfb2 --- /dev/null +++ b/deployments/coredao/Distributor.json @@ -0,0 +1,132 @@ +{ + "address": "0x3Ef3D8bA38EBe18DB133cEc108f4D14CE00Dd9Ae", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_logic", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "stateMutability": "payable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "previousAdmin", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "AdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "beacon", + "type": "address" + } + ], + "name": "BeaconUpgraded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "stateMutability": "payable", + "type": "receive" + } + ], + "transactionHash": "0x4983b9d4bd10f27776c25cfef5f41174cd0930115b5d9eed31b3e08bfda18100", + "receipt": { + "to": null, + "from": "0x9f76a95AA7535bb0893cf88A146396e00ed21A12", + "contractAddress": "0x3Ef3D8bA38EBe18DB133cEc108f4D14CE00Dd9Ae", + "transactionIndex": 3, + "gasUsed": "273887", + "logsBloom": "0x00000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080002000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000800000004000000000000000000000004000000000000000000000000000000000000", + "blockHash": "0x00ff3c4f3c51f374e65971133095836a9075c789b237eb345c64eed806ccee96", + "transactionHash": "0x4983b9d4bd10f27776c25cfef5f41174cd0930115b5d9eed31b3e08bfda18100", + "logs": [ + { + "transactionIndex": 3, + "blockNumber": 8867923, + "transactionHash": "0x4983b9d4bd10f27776c25cfef5f41174cd0930115b5d9eed31b3e08bfda18100", + "address": "0x3Ef3D8bA38EBe18DB133cEc108f4D14CE00Dd9Ae", + "topics": [ + "0xbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b", + "0x000000000000000000000000918261fa5dd9c3b1358ca911792e9bdf3c5cca35" + ], + "data": "0x", + "logIndex": 8, + "blockHash": "0x00ff3c4f3c51f374e65971133095836a9075c789b237eb345c64eed806ccee96" + } + ], + "blockNumber": 8867923, + "cumulativeGasUsed": "1932076", + "status": 1, + "byzantium": true + }, + "args": [ + "0x918261fa5Dd9C3b1358cA911792E9bDF3c5CCa35", + "0x" + ], + "numDeployments": 1, + "solcInputHash": "e77f17fbb4334e4df730b35bdfde2517", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_logic\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"previousAdmin\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"AdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"beacon\",\"type\":\"address\"}],\"name\":\"BeaconUpgraded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"implementation\",\"type\":\"address\"}],\"name\":\"Upgraded\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"details\":\"This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an implementation address that can be changed. This address is stored in storage in the location specified by https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the implementation behind the proxy.\",\"kind\":\"dev\",\"methods\":{\"constructor\":{\"details\":\"Initializes the upgradeable proxy with an initial implementation specified by `_logic`. If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded function call, and allows initializing the storage of the proxy like a Solidity constructor.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol\":\"ERC1967Proxy\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":100000},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/interfaces/draft-IERC1822.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\\n * proxy whose upgrades are fully controlled by the current implementation.\\n */\\ninterface IERC1822Proxiable {\\n /**\\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\\n * address.\\n *\\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\\n * function revert if invoked through a proxy.\\n */\\n function proxiableUUID() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0x1d4afe6cb24200cc4545eed814ecf5847277dfe5d613a1707aad5fceecebcfff\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/ERC1967/ERC1967Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../Proxy.sol\\\";\\nimport \\\"./ERC1967Upgrade.sol\\\";\\n\\n/**\\n * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an\\n * implementation address that can be changed. This address is stored in storage in the location specified by\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the\\n * implementation behind the proxy.\\n */\\ncontract ERC1967Proxy is Proxy, ERC1967Upgrade {\\n /**\\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.\\n *\\n * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded\\n * function call, and allows initializing the storage of the proxy like a Solidity constructor.\\n */\\n constructor(address _logic, bytes memory _data) payable {\\n _upgradeToAndCall(_logic, _data, false);\\n }\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _implementation() internal view virtual override returns (address impl) {\\n return ERC1967Upgrade._getImplementation();\\n }\\n}\\n\",\"keccak256\":\"0xa2b22da3032e50b55f95ec1d13336102d675f341167aa76db571ef7f8bb7975d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/ERC1967/ERC1967Upgrade.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (proxy/ERC1967/ERC1967Upgrade.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../beacon/IBeacon.sol\\\";\\nimport \\\"../../interfaces/draft-IERC1822.sol\\\";\\nimport \\\"../../utils/Address.sol\\\";\\nimport \\\"../../utils/StorageSlot.sol\\\";\\n\\n/**\\n * @dev This abstract contract provides getters and event emitting update functions for\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\\n *\\n * _Available since v4.1._\\n *\\n * @custom:oz-upgrades-unsafe-allow delegatecall\\n */\\nabstract contract ERC1967Upgrade {\\n // This is the keccak-256 hash of \\\"eip1967.proxy.rollback\\\" subtracted by 1\\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\\n\\n /**\\n * @dev Storage slot with the address of the current implementation.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n /**\\n * @dev Emitted when the implementation is upgraded.\\n */\\n event Upgraded(address indexed implementation);\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _getImplementation() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 implementation slot.\\n */\\n function _setImplementation(address newImplementation) private {\\n require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n }\\n\\n /**\\n * @dev Perform implementation upgrade\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeTo(address newImplementation) internal {\\n _setImplementation(newImplementation);\\n emit Upgraded(newImplementation);\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCall(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _upgradeTo(newImplementation);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(newImplementation, data);\\n }\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCallUUPS(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n // Upgrades from old implementations will perform a rollback test. This test requires the new\\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\\n // this special case will break upgrade paths from old UUPS implementation to new ones.\\n if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) {\\n _setImplementation(newImplementation);\\n } else {\\n try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {\\n require(slot == _IMPLEMENTATION_SLOT, \\\"ERC1967Upgrade: unsupported proxiableUUID\\\");\\n } catch {\\n revert(\\\"ERC1967Upgrade: new implementation is not UUPS\\\");\\n }\\n _upgradeToAndCall(newImplementation, data, forceCall);\\n }\\n }\\n\\n /**\\n * @dev Storage slot with the admin of the contract.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.admin\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n /**\\n * @dev Emitted when the admin account has changed.\\n */\\n event AdminChanged(address previousAdmin, address newAdmin);\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _getAdmin() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 admin slot.\\n */\\n function _setAdmin(address newAdmin) private {\\n require(newAdmin != address(0), \\\"ERC1967: new admin is the zero address\\\");\\n StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n */\\n function _changeAdmin(address newAdmin) internal {\\n emit AdminChanged(_getAdmin(), newAdmin);\\n _setAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\\n */\\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\\n\\n /**\\n * @dev Emitted when the beacon is upgraded.\\n */\\n event BeaconUpgraded(address indexed beacon);\\n\\n /**\\n * @dev Returns the current beacon.\\n */\\n function _getBeacon() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_BEACON_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new beacon in the EIP1967 beacon slot.\\n */\\n function _setBeacon(address newBeacon) private {\\n require(Address.isContract(newBeacon), \\\"ERC1967: new beacon is not a contract\\\");\\n require(\\n Address.isContract(IBeacon(newBeacon).implementation()),\\n \\\"ERC1967: beacon implementation is not a contract\\\"\\n );\\n StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon;\\n }\\n\\n /**\\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\\n *\\n * Emits a {BeaconUpgraded} event.\\n */\\n function _upgradeBeaconToAndCall(\\n address newBeacon,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _setBeacon(newBeacon);\\n emit BeaconUpgraded(newBeacon);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xabf3f59bc0e5423eae45e459dbe92e7052c6983628d39008590edc852a62f94a\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (proxy/Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\\n * be specified by overriding the virtual {_implementation} function.\\n *\\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\\n * different contract through the {_delegate} function.\\n *\\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\\n */\\nabstract contract Proxy {\\n /**\\n * @dev Delegates the current call to `implementation`.\\n *\\n * This function does not return to its internal call site, it will return directly to the external caller.\\n */\\n function _delegate(address implementation) internal virtual {\\n assembly {\\n // Copy msg.data. We take full control of memory in this inline assembly\\n // block because it will not return to Solidity code. We overwrite the\\n // Solidity scratch pad at memory position 0.\\n calldatacopy(0, 0, calldatasize())\\n\\n // Call the implementation.\\n // out and outsize are 0 because we don't know the size yet.\\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\\n\\n // Copy the returned data.\\n returndatacopy(0, 0, returndatasize())\\n\\n switch result\\n // delegatecall returns 0 on error.\\n case 0 {\\n revert(0, returndatasize())\\n }\\n default {\\n return(0, returndatasize())\\n }\\n }\\n }\\n\\n /**\\n * @dev This is a virtual function that should be overridden so it returns the address to which the fallback function\\n * and {_fallback} should delegate.\\n */\\n function _implementation() internal view virtual returns (address);\\n\\n /**\\n * @dev Delegates the current call to the address returned by `_implementation()`.\\n *\\n * This function does not return to its internal call site, it will return directly to the external caller.\\n */\\n function _fallback() internal virtual {\\n _beforeFallback();\\n _delegate(_implementation());\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\\n * function in the contract matches the call data.\\n */\\n fallback() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data\\n * is empty.\\n */\\n receive() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`\\n * call, or as part of the Solidity `fallback` or `receive` functions.\\n *\\n * If overridden should call `super._beforeFallback()`.\\n */\\n function _beforeFallback() internal virtual {}\\n}\\n\",\"keccak256\":\"0xc130fe33f1b2132158531a87734153293f6d07bc263ff4ac90e85da9c82c0e27\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/beacon/IBeacon.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\\n */\\ninterface IBeacon {\\n /**\\n * @dev Must return an address that can be used as a delegate call target.\\n *\\n * {BeaconProxy} will check that this address is a contract.\\n */\\n function implementation() external view returns (address);\\n}\\n\",\"keccak256\":\"0xd50a3421ac379ccb1be435fa646d66a65c986b4924f0849839f08692f39dde61\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\n *\\n * _Available since v4.8._\\n */\\n function verifyCallResultFromTarget(\\n address target,\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n if (success) {\\n if (returndata.length == 0) {\\n // only check isContract if the call was successful and the return data is empty\\n // otherwise we already know that it was a contract\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n }\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason or using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xf96f969e24029d43d0df89e59d365f277021dac62b48e1c1e3ebe0acdd7f1ca1\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/StorageSlot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/StorageSlot.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for reading and writing primitive types to specific storage slots.\\n *\\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\\n * This library helps with reading and writing to such slots without the need for inline assembly.\\n *\\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\\n *\\n * Example usage to set ERC1967 implementation slot:\\n * ```\\n * contract ERC1967 {\\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n *\\n * function _getImplementation() internal view returns (address) {\\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n * }\\n *\\n * function _setImplementation(address newImplementation) internal {\\n * require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n * }\\n * }\\n * ```\\n *\\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\\n */\\nlibrary StorageSlot {\\n struct AddressSlot {\\n address value;\\n }\\n\\n struct BooleanSlot {\\n bool value;\\n }\\n\\n struct Bytes32Slot {\\n bytes32 value;\\n }\\n\\n struct Uint256Slot {\\n uint256 value;\\n }\\n\\n /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\\n */\\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\\n */\\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\\n */\\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd5c50c54bf02740ebd122ff06832546cb5fa84486d52695a9ccfd11666e0c81d\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x60806040526040516107ad3803806107ad83398101604081905261002291610319565b61002e82826000610035565b5050610436565b61003e8361006b565b60008251118061004b5750805b156100665761006483836100ab60201b6100291760201c565b505b505050565b610074816100d7565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b60606100d08383604051806060016040528060278152602001610786602791396101a9565b9392505050565b6100ea8161022260201b6100551760201c565b6101515760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b60648201526084015b60405180910390fd5b806101887f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc60001b61023160201b6100711760201c565b80546001600160a01b0319166001600160a01b039290921691909117905550565b6060600080856001600160a01b0316856040516101c691906103e7565b600060405180830381855af49150503d8060008114610201576040519150601f19603f3d011682016040523d82523d6000602084013e610206565b606091505b50909250905061021886838387610234565b9695505050505050565b6001600160a01b03163b151590565b90565b606083156102a357825160000361029c576001600160a01b0385163b61029c5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610148565b50816102ad565b6102ad83836102b5565b949350505050565b8151156102c55781518083602001fd5b8060405162461bcd60e51b81526004016101489190610403565b634e487b7160e01b600052604160045260246000fd5b60005b838110156103105781810151838201526020016102f8565b50506000910152565b6000806040838503121561032c57600080fd5b82516001600160a01b038116811461034357600080fd5b60208401519092506001600160401b038082111561036057600080fd5b818501915085601f83011261037457600080fd5b815181811115610386576103866102df565b604051601f8201601f19908116603f011681019083821181831017156103ae576103ae6102df565b816040528281528860208487010111156103c757600080fd5b6103d88360208301602088016102f5565b80955050505050509250929050565b600082516103f98184602087016102f5565b9190910192915050565b60208152600082518060208401526104228160408501602087016102f5565b601f01601f19169190910160400192915050565b610341806104456000396000f3fe60806040523661001357610011610017565b005b6100115b610027610022610074565b6100b9565b565b606061004e83836040518060600160405280602781526020016102e5602791396100dd565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b90565b60006100b47f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5473ffffffffffffffffffffffffffffffffffffffff1690565b905090565b3660008037600080366000845af43d6000803e8080156100d8573d6000f35b3d6000fd5b60606000808573ffffffffffffffffffffffffffffffffffffffff16856040516101079190610277565b600060405180830381855af49150503d8060008114610142576040519150601f19603f3d011682016040523d82523d6000602084013e610147565b606091505b509150915061015886838387610162565b9695505050505050565b606083156101fd5782516000036101f65773ffffffffffffffffffffffffffffffffffffffff85163b6101f6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064015b60405180910390fd5b5081610207565b610207838361020f565b949350505050565b81511561021f5781518083602001fd5b806040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016101ed9190610293565b60005b8381101561026e578181015183820152602001610256565b50506000910152565b60008251610289818460208701610253565b9190910192915050565b60208152600082518060208401526102b2816040850160208701610253565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a26469706673582212208d6f628b23c1e021c9b2ae38fc6a126b22b03b9629f5dfe1de8fc7f044229aec64736f6c63430008110033416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564", + "deployedBytecode": "0x60806040523661001357610011610017565b005b6100115b610027610022610074565b6100b9565b565b606061004e83836040518060600160405280602781526020016102e5602791396100dd565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b90565b60006100b47f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5473ffffffffffffffffffffffffffffffffffffffff1690565b905090565b3660008037600080366000845af43d6000803e8080156100d8573d6000f35b3d6000fd5b60606000808573ffffffffffffffffffffffffffffffffffffffff16856040516101079190610277565b600060405180830381855af49150503d8060008114610142576040519150601f19603f3d011682016040523d82523d6000602084013e610147565b606091505b509150915061015886838387610162565b9695505050505050565b606083156101fd5782516000036101f65773ffffffffffffffffffffffffffffffffffffffff85163b6101f6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064015b60405180910390fd5b5081610207565b610207838361020f565b949350505050565b81511561021f5781518083602001fd5b806040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016101ed9190610293565b60005b8381101561026e578181015183820152602001610256565b50506000910152565b60008251610289818460208701610253565b9190910192915050565b60208152600082518060208401526102b2816040850160208701610253565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a26469706673582212208d6f628b23c1e021c9b2ae38fc6a126b22b03b9629f5dfe1de8fc7f044229aec64736f6c63430008110033", + "devdoc": { + "details": "This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an implementation address that can be changed. This address is stored in storage in the location specified by https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the implementation behind the proxy.", + "kind": "dev", + "methods": { + "constructor": { + "details": "Initializes the upgradeable proxy with an initial implementation specified by `_logic`. If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded function call, and allows initializing the storage of the proxy like a Solidity constructor." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/deployments/coredao/Distributor_Implementation_2.json b/deployments/coredao/Distributor_Implementation_2.json new file mode 100644 index 0000000..491f457 --- /dev/null +++ b/deployments/coredao/Distributor_Implementation_2.json @@ -0,0 +1,1248 @@ +{ + "address": "0x918261fa5Dd9C3b1358cA911792E9bDF3c5CCa35", + "abi": [ + { + "inputs": [], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "InvalidDispute", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidLengths", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidProof", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidUninitializedRoot", + "type": "error" + }, + { + "inputs": [], + "name": "NoDispute", + "type": "error" + }, + { + "inputs": [], + "name": "NotGovernorOrGuardian", + "type": "error" + }, + { + "inputs": [], + "name": "NotTrusted", + "type": "error" + }, + { + "inputs": [], + "name": "NotWhitelisted", + "type": "error" + }, + { + "inputs": [], + "name": "UnresolvedDispute", + "type": "error" + }, + { + "inputs": [], + "name": "ZeroAddress", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "previousAdmin", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "AdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "beacon", + "type": "address" + } + ], + "name": "BeaconUpgraded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Claimed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "_disputeAmount", + "type": "uint256" + } + ], + "name": "DisputeAmountUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint48", + "name": "_disputePeriod", + "type": "uint48" + } + ], + "name": "DisputePeriodUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "bool", + "name": "valid", + "type": "bool" + } + ], + "name": "DisputeResolved", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "_disputeToken", + "type": "address" + } + ], + "name": "DisputeTokenUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "string", + "name": "reason", + "type": "string" + } + ], + "name": "Disputed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "isEnabled", + "type": "bool" + } + ], + "name": "OperatorClaimingToggled", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "isWhitelisted", + "type": "bool" + } + ], + "name": "OperatorToggled", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Recovered", + "type": "event" + }, + { + "anonymous": false, + "inputs": [], + "name": "Revoked", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "bytes32", + "name": "merkleRoot", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "ipfsHash", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "uint48", + "name": "endOfDisputePeriod", + "type": "uint48" + } + ], + "name": "TreeUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "eoa", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "trust", + "type": "bool" + } + ], + "name": "TrustedToggled", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "canUpdateMerkleRoot", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "users", + "type": "address[]" + }, + { + "internalType": "address[]", + "name": "tokens", + "type": "address[]" + }, + { + "internalType": "uint256[]", + "name": "amounts", + "type": "uint256[]" + }, + { + "internalType": "bytes32[][]", + "name": "proofs", + "type": "bytes32[][]" + } + ], + "name": "claim", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "claimed", + "outputs": [ + { + "internalType": "uint208", + "name": "amount", + "type": "uint208" + }, + { + "internalType": "uint48", + "name": "timestamp", + "type": "uint48" + }, + { + "internalType": "bytes32", + "name": "merkleRoot", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "core", + "outputs": [ + { + "internalType": "contract ICore", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "disputeAmount", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "disputePeriod", + "outputs": [ + { + "internalType": "uint48", + "name": "", + "type": "uint48" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "disputeToken", + "outputs": [ + { + "internalType": "contract IERC20", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "reason", + "type": "string" + } + ], + "name": "disputeTree", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "disputer", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "endOfDisputePeriod", + "outputs": [ + { + "internalType": "uint48", + "name": "", + "type": "uint48" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getMerkleRoot", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract ICore", + "name": "_core", + "type": "address" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "lastTree", + "outputs": [ + { + "internalType": "bytes32", + "name": "merkleRoot", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "ipfsHash", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "onlyOperatorCanClaim", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "operators", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "proxiableUUID", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "tokenAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amountToRecover", + "type": "uint256" + } + ], + "name": "recoverERC20", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bool", + "name": "valid", + "type": "bool" + } + ], + "name": "resolveDispute", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "revokeTree", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_disputeAmount", + "type": "uint256" + } + ], + "name": "setDisputeAmount", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint48", + "name": "_disputePeriod", + "type": "uint48" + } + ], + "name": "setDisputePeriod", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IERC20", + "name": "_disputeToken", + "type": "address" + } + ], + "name": "setDisputeToken", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "user", + "type": "address" + } + ], + "name": "toggleOnlyOperatorCanClaim", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "internalType": "address", + "name": "operator", + "type": "address" + } + ], + "name": "toggleOperator", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "eoa", + "type": "address" + } + ], + "name": "toggleTrusted", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "tree", + "outputs": [ + { + "internalType": "bytes32", + "name": "merkleRoot", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "ipfsHash", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "bytes32", + "name": "merkleRoot", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "ipfsHash", + "type": "bytes32" + } + ], + "internalType": "struct MerkleTree", + "name": "_tree", + "type": "tuple" + } + ], + "name": "updateTree", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "upgradeTo", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "upgradeToAndCall", + "outputs": [], + "stateMutability": "payable", + "type": "function" + } + ], + "transactionHash": "0x56d4b6a23146ca067c3df01a8a3a6965f99a54d351056c29f3c802b5f291df61", + "receipt": { + "to": null, + "from": "0x9f76a95AA7535bb0893cf88A146396e00ed21A12", + "contractAddress": "0x918261fa5Dd9C3b1358cA911792E9bDF3c5CCa35", + "transactionIndex": 0, + "gasUsed": "3096215", + "logsBloom": "0x00000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000800000000000000000200000400000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xc093311a67ed7e3432305750c4c6ac68f50a745b397f1864fb4a6e5f89d68055", + "transactionHash": "0x56d4b6a23146ca067c3df01a8a3a6965f99a54d351056c29f3c802b5f291df61", + "logs": [ + { + "transactionIndex": 0, + "blockNumber": 8867921, + "transactionHash": "0x56d4b6a23146ca067c3df01a8a3a6965f99a54d351056c29f3c802b5f291df61", + "address": "0x918261fa5Dd9C3b1358cA911792E9bDF3c5CCa35", + "topics": [ + "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000000001", + "logIndex": 0, + "blockHash": "0xc093311a67ed7e3432305750c4c6ac68f50a745b397f1864fb4a6e5f89d68055" + }, + { + "transactionIndex": 0, + "blockNumber": 8867921, + "transactionHash": "0x56d4b6a23146ca067c3df01a8a3a6965f99a54d351056c29f3c802b5f291df61", + "address": "0x918261fa5Dd9C3b1358cA911792E9bDF3c5CCa35", + "topics": [ + "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000000001", + "logIndex": 1, + "blockHash": "0xc093311a67ed7e3432305750c4c6ac68f50a745b397f1864fb4a6e5f89d68055" + } + ], + "blockNumber": 8867921, + "cumulativeGasUsed": "3096215", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 1, + "solcInputHash": "1d17a992f70400315a977c7229541e31", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"InvalidDispute\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidLengths\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidProof\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidUninitializedRoot\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NoDispute\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotGovernorOrGuardian\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotTrusted\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotWhitelisted\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"UnresolvedDispute\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ZeroAddress\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"previousAdmin\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"AdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"beacon\",\"type\":\"address\"}],\"name\":\"BeaconUpgraded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"Claimed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_disputeAmount\",\"type\":\"uint256\"}],\"name\":\"DisputeAmountUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint48\",\"name\":\"_disputePeriod\",\"type\":\"uint48\"}],\"name\":\"DisputePeriodUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"valid\",\"type\":\"bool\"}],\"name\":\"DisputeResolved\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_disputeToken\",\"type\":\"address\"}],\"name\":\"DisputeTokenUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"string\",\"name\":\"reason\",\"type\":\"string\"}],\"name\":\"Disputed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"isEnabled\",\"type\":\"bool\"}],\"name\":\"OperatorClaimingToggled\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"isWhitelisted\",\"type\":\"bool\"}],\"name\":\"OperatorToggled\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"Recovered\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[],\"name\":\"Revoked\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"merkleRoot\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"ipfsHash\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint48\",\"name\":\"endOfDisputePeriod\",\"type\":\"uint48\"}],\"name\":\"TreeUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"eoa\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"trust\",\"type\":\"bool\"}],\"name\":\"TrustedToggled\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"implementation\",\"type\":\"address\"}],\"name\":\"Upgraded\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"canUpdateMerkleRoot\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"users\",\"type\":\"address[]\"},{\"internalType\":\"address[]\",\"name\":\"tokens\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"},{\"internalType\":\"bytes32[][]\",\"name\":\"proofs\",\"type\":\"bytes32[][]\"}],\"name\":\"claim\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"claimed\",\"outputs\":[{\"internalType\":\"uint208\",\"name\":\"amount\",\"type\":\"uint208\"},{\"internalType\":\"uint48\",\"name\":\"timestamp\",\"type\":\"uint48\"},{\"internalType\":\"bytes32\",\"name\":\"merkleRoot\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"core\",\"outputs\":[{\"internalType\":\"contract ICore\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"disputeAmount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"disputePeriod\",\"outputs\":[{\"internalType\":\"uint48\",\"name\":\"\",\"type\":\"uint48\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"disputeToken\",\"outputs\":[{\"internalType\":\"contract IERC20\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"reason\",\"type\":\"string\"}],\"name\":\"disputeTree\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"disputer\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"endOfDisputePeriod\",\"outputs\":[{\"internalType\":\"uint48\",\"name\":\"\",\"type\":\"uint48\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getMerkleRoot\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract ICore\",\"name\":\"_core\",\"type\":\"address\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"lastTree\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"merkleRoot\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"ipfsHash\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"onlyOperatorCanClaim\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"operators\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"proxiableUUID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"tokenAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amountToRecover\",\"type\":\"uint256\"}],\"name\":\"recoverERC20\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bool\",\"name\":\"valid\",\"type\":\"bool\"}],\"name\":\"resolveDispute\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"revokeTree\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_disputeAmount\",\"type\":\"uint256\"}],\"name\":\"setDisputeAmount\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint48\",\"name\":\"_disputePeriod\",\"type\":\"uint48\"}],\"name\":\"setDisputePeriod\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract IERC20\",\"name\":\"_disputeToken\",\"type\":\"address\"}],\"name\":\"setDisputeToken\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"}],\"name\":\"toggleOnlyOperatorCanClaim\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"}],\"name\":\"toggleOperator\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"eoa\",\"type\":\"address\"}],\"name\":\"toggleTrusted\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"tree\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"merkleRoot\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"ipfsHash\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"merkleRoot\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"ipfsHash\",\"type\":\"bytes32\"}],\"internalType\":\"struct MerkleTree\",\"name\":\"_tree\",\"type\":\"tuple\"}],\"name\":\"updateTree\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"}],\"name\":\"upgradeTo\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"upgradeToAndCall\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"}],\"devdoc\":{\"author\":\"Angle Labs. Inc\",\"kind\":\"dev\",\"methods\":{\"claim(address[],address[],uint256[],bytes32[][])\":{\"details\":\"Anyone may call this function for anyone else, funds go to destination regardless, it's just a question of who provides the proof and pays the gas: `msg.sender` is used only for addresses that require a trusted operator\",\"params\":{\"amounts\":\"Amount of tokens that will be sent to the corresponding users\",\"proofs\":\"Array of hashes bridging from a leaf `(hash of user | token | amount)` to the Merkle root\",\"tokens\":\"ERC20 claimed\",\"users\":\"Recipient of tokens\"}},\"disputeTree(string)\":{\"details\":\"Requires a deposit of `disputeToken` that'll be slashed if the dispute is not acceptedIt is only possible to create a dispute within `disputePeriod` after each tree update\"},\"proxiableUUID()\":{\"details\":\"Implementation of the ERC1822 {proxiableUUID} function. This returns the storage slot used by the implementation. It is used to validate the implementation's compatibility when performing an upgrade. IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this function revert if invoked through a proxy. This is guaranteed by the `notDelegated` modifier.\"},\"resolveDispute(bool)\":{\"params\":{\"valid\":\"Whether the dispute was valid\"}},\"upgradeTo(address)\":{\"details\":\"Upgrade the implementation of the proxy to `newImplementation`. Calls {_authorizeUpgrade}. Emits an {Upgraded} event.\"},\"upgradeToAndCall(address,bytes)\":{\"details\":\"Upgrade the implementation of the proxy to `newImplementation`, and subsequently execute the function call encoded in `data`. Calls {_authorizeUpgrade}. Emits an {Upgraded} event.\"}},\"stateVariables\":{\"disputer\":{\"details\":\"Used to store if there is an ongoing dispute\"}},\"title\":\"Distributor\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"canUpdateMerkleRoot(address)\":{\"notice\":\"Trusted EOAs to update the Merkle root\"},\"claim(address[],address[],uint256[],bytes32[][])\":{\"notice\":\"Claims rewards for a given set of users\"},\"claimed(address,address)\":{\"notice\":\"Mapping user -> token -> amount to track claimed amounts\"},\"core()\":{\"notice\":\"`Core` contract handling access control\"},\"disputeAmount()\":{\"notice\":\"Amount to deposit to freeze the roots update\"},\"disputePeriod()\":{\"notice\":\"Time after which a change in a tree becomes effective, in EPOCH_DURATION\"},\"disputeToken()\":{\"notice\":\"Token to deposit to freeze the roots update\"},\"disputeTree(string)\":{\"notice\":\"Freezes the Merkle tree update until the dispute is resolved\"},\"disputer()\":{\"notice\":\"Address which created the dispute\"},\"endOfDisputePeriod()\":{\"notice\":\"When the current tree will become valid\"},\"getMerkleRoot()\":{\"notice\":\"Returns the MerkleRoot that is currently live for the contract\"},\"lastTree()\":{\"notice\":\"Tree that was in place in the contract before the last `tree` update\"},\"onlyOperatorCanClaim(address)\":{\"notice\":\"Whether or not to disable permissionless claiming\"},\"operators(address,address)\":{\"notice\":\"user -> operator -> authorisation to claim\"},\"recoverERC20(address,address,uint256)\":{\"notice\":\"Recovers any ERC20 token\"},\"resolveDispute(bool)\":{\"notice\":\"Resolve the ongoing dispute, if any\"},\"revokeTree()\":{\"notice\":\"Allows the governor or the guardian of this contract to fallback to the last version of the tree immediately\"},\"setDisputeAmount(uint256)\":{\"notice\":\"Sets the amount of `disputeToken` used as a caution during disputes\"},\"setDisputePeriod(uint48)\":{\"notice\":\"Sets the dispute period after which a tree update becomes effective\"},\"setDisputeToken(address)\":{\"notice\":\"Sets the token used as a caution during disputes\"},\"toggleOnlyOperatorCanClaim(address)\":{\"notice\":\"Toggles permissioned claiming for a given user\"},\"toggleOperator(address,address)\":{\"notice\":\"Toggles whitelisting for a given user and a given operator\"},\"toggleTrusted(address)\":{\"notice\":\"Adds or removes EOAs which are trusted to update the Merkle root\"},\"tree()\":{\"notice\":\"Tree of claimable tokens through this contract\"},\"updateTree((bytes32,bytes32))\":{\"notice\":\"Updates Merkle Tree\"}},\"notice\":\"Allows LPs on AMMs with concentrated liquidity to claim the rewards that were distributed to them\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/Distributor.sol\":\"Distributor\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":100000},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts-upgradeable/interfaces/draft-IERC1822Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\\n * proxy whose upgrades are fully controlled by the current implementation.\\n */\\ninterface IERC1822ProxiableUpgradeable {\\n /**\\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\\n * address.\\n *\\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\\n * function revert if invoked through a proxy.\\n */\\n function proxiableUUID() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0x77c89f893e403efc6929ba842b7ccf6534d4ffe03afe31670b4a528c0ad78c0f\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/proxy/ERC1967/ERC1967UpgradeUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (proxy/ERC1967/ERC1967Upgrade.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../beacon/IBeaconUpgradeable.sol\\\";\\nimport \\\"../../interfaces/draft-IERC1822Upgradeable.sol\\\";\\nimport \\\"../../utils/AddressUpgradeable.sol\\\";\\nimport \\\"../../utils/StorageSlotUpgradeable.sol\\\";\\nimport \\\"../utils/Initializable.sol\\\";\\n\\n/**\\n * @dev This abstract contract provides getters and event emitting update functions for\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\\n *\\n * _Available since v4.1._\\n *\\n * @custom:oz-upgrades-unsafe-allow delegatecall\\n */\\nabstract contract ERC1967UpgradeUpgradeable is Initializable {\\n function __ERC1967Upgrade_init() internal onlyInitializing {\\n }\\n\\n function __ERC1967Upgrade_init_unchained() internal onlyInitializing {\\n }\\n // This is the keccak-256 hash of \\\"eip1967.proxy.rollback\\\" subtracted by 1\\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\\n\\n /**\\n * @dev Storage slot with the address of the current implementation.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n /**\\n * @dev Emitted when the implementation is upgraded.\\n */\\n event Upgraded(address indexed implementation);\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _getImplementation() internal view returns (address) {\\n return StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 implementation slot.\\n */\\n function _setImplementation(address newImplementation) private {\\n require(AddressUpgradeable.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n }\\n\\n /**\\n * @dev Perform implementation upgrade\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeTo(address newImplementation) internal {\\n _setImplementation(newImplementation);\\n emit Upgraded(newImplementation);\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCall(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _upgradeTo(newImplementation);\\n if (data.length > 0 || forceCall) {\\n _functionDelegateCall(newImplementation, data);\\n }\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCallUUPS(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n // Upgrades from old implementations will perform a rollback test. This test requires the new\\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\\n // this special case will break upgrade paths from old UUPS implementation to new ones.\\n if (StorageSlotUpgradeable.getBooleanSlot(_ROLLBACK_SLOT).value) {\\n _setImplementation(newImplementation);\\n } else {\\n try IERC1822ProxiableUpgradeable(newImplementation).proxiableUUID() returns (bytes32 slot) {\\n require(slot == _IMPLEMENTATION_SLOT, \\\"ERC1967Upgrade: unsupported proxiableUUID\\\");\\n } catch {\\n revert(\\\"ERC1967Upgrade: new implementation is not UUPS\\\");\\n }\\n _upgradeToAndCall(newImplementation, data, forceCall);\\n }\\n }\\n\\n /**\\n * @dev Storage slot with the admin of the contract.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.admin\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n /**\\n * @dev Emitted when the admin account has changed.\\n */\\n event AdminChanged(address previousAdmin, address newAdmin);\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _getAdmin() internal view returns (address) {\\n return StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 admin slot.\\n */\\n function _setAdmin(address newAdmin) private {\\n require(newAdmin != address(0), \\\"ERC1967: new admin is the zero address\\\");\\n StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n */\\n function _changeAdmin(address newAdmin) internal {\\n emit AdminChanged(_getAdmin(), newAdmin);\\n _setAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\\n */\\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\\n\\n /**\\n * @dev Emitted when the beacon is upgraded.\\n */\\n event BeaconUpgraded(address indexed beacon);\\n\\n /**\\n * @dev Returns the current beacon.\\n */\\n function _getBeacon() internal view returns (address) {\\n return StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new beacon in the EIP1967 beacon slot.\\n */\\n function _setBeacon(address newBeacon) private {\\n require(AddressUpgradeable.isContract(newBeacon), \\\"ERC1967: new beacon is not a contract\\\");\\n require(\\n AddressUpgradeable.isContract(IBeaconUpgradeable(newBeacon).implementation()),\\n \\\"ERC1967: beacon implementation is not a contract\\\"\\n );\\n StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value = newBeacon;\\n }\\n\\n /**\\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\\n *\\n * Emits a {BeaconUpgraded} event.\\n */\\n function _upgradeBeaconToAndCall(\\n address newBeacon,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _setBeacon(newBeacon);\\n emit BeaconUpgraded(newBeacon);\\n if (data.length > 0 || forceCall) {\\n _functionDelegateCall(IBeaconUpgradeable(newBeacon).implementation(), data);\\n }\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function _functionDelegateCall(address target, bytes memory data) private returns (bytes memory) {\\n require(AddressUpgradeable.isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n // solhint-disable-next-line avoid-low-level-calls\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return AddressUpgradeable.verifyCallResult(success, returndata, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[50] private __gap;\\n}\\n\",\"keccak256\":\"0x315887e846f1e5f8d8fa535a229d318bb9290aaa69485117f1ee8a9a6b3be823\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/proxy/beacon/IBeaconUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\\n */\\ninterface IBeaconUpgradeable {\\n /**\\n * @dev Must return an address that can be used as a delegate call target.\\n *\\n * {BeaconProxy} will check that this address is a contract.\\n */\\n function implementation() external view returns (address);\\n}\\n\",\"keccak256\":\"0x24b86ac8c005b8c654fbf6ac34a5a4f61580d7273541e83e013e89d66fbf0908\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.1) (proxy/utils/Initializable.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../../utils/AddressUpgradeable.sol\\\";\\n\\n/**\\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\\n *\\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\\n * reused. This mechanism prevents re-execution of each \\\"step\\\" but allows the creation of new initialization steps in\\n * case an upgrade adds a module that needs to be initialized.\\n *\\n * For example:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * contract MyToken is ERC20Upgradeable {\\n * function initialize() initializer public {\\n * __ERC20_init(\\\"MyToken\\\", \\\"MTK\\\");\\n * }\\n * }\\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\\n * function initializeV2() reinitializer(2) public {\\n * __ERC20Permit_init(\\\"MyToken\\\");\\n * }\\n * }\\n * ```\\n *\\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\\n *\\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\\n *\\n * [CAUTION]\\n * ====\\n * Avoid leaving a contract uninitialized.\\n *\\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * /// @custom:oz-upgrades-unsafe-allow constructor\\n * constructor() {\\n * _disableInitializers();\\n * }\\n * ```\\n * ====\\n */\\nabstract contract Initializable {\\n /**\\n * @dev Indicates that the contract has been initialized.\\n * @custom:oz-retyped-from bool\\n */\\n uint8 private _initialized;\\n\\n /**\\n * @dev Indicates that the contract is in the process of being initialized.\\n */\\n bool private _initializing;\\n\\n /**\\n * @dev Triggered when the contract has been initialized or reinitialized.\\n */\\n event Initialized(uint8 version);\\n\\n /**\\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\\n * `onlyInitializing` functions can be used to initialize parent contracts.\\n *\\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\\n * constructor.\\n *\\n * Emits an {Initialized} event.\\n */\\n modifier initializer() {\\n bool isTopLevelCall = !_initializing;\\n require(\\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\\n \\\"Initializable: contract is already initialized\\\"\\n );\\n _initialized = 1;\\n if (isTopLevelCall) {\\n _initializing = true;\\n }\\n _;\\n if (isTopLevelCall) {\\n _initializing = false;\\n emit Initialized(1);\\n }\\n }\\n\\n /**\\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\\n * used to initialize parent contracts.\\n *\\n * A reinitializer may be used after the original initialization step. This is essential to configure modules that\\n * are added through upgrades and that require initialization.\\n *\\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\\n * cannot be nested. If one is invoked in the context of another, execution will revert.\\n *\\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\\n * a contract, executing them in the right order is up to the developer or operator.\\n *\\n * WARNING: setting the version to 255 will prevent any future reinitialization.\\n *\\n * Emits an {Initialized} event.\\n */\\n modifier reinitializer(uint8 version) {\\n require(!_initializing && _initialized < version, \\\"Initializable: contract is already initialized\\\");\\n _initialized = version;\\n _initializing = true;\\n _;\\n _initializing = false;\\n emit Initialized(version);\\n }\\n\\n /**\\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\\n */\\n modifier onlyInitializing() {\\n require(_initializing, \\\"Initializable: contract is not initializing\\\");\\n _;\\n }\\n\\n /**\\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\\n * through proxies.\\n *\\n * Emits an {Initialized} event the first time it is successfully executed.\\n */\\n function _disableInitializers() internal virtual {\\n require(!_initializing, \\\"Initializable: contract is initializing\\\");\\n if (_initialized < type(uint8).max) {\\n _initialized = type(uint8).max;\\n emit Initialized(type(uint8).max);\\n }\\n }\\n\\n /**\\n * @dev Returns the highest version that has been initialized. See {reinitializer}.\\n */\\n function _getInitializedVersion() internal view returns (uint8) {\\n return _initialized;\\n }\\n\\n /**\\n * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.\\n */\\n function _isInitializing() internal view returns (bool) {\\n return _initializing;\\n }\\n}\\n\",\"keccak256\":\"0x037c334add4b033ad3493038c25be1682d78c00992e1acb0e2795caff3925271\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (proxy/utils/UUPSUpgradeable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../interfaces/draft-IERC1822Upgradeable.sol\\\";\\nimport \\\"../ERC1967/ERC1967UpgradeUpgradeable.sol\\\";\\nimport \\\"./Initializable.sol\\\";\\n\\n/**\\n * @dev An upgradeability mechanism designed for UUPS proxies. The functions included here can perform an upgrade of an\\n * {ERC1967Proxy}, when this contract is set as the implementation behind such a proxy.\\n *\\n * A security mechanism ensures that an upgrade does not turn off upgradeability accidentally, although this risk is\\n * reinstated if the upgrade retains upgradeability but removes the security mechanism, e.g. by replacing\\n * `UUPSUpgradeable` with a custom implementation of upgrades.\\n *\\n * The {_authorizeUpgrade} function must be overridden to include access restriction to the upgrade mechanism.\\n *\\n * _Available since v4.1._\\n */\\nabstract contract UUPSUpgradeable is Initializable, IERC1822ProxiableUpgradeable, ERC1967UpgradeUpgradeable {\\n function __UUPSUpgradeable_init() internal onlyInitializing {\\n }\\n\\n function __UUPSUpgradeable_init_unchained() internal onlyInitializing {\\n }\\n /// @custom:oz-upgrades-unsafe-allow state-variable-immutable state-variable-assignment\\n address private immutable __self = address(this);\\n\\n /**\\n * @dev Check that the execution is being performed through a delegatecall call and that the execution context is\\n * a proxy contract with an implementation (as defined in ERC1967) pointing to self. This should only be the case\\n * for UUPS and transparent proxies that are using the current contract as their implementation. Execution of a\\n * function through ERC1167 minimal proxies (clones) would not normally pass this test, but is not guaranteed to\\n * fail.\\n */\\n modifier onlyProxy() {\\n require(address(this) != __self, \\\"Function must be called through delegatecall\\\");\\n require(_getImplementation() == __self, \\\"Function must be called through active proxy\\\");\\n _;\\n }\\n\\n /**\\n * @dev Check that the execution is not being performed through a delegate call. This allows a function to be\\n * callable on the implementing contract but not through proxies.\\n */\\n modifier notDelegated() {\\n require(address(this) == __self, \\\"UUPSUpgradeable: must not be called through delegatecall\\\");\\n _;\\n }\\n\\n /**\\n * @dev Implementation of the ERC1822 {proxiableUUID} function. This returns the storage slot used by the\\n * implementation. It is used to validate the implementation's compatibility when performing an upgrade.\\n *\\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\\n * function revert if invoked through a proxy. This is guaranteed by the `notDelegated` modifier.\\n */\\n function proxiableUUID() external view virtual override notDelegated returns (bytes32) {\\n return _IMPLEMENTATION_SLOT;\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy to `newImplementation`.\\n *\\n * Calls {_authorizeUpgrade}.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function upgradeTo(address newImplementation) external virtual onlyProxy {\\n _authorizeUpgrade(newImplementation);\\n _upgradeToAndCallUUPS(newImplementation, new bytes(0), false);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy to `newImplementation`, and subsequently execute the function call\\n * encoded in `data`.\\n *\\n * Calls {_authorizeUpgrade}.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function upgradeToAndCall(address newImplementation, bytes memory data) external payable virtual onlyProxy {\\n _authorizeUpgrade(newImplementation);\\n _upgradeToAndCallUUPS(newImplementation, data, true);\\n }\\n\\n /**\\n * @dev Function that should revert when `msg.sender` is not authorized to upgrade the contract. Called by\\n * {upgradeTo} and {upgradeToAndCall}.\\n *\\n * Normally, this function will use an xref:access.adoc[access control] modifier such as {Ownable-onlyOwner}.\\n *\\n * ```solidity\\n * function _authorizeUpgrade(address) internal override onlyOwner {}\\n * ```\\n */\\n function _authorizeUpgrade(address newImplementation) internal virtual;\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[50] private __gap;\\n}\\n\",\"keccak256\":\"0x7967d130887c4b40666cd88f8744691d4527039a1b2a38aa0de41481ef646778\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary AddressUpgradeable {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\n *\\n * _Available since v4.8._\\n */\\n function verifyCallResultFromTarget(\\n address target,\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n if (success) {\\n if (returndata.length == 0) {\\n // only check isContract if the call was successful and the return data is empty\\n // otherwise we already know that it was a contract\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n }\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason or using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x2edcb41c121abc510932e8d83ff8b82cf9cdde35e7c297622f5c29ef0af25183\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/StorageSlotUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/StorageSlot.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for reading and writing primitive types to specific storage slots.\\n *\\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\\n * This library helps with reading and writing to such slots without the need for inline assembly.\\n *\\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\\n *\\n * Example usage to set ERC1967 implementation slot:\\n * ```\\n * contract ERC1967 {\\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n *\\n * function _getImplementation() internal view returns (address) {\\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n * }\\n *\\n * function _setImplementation(address newImplementation) internal {\\n * require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n * }\\n * }\\n * ```\\n *\\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\\n */\\nlibrary StorageSlotUpgradeable {\\n struct AddressSlot {\\n address value;\\n }\\n\\n struct BooleanSlot {\\n bool value;\\n }\\n\\n struct Bytes32Slot {\\n bytes32 value;\\n }\\n\\n struct Uint256Slot {\\n uint256 value;\\n }\\n\\n /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\\n */\\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\\n */\\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\\n */\\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0x09864aea84f01e39313375b5610c73a3c1c68abbdc51e5ccdd25ff977fdadf9a\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 amount\\n ) external returns (bool);\\n}\\n\",\"keccak256\":\"0x9750c6b834f7b43000631af5cc30001c5f547b3ceb3635488f140f60e897ea6b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\\n *\\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\\n * need to send a transaction, and thus is not required to hold Ether at all.\\n */\\ninterface IERC20Permit {\\n /**\\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\\n * given ``owner``'s signed approval.\\n *\\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\\n * ordering also apply here.\\n *\\n * Emits an {Approval} event.\\n *\\n * Requirements:\\n *\\n * - `spender` cannot be the zero address.\\n * - `deadline` must be a timestamp in the future.\\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\\n * over the EIP712-formatted function arguments.\\n * - the signature must use ``owner``'s current nonce (see {nonces}).\\n *\\n * For more information on the signature format, see the\\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\\n * section].\\n */\\n function permit(\\n address owner,\\n address spender,\\n uint256 value,\\n uint256 deadline,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) external;\\n\\n /**\\n * @dev Returns the current nonce for `owner`. This value must be\\n * included whenever a signature is generated for {permit}.\\n *\\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\\n * prevents a signature from being used multiple times.\\n */\\n function nonces(address owner) external view returns (uint256);\\n\\n /**\\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\\n */\\n // solhint-disable-next-line func-name-mixedcase\\n function DOMAIN_SEPARATOR() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0xf41ca991f30855bf80ffd11e9347856a517b977f0a6c2d52e6421a99b7840329\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/utils/SafeERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC20.sol\\\";\\nimport \\\"../extensions/draft-IERC20Permit.sol\\\";\\nimport \\\"../../../utils/Address.sol\\\";\\n\\n/**\\n * @title SafeERC20\\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\\n * contract returns false). Tokens that return no value (and instead revert or\\n * throw on failure) are also supported, non-reverting calls are assumed to be\\n * successful.\\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\\n */\\nlibrary SafeERC20 {\\n using Address for address;\\n\\n function safeTransfer(\\n IERC20 token,\\n address to,\\n uint256 value\\n ) internal {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\\n }\\n\\n function safeTransferFrom(\\n IERC20 token,\\n address from,\\n address to,\\n uint256 value\\n ) internal {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\\n }\\n\\n /**\\n * @dev Deprecated. This function has issues similar to the ones found in\\n * {IERC20-approve}, and its usage is discouraged.\\n *\\n * Whenever possible, use {safeIncreaseAllowance} and\\n * {safeDecreaseAllowance} instead.\\n */\\n function safeApprove(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n // safeApprove should only be called when setting an initial allowance,\\n // or when resetting it to zero. To increase and decrease it, use\\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\\n require(\\n (value == 0) || (token.allowance(address(this), spender) == 0),\\n \\\"SafeERC20: approve from non-zero to non-zero allowance\\\"\\n );\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\\n }\\n\\n function safeIncreaseAllowance(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n uint256 newAllowance = token.allowance(address(this), spender) + value;\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\n }\\n\\n function safeDecreaseAllowance(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n unchecked {\\n uint256 oldAllowance = token.allowance(address(this), spender);\\n require(oldAllowance >= value, \\\"SafeERC20: decreased allowance below zero\\\");\\n uint256 newAllowance = oldAllowance - value;\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\n }\\n }\\n\\n function safePermit(\\n IERC20Permit token,\\n address owner,\\n address spender,\\n uint256 value,\\n uint256 deadline,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) internal {\\n uint256 nonceBefore = token.nonces(owner);\\n token.permit(owner, spender, value, deadline, v, r, s);\\n uint256 nonceAfter = token.nonces(owner);\\n require(nonceAfter == nonceBefore + 1, \\\"SafeERC20: permit did not succeed\\\");\\n }\\n\\n /**\\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\\n * on the return value: the return value is optional (but if data is returned, it must not be false).\\n * @param token The token targeted by the call.\\n * @param data The call data (encoded using abi.encode or one of its variants).\\n */\\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\\n // the target address contains contract code and also asserts for success in the low-level call.\\n\\n bytes memory returndata = address(token).functionCall(data, \\\"SafeERC20: low-level call failed\\\");\\n if (returndata.length > 0) {\\n // Return data is optional\\n require(abi.decode(returndata, (bool)), \\\"SafeERC20: ERC20 operation did not succeed\\\");\\n }\\n }\\n}\\n\",\"keccak256\":\"0x9b72f93be69ca894d8492c244259615c4a742afc8d63720dbc8bb81087d9b238\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\n *\\n * _Available since v4.8._\\n */\\n function verifyCallResultFromTarget(\\n address target,\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n if (success) {\\n if (returndata.length == 0) {\\n // only check isContract if the call was successful and the return data is empty\\n // otherwise we already know that it was a contract\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n }\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason or using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xf96f969e24029d43d0df89e59d365f277021dac62b48e1c1e3ebe0acdd7f1ca1\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/math/SafeCast.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SafeCast.sol)\\n// This file was procedurally generated from scripts/generate/templates/SafeCast.js.\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Wrappers over Solidity's uintXX/intXX casting operators with added overflow\\n * checks.\\n *\\n * Downcasting from uint256/int256 in Solidity does not revert on overflow. This can\\n * easily result in undesired exploitation or bugs, since developers usually\\n * assume that overflows raise errors. `SafeCast` restores this intuition by\\n * reverting the transaction when such an operation overflows.\\n *\\n * Using this library instead of the unchecked operations eliminates an entire\\n * class of bugs, so it's recommended to use it always.\\n *\\n * Can be combined with {SafeMath} and {SignedSafeMath} to extend it to smaller types, by performing\\n * all math on `uint256` and `int256` and then downcasting.\\n */\\nlibrary SafeCast {\\n /**\\n * @dev Returns the downcasted uint248 from uint256, reverting on\\n * overflow (when the input is greater than largest uint248).\\n *\\n * Counterpart to Solidity's `uint248` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 248 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint248(uint256 value) internal pure returns (uint248) {\\n require(value <= type(uint248).max, \\\"SafeCast: value doesn't fit in 248 bits\\\");\\n return uint248(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint240 from uint256, reverting on\\n * overflow (when the input is greater than largest uint240).\\n *\\n * Counterpart to Solidity's `uint240` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 240 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint240(uint256 value) internal pure returns (uint240) {\\n require(value <= type(uint240).max, \\\"SafeCast: value doesn't fit in 240 bits\\\");\\n return uint240(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint232 from uint256, reverting on\\n * overflow (when the input is greater than largest uint232).\\n *\\n * Counterpart to Solidity's `uint232` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 232 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint232(uint256 value) internal pure returns (uint232) {\\n require(value <= type(uint232).max, \\\"SafeCast: value doesn't fit in 232 bits\\\");\\n return uint232(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint224 from uint256, reverting on\\n * overflow (when the input is greater than largest uint224).\\n *\\n * Counterpart to Solidity's `uint224` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 224 bits\\n *\\n * _Available since v4.2._\\n */\\n function toUint224(uint256 value) internal pure returns (uint224) {\\n require(value <= type(uint224).max, \\\"SafeCast: value doesn't fit in 224 bits\\\");\\n return uint224(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint216 from uint256, reverting on\\n * overflow (when the input is greater than largest uint216).\\n *\\n * Counterpart to Solidity's `uint216` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 216 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint216(uint256 value) internal pure returns (uint216) {\\n require(value <= type(uint216).max, \\\"SafeCast: value doesn't fit in 216 bits\\\");\\n return uint216(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint208 from uint256, reverting on\\n * overflow (when the input is greater than largest uint208).\\n *\\n * Counterpart to Solidity's `uint208` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 208 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint208(uint256 value) internal pure returns (uint208) {\\n require(value <= type(uint208).max, \\\"SafeCast: value doesn't fit in 208 bits\\\");\\n return uint208(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint200 from uint256, reverting on\\n * overflow (when the input is greater than largest uint200).\\n *\\n * Counterpart to Solidity's `uint200` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 200 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint200(uint256 value) internal pure returns (uint200) {\\n require(value <= type(uint200).max, \\\"SafeCast: value doesn't fit in 200 bits\\\");\\n return uint200(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint192 from uint256, reverting on\\n * overflow (when the input is greater than largest uint192).\\n *\\n * Counterpart to Solidity's `uint192` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 192 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint192(uint256 value) internal pure returns (uint192) {\\n require(value <= type(uint192).max, \\\"SafeCast: value doesn't fit in 192 bits\\\");\\n return uint192(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint184 from uint256, reverting on\\n * overflow (when the input is greater than largest uint184).\\n *\\n * Counterpart to Solidity's `uint184` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 184 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint184(uint256 value) internal pure returns (uint184) {\\n require(value <= type(uint184).max, \\\"SafeCast: value doesn't fit in 184 bits\\\");\\n return uint184(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint176 from uint256, reverting on\\n * overflow (when the input is greater than largest uint176).\\n *\\n * Counterpart to Solidity's `uint176` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 176 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint176(uint256 value) internal pure returns (uint176) {\\n require(value <= type(uint176).max, \\\"SafeCast: value doesn't fit in 176 bits\\\");\\n return uint176(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint168 from uint256, reverting on\\n * overflow (when the input is greater than largest uint168).\\n *\\n * Counterpart to Solidity's `uint168` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 168 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint168(uint256 value) internal pure returns (uint168) {\\n require(value <= type(uint168).max, \\\"SafeCast: value doesn't fit in 168 bits\\\");\\n return uint168(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint160 from uint256, reverting on\\n * overflow (when the input is greater than largest uint160).\\n *\\n * Counterpart to Solidity's `uint160` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 160 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint160(uint256 value) internal pure returns (uint160) {\\n require(value <= type(uint160).max, \\\"SafeCast: value doesn't fit in 160 bits\\\");\\n return uint160(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint152 from uint256, reverting on\\n * overflow (when the input is greater than largest uint152).\\n *\\n * Counterpart to Solidity's `uint152` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 152 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint152(uint256 value) internal pure returns (uint152) {\\n require(value <= type(uint152).max, \\\"SafeCast: value doesn't fit in 152 bits\\\");\\n return uint152(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint144 from uint256, reverting on\\n * overflow (when the input is greater than largest uint144).\\n *\\n * Counterpart to Solidity's `uint144` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 144 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint144(uint256 value) internal pure returns (uint144) {\\n require(value <= type(uint144).max, \\\"SafeCast: value doesn't fit in 144 bits\\\");\\n return uint144(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint136 from uint256, reverting on\\n * overflow (when the input is greater than largest uint136).\\n *\\n * Counterpart to Solidity's `uint136` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 136 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint136(uint256 value) internal pure returns (uint136) {\\n require(value <= type(uint136).max, \\\"SafeCast: value doesn't fit in 136 bits\\\");\\n return uint136(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint128 from uint256, reverting on\\n * overflow (when the input is greater than largest uint128).\\n *\\n * Counterpart to Solidity's `uint128` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 128 bits\\n *\\n * _Available since v2.5._\\n */\\n function toUint128(uint256 value) internal pure returns (uint128) {\\n require(value <= type(uint128).max, \\\"SafeCast: value doesn't fit in 128 bits\\\");\\n return uint128(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint120 from uint256, reverting on\\n * overflow (when the input is greater than largest uint120).\\n *\\n * Counterpart to Solidity's `uint120` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 120 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint120(uint256 value) internal pure returns (uint120) {\\n require(value <= type(uint120).max, \\\"SafeCast: value doesn't fit in 120 bits\\\");\\n return uint120(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint112 from uint256, reverting on\\n * overflow (when the input is greater than largest uint112).\\n *\\n * Counterpart to Solidity's `uint112` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 112 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint112(uint256 value) internal pure returns (uint112) {\\n require(value <= type(uint112).max, \\\"SafeCast: value doesn't fit in 112 bits\\\");\\n return uint112(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint104 from uint256, reverting on\\n * overflow (when the input is greater than largest uint104).\\n *\\n * Counterpart to Solidity's `uint104` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 104 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint104(uint256 value) internal pure returns (uint104) {\\n require(value <= type(uint104).max, \\\"SafeCast: value doesn't fit in 104 bits\\\");\\n return uint104(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint96 from uint256, reverting on\\n * overflow (when the input is greater than largest uint96).\\n *\\n * Counterpart to Solidity's `uint96` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 96 bits\\n *\\n * _Available since v4.2._\\n */\\n function toUint96(uint256 value) internal pure returns (uint96) {\\n require(value <= type(uint96).max, \\\"SafeCast: value doesn't fit in 96 bits\\\");\\n return uint96(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint88 from uint256, reverting on\\n * overflow (when the input is greater than largest uint88).\\n *\\n * Counterpart to Solidity's `uint88` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 88 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint88(uint256 value) internal pure returns (uint88) {\\n require(value <= type(uint88).max, \\\"SafeCast: value doesn't fit in 88 bits\\\");\\n return uint88(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint80 from uint256, reverting on\\n * overflow (when the input is greater than largest uint80).\\n *\\n * Counterpart to Solidity's `uint80` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 80 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint80(uint256 value) internal pure returns (uint80) {\\n require(value <= type(uint80).max, \\\"SafeCast: value doesn't fit in 80 bits\\\");\\n return uint80(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint72 from uint256, reverting on\\n * overflow (when the input is greater than largest uint72).\\n *\\n * Counterpart to Solidity's `uint72` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 72 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint72(uint256 value) internal pure returns (uint72) {\\n require(value <= type(uint72).max, \\\"SafeCast: value doesn't fit in 72 bits\\\");\\n return uint72(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint64 from uint256, reverting on\\n * overflow (when the input is greater than largest uint64).\\n *\\n * Counterpart to Solidity's `uint64` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 64 bits\\n *\\n * _Available since v2.5._\\n */\\n function toUint64(uint256 value) internal pure returns (uint64) {\\n require(value <= type(uint64).max, \\\"SafeCast: value doesn't fit in 64 bits\\\");\\n return uint64(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint56 from uint256, reverting on\\n * overflow (when the input is greater than largest uint56).\\n *\\n * Counterpart to Solidity's `uint56` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 56 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint56(uint256 value) internal pure returns (uint56) {\\n require(value <= type(uint56).max, \\\"SafeCast: value doesn't fit in 56 bits\\\");\\n return uint56(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint48 from uint256, reverting on\\n * overflow (when the input is greater than largest uint48).\\n *\\n * Counterpart to Solidity's `uint48` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 48 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint48(uint256 value) internal pure returns (uint48) {\\n require(value <= type(uint48).max, \\\"SafeCast: value doesn't fit in 48 bits\\\");\\n return uint48(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint40 from uint256, reverting on\\n * overflow (when the input is greater than largest uint40).\\n *\\n * Counterpart to Solidity's `uint40` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 40 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint40(uint256 value) internal pure returns (uint40) {\\n require(value <= type(uint40).max, \\\"SafeCast: value doesn't fit in 40 bits\\\");\\n return uint40(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint32 from uint256, reverting on\\n * overflow (when the input is greater than largest uint32).\\n *\\n * Counterpart to Solidity's `uint32` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 32 bits\\n *\\n * _Available since v2.5._\\n */\\n function toUint32(uint256 value) internal pure returns (uint32) {\\n require(value <= type(uint32).max, \\\"SafeCast: value doesn't fit in 32 bits\\\");\\n return uint32(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint24 from uint256, reverting on\\n * overflow (when the input is greater than largest uint24).\\n *\\n * Counterpart to Solidity's `uint24` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 24 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint24(uint256 value) internal pure returns (uint24) {\\n require(value <= type(uint24).max, \\\"SafeCast: value doesn't fit in 24 bits\\\");\\n return uint24(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint16 from uint256, reverting on\\n * overflow (when the input is greater than largest uint16).\\n *\\n * Counterpart to Solidity's `uint16` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 16 bits\\n *\\n * _Available since v2.5._\\n */\\n function toUint16(uint256 value) internal pure returns (uint16) {\\n require(value <= type(uint16).max, \\\"SafeCast: value doesn't fit in 16 bits\\\");\\n return uint16(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint8 from uint256, reverting on\\n * overflow (when the input is greater than largest uint8).\\n *\\n * Counterpart to Solidity's `uint8` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 8 bits\\n *\\n * _Available since v2.5._\\n */\\n function toUint8(uint256 value) internal pure returns (uint8) {\\n require(value <= type(uint8).max, \\\"SafeCast: value doesn't fit in 8 bits\\\");\\n return uint8(value);\\n }\\n\\n /**\\n * @dev Converts a signed int256 into an unsigned uint256.\\n *\\n * Requirements:\\n *\\n * - input must be greater than or equal to 0.\\n *\\n * _Available since v3.0._\\n */\\n function toUint256(int256 value) internal pure returns (uint256) {\\n require(value >= 0, \\\"SafeCast: value must be positive\\\");\\n return uint256(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted int248 from int256, reverting on\\n * overflow (when the input is less than smallest int248 or\\n * greater than largest int248).\\n *\\n * Counterpart to Solidity's `int248` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 248 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt248(int256 value) internal pure returns (int248 downcasted) {\\n downcasted = int248(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 248 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int240 from int256, reverting on\\n * overflow (when the input is less than smallest int240 or\\n * greater than largest int240).\\n *\\n * Counterpart to Solidity's `int240` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 240 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt240(int256 value) internal pure returns (int240 downcasted) {\\n downcasted = int240(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 240 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int232 from int256, reverting on\\n * overflow (when the input is less than smallest int232 or\\n * greater than largest int232).\\n *\\n * Counterpart to Solidity's `int232` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 232 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt232(int256 value) internal pure returns (int232 downcasted) {\\n downcasted = int232(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 232 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int224 from int256, reverting on\\n * overflow (when the input is less than smallest int224 or\\n * greater than largest int224).\\n *\\n * Counterpart to Solidity's `int224` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 224 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt224(int256 value) internal pure returns (int224 downcasted) {\\n downcasted = int224(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 224 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int216 from int256, reverting on\\n * overflow (when the input is less than smallest int216 or\\n * greater than largest int216).\\n *\\n * Counterpart to Solidity's `int216` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 216 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt216(int256 value) internal pure returns (int216 downcasted) {\\n downcasted = int216(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 216 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int208 from int256, reverting on\\n * overflow (when the input is less than smallest int208 or\\n * greater than largest int208).\\n *\\n * Counterpart to Solidity's `int208` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 208 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt208(int256 value) internal pure returns (int208 downcasted) {\\n downcasted = int208(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 208 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int200 from int256, reverting on\\n * overflow (when the input is less than smallest int200 or\\n * greater than largest int200).\\n *\\n * Counterpart to Solidity's `int200` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 200 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt200(int256 value) internal pure returns (int200 downcasted) {\\n downcasted = int200(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 200 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int192 from int256, reverting on\\n * overflow (when the input is less than smallest int192 or\\n * greater than largest int192).\\n *\\n * Counterpart to Solidity's `int192` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 192 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt192(int256 value) internal pure returns (int192 downcasted) {\\n downcasted = int192(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 192 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int184 from int256, reverting on\\n * overflow (when the input is less than smallest int184 or\\n * greater than largest int184).\\n *\\n * Counterpart to Solidity's `int184` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 184 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt184(int256 value) internal pure returns (int184 downcasted) {\\n downcasted = int184(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 184 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int176 from int256, reverting on\\n * overflow (when the input is less than smallest int176 or\\n * greater than largest int176).\\n *\\n * Counterpart to Solidity's `int176` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 176 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt176(int256 value) internal pure returns (int176 downcasted) {\\n downcasted = int176(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 176 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int168 from int256, reverting on\\n * overflow (when the input is less than smallest int168 or\\n * greater than largest int168).\\n *\\n * Counterpart to Solidity's `int168` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 168 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt168(int256 value) internal pure returns (int168 downcasted) {\\n downcasted = int168(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 168 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int160 from int256, reverting on\\n * overflow (when the input is less than smallest int160 or\\n * greater than largest int160).\\n *\\n * Counterpart to Solidity's `int160` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 160 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt160(int256 value) internal pure returns (int160 downcasted) {\\n downcasted = int160(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 160 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int152 from int256, reverting on\\n * overflow (when the input is less than smallest int152 or\\n * greater than largest int152).\\n *\\n * Counterpart to Solidity's `int152` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 152 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt152(int256 value) internal pure returns (int152 downcasted) {\\n downcasted = int152(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 152 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int144 from int256, reverting on\\n * overflow (when the input is less than smallest int144 or\\n * greater than largest int144).\\n *\\n * Counterpart to Solidity's `int144` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 144 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt144(int256 value) internal pure returns (int144 downcasted) {\\n downcasted = int144(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 144 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int136 from int256, reverting on\\n * overflow (when the input is less than smallest int136 or\\n * greater than largest int136).\\n *\\n * Counterpart to Solidity's `int136` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 136 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt136(int256 value) internal pure returns (int136 downcasted) {\\n downcasted = int136(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 136 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int128 from int256, reverting on\\n * overflow (when the input is less than smallest int128 or\\n * greater than largest int128).\\n *\\n * Counterpart to Solidity's `int128` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 128 bits\\n *\\n * _Available since v3.1._\\n */\\n function toInt128(int256 value) internal pure returns (int128 downcasted) {\\n downcasted = int128(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 128 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int120 from int256, reverting on\\n * overflow (when the input is less than smallest int120 or\\n * greater than largest int120).\\n *\\n * Counterpart to Solidity's `int120` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 120 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt120(int256 value) internal pure returns (int120 downcasted) {\\n downcasted = int120(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 120 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int112 from int256, reverting on\\n * overflow (when the input is less than smallest int112 or\\n * greater than largest int112).\\n *\\n * Counterpart to Solidity's `int112` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 112 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt112(int256 value) internal pure returns (int112 downcasted) {\\n downcasted = int112(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 112 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int104 from int256, reverting on\\n * overflow (when the input is less than smallest int104 or\\n * greater than largest int104).\\n *\\n * Counterpart to Solidity's `int104` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 104 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt104(int256 value) internal pure returns (int104 downcasted) {\\n downcasted = int104(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 104 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int96 from int256, reverting on\\n * overflow (when the input is less than smallest int96 or\\n * greater than largest int96).\\n *\\n * Counterpart to Solidity's `int96` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 96 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt96(int256 value) internal pure returns (int96 downcasted) {\\n downcasted = int96(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 96 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int88 from int256, reverting on\\n * overflow (when the input is less than smallest int88 or\\n * greater than largest int88).\\n *\\n * Counterpart to Solidity's `int88` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 88 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt88(int256 value) internal pure returns (int88 downcasted) {\\n downcasted = int88(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 88 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int80 from int256, reverting on\\n * overflow (when the input is less than smallest int80 or\\n * greater than largest int80).\\n *\\n * Counterpart to Solidity's `int80` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 80 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt80(int256 value) internal pure returns (int80 downcasted) {\\n downcasted = int80(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 80 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int72 from int256, reverting on\\n * overflow (when the input is less than smallest int72 or\\n * greater than largest int72).\\n *\\n * Counterpart to Solidity's `int72` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 72 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt72(int256 value) internal pure returns (int72 downcasted) {\\n downcasted = int72(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 72 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int64 from int256, reverting on\\n * overflow (when the input is less than smallest int64 or\\n * greater than largest int64).\\n *\\n * Counterpart to Solidity's `int64` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 64 bits\\n *\\n * _Available since v3.1._\\n */\\n function toInt64(int256 value) internal pure returns (int64 downcasted) {\\n downcasted = int64(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 64 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int56 from int256, reverting on\\n * overflow (when the input is less than smallest int56 or\\n * greater than largest int56).\\n *\\n * Counterpart to Solidity's `int56` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 56 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt56(int256 value) internal pure returns (int56 downcasted) {\\n downcasted = int56(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 56 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int48 from int256, reverting on\\n * overflow (when the input is less than smallest int48 or\\n * greater than largest int48).\\n *\\n * Counterpart to Solidity's `int48` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 48 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt48(int256 value) internal pure returns (int48 downcasted) {\\n downcasted = int48(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 48 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int40 from int256, reverting on\\n * overflow (when the input is less than smallest int40 or\\n * greater than largest int40).\\n *\\n * Counterpart to Solidity's `int40` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 40 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt40(int256 value) internal pure returns (int40 downcasted) {\\n downcasted = int40(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 40 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int32 from int256, reverting on\\n * overflow (when the input is less than smallest int32 or\\n * greater than largest int32).\\n *\\n * Counterpart to Solidity's `int32` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 32 bits\\n *\\n * _Available since v3.1._\\n */\\n function toInt32(int256 value) internal pure returns (int32 downcasted) {\\n downcasted = int32(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 32 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int24 from int256, reverting on\\n * overflow (when the input is less than smallest int24 or\\n * greater than largest int24).\\n *\\n * Counterpart to Solidity's `int24` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 24 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt24(int256 value) internal pure returns (int24 downcasted) {\\n downcasted = int24(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 24 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int16 from int256, reverting on\\n * overflow (when the input is less than smallest int16 or\\n * greater than largest int16).\\n *\\n * Counterpart to Solidity's `int16` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 16 bits\\n *\\n * _Available since v3.1._\\n */\\n function toInt16(int256 value) internal pure returns (int16 downcasted) {\\n downcasted = int16(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 16 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int8 from int256, reverting on\\n * overflow (when the input is less than smallest int8 or\\n * greater than largest int8).\\n *\\n * Counterpart to Solidity's `int8` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 8 bits\\n *\\n * _Available since v3.1._\\n */\\n function toInt8(int256 value) internal pure returns (int8 downcasted) {\\n downcasted = int8(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 8 bits\\\");\\n }\\n\\n /**\\n * @dev Converts an unsigned uint256 into a signed int256.\\n *\\n * Requirements:\\n *\\n * - input must be less than or equal to maxInt256.\\n *\\n * _Available since v3.0._\\n */\\n function toInt256(uint256 value) internal pure returns (int256) {\\n // Note: Unsafe cast below is okay because `type(int256).max` is guaranteed to be positive\\n require(value <= uint256(type(int256).max), \\\"SafeCast: value doesn't fit in an int256\\\");\\n return int256(value);\\n }\\n}\\n\",\"keccak256\":\"0x52a8cfb0f5239d11b457dcdd1b326992ef672714ca8da71a157255bddd13f3ad\",\"license\":\"MIT\"},\"contracts/Distributor.sol\":{\"content\":\"// SPDX-License-Identifier: BUSL-1.1\\n\\n/*\\n * \\u2588 \\n ***** \\u2593\\u2593\\u2593 \\n * \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\n * ///. \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\n ***** //////// \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\n * ///////////// \\u2593\\u2593\\u2593 \\n \\u2593\\u2593 ////////////////// \\u2588 \\u2593\\u2593 \\n \\u2593\\u2593 \\u2593\\u2593 /////////////////////// \\u2593\\u2593 \\u2593\\u2593 \\n \\u2593\\u2593 \\u2593\\u2593 //////////////////////////// \\u2593\\u2593 \\u2593\\u2593 \\n \\u2593\\u2593 \\u2593\\u2593 /////////\\u2593\\u2593\\u2593///////\\u2593\\u2593\\u2593///////// \\u2593\\u2593 \\u2593\\u2593 \\n \\u2593\\u2593 ,////////////////////////////////////// \\u2593\\u2593 \\u2593\\u2593 \\n \\u2593\\u2593 ////////////////////////////////////////// \\u2593\\u2593 \\n \\u2593\\u2593 //////////////////////\\u2593\\u2593\\u2593\\u2593///////////////////// \\n ,//////////////////////////////////////////////////// \\n .////////////////////////////////////////////////////////// \\n .//////////////////////////\\u2588\\u2588.,//////////////////////////\\u2588 \\n .//////////////////////\\u2588\\u2588\\u2588\\u2588..,./////////////////////\\u2588\\u2588 \\n ...////////////////\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588.....,.////////////////\\u2588\\u2588\\u2588 \\n ,.,////////////\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588 ........,///////////\\u2588\\u2588\\u2588\\u2588 \\n .,.,//////\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588 ,.......///////\\u2588\\u2588\\u2588\\u2588 \\n ,..//\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588 ........./\\u2588\\u2588\\u2588\\u2588 \\n ..,\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588 .....,\\u2588\\u2588\\u2588 \\n .\\u2588\\u2588 ,.,\\u2588 \\n \\n \\n \\n \\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\n \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593 \\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593 \\n \\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593 \\n \\u2593\\u2593\\u2593 \\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\n*/\\n\\npragma solidity ^0.8.17;\\n\\nimport { IERC20 } from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport { SafeERC20 } from \\\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\\\";\\nimport { SafeCast } from \\\"@openzeppelin/contracts/utils/math/SafeCast.sol\\\";\\n\\nimport \\\"./utils/UUPSHelper.sol\\\";\\n\\nstruct MerkleTree {\\n // Root of a Merkle tree which leaves are `(address user, address token, uint amount)`\\n // representing an amount of tokens accumulated by `user`.\\n // The Merkle tree is assumed to have only increasing amounts: that is to say if a user can claim 1,\\n // then after the amount associated in the Merkle tree for this token should be x > 1\\n bytes32 merkleRoot;\\n // Ipfs hash of the tree data\\n bytes32 ipfsHash;\\n}\\n\\nstruct Claim {\\n uint208 amount;\\n uint48 timestamp;\\n bytes32 merkleRoot;\\n}\\n\\n/// @title Distributor\\n/// @notice Allows LPs on AMMs with concentrated liquidity to claim the rewards that were distributed to them\\n/// @author Angle Labs. Inc\\ncontract Distributor is UUPSHelper {\\n using SafeERC20 for IERC20;\\n\\n /// @notice Epoch duration\\n uint32 internal constant _EPOCH_DURATION = 3600;\\n\\n // ================================= VARIABLES =================================\\n\\n /// @notice Tree of claimable tokens through this contract\\n MerkleTree public tree;\\n\\n /// @notice Tree that was in place in the contract before the last `tree` update\\n MerkleTree public lastTree;\\n\\n /// @notice Token to deposit to freeze the roots update\\n IERC20 public disputeToken;\\n\\n /// @notice `Core` contract handling access control\\n ICore public core;\\n\\n /// @notice Address which created the dispute\\n /// @dev Used to store if there is an ongoing dispute\\n address public disputer;\\n\\n /// @notice When the current tree will become valid\\n uint48 public endOfDisputePeriod;\\n\\n /// @notice Time after which a change in a tree becomes effective, in EPOCH_DURATION\\n uint48 public disputePeriod;\\n\\n /// @notice Amount to deposit to freeze the roots update\\n uint256 public disputeAmount;\\n\\n /// @notice Mapping user -> token -> amount to track claimed amounts\\n mapping(address => mapping(address => Claim)) public claimed;\\n\\n /// @notice Trusted EOAs to update the Merkle root\\n mapping(address => uint256) public canUpdateMerkleRoot;\\n\\n /// @notice Whether or not to disable permissionless claiming\\n mapping(address => uint256) public onlyOperatorCanClaim;\\n\\n /// @notice user -> operator -> authorisation to claim\\n mapping(address => mapping(address => uint256)) public operators;\\n\\n uint256[38] private __gap;\\n\\n // =================================== EVENTS ==================================\\n\\n event Claimed(address indexed user, address indexed token, uint256 amount);\\n event DisputeAmountUpdated(uint256 _disputeAmount);\\n event Disputed(string reason);\\n event DisputePeriodUpdated(uint48 _disputePeriod);\\n event DisputeResolved(bool valid);\\n event DisputeTokenUpdated(address indexed _disputeToken);\\n event OperatorClaimingToggled(address indexed user, bool isEnabled);\\n event OperatorToggled(address indexed user, address indexed operator, bool isWhitelisted);\\n event Recovered(address indexed token, address indexed to, uint256 amount);\\n event Revoked(); // With this event an indexer could maintain a table (timestamp, merkleRootUpdate)\\n event TreeUpdated(bytes32 merkleRoot, bytes32 ipfsHash, uint48 endOfDisputePeriod);\\n event TrustedToggled(address indexed eoa, bool trust);\\n\\n // ================================= MODIFIERS =================================\\n\\n /// @notice Checks whether the `msg.sender` has the governor role or the guardian role\\n modifier onlyGovernorOrGuardian() {\\n if (!core.isGovernorOrGuardian(msg.sender)) revert NotGovernorOrGuardian();\\n _;\\n }\\n\\n /// @notice Checks whether the `msg.sender` is the `user` address or is a trusted address\\n modifier onlyTrustedOrUser(address user) {\\n if (user != msg.sender && canUpdateMerkleRoot[msg.sender] != 1 && !core.isGovernorOrGuardian(msg.sender))\\n revert NotTrusted();\\n _;\\n }\\n\\n // ================================ CONSTRUCTOR ================================\\n\\n constructor() initializer {}\\n\\n function initialize(ICore _core) external initializer {\\n if (address(_core) == address(0)) revert ZeroAddress();\\n core = _core;\\n }\\n\\n /// @inheritdoc UUPSUpgradeable\\n function _authorizeUpgrade(address) internal view override onlyGuardianUpgrader(core) {}\\n\\n // =============================== MAIN FUNCTION ===============================\\n\\n /// @notice Claims rewards for a given set of users\\n /// @dev Anyone may call this function for anyone else, funds go to destination regardless, it's just a question of\\n /// who provides the proof and pays the gas: `msg.sender` is used only for addresses that require a trusted operator\\n /// @param users Recipient of tokens\\n /// @param tokens ERC20 claimed\\n /// @param amounts Amount of tokens that will be sent to the corresponding users\\n /// @param proofs Array of hashes bridging from a leaf `(hash of user | token | amount)` to the Merkle root\\n function claim(\\n address[] calldata users,\\n address[] calldata tokens,\\n uint256[] calldata amounts,\\n bytes32[][] calldata proofs\\n ) external {\\n uint256 usersLength = users.length;\\n if (\\n usersLength == 0 ||\\n usersLength != tokens.length ||\\n usersLength != amounts.length ||\\n usersLength != proofs.length\\n ) revert InvalidLengths();\\n\\n for (uint256 i; i < usersLength; ) {\\n address user = users[i];\\n address token = tokens[i];\\n uint256 amount = amounts[i];\\n\\n // Checking if only an approved operator can claim for `user`\\n if (onlyOperatorCanClaim[user] == 1 && operators[user][msg.sender] == 0) revert NotWhitelisted();\\n\\n // Verifying proof\\n bytes32 leaf = keccak256(abi.encode(user, token, amount));\\n if (!_verifyProof(leaf, proofs[i])) revert InvalidProof();\\n\\n // Closing reentrancy gate here\\n uint256 toSend = amount - claimed[user][token].amount;\\n claimed[user][token] = Claim(SafeCast.toUint208(amount), uint48(block.timestamp), getMerkleRoot());\\n\\n IERC20(token).safeTransfer(user, toSend);\\n emit Claimed(user, token, toSend);\\n unchecked {\\n ++i;\\n }\\n }\\n }\\n\\n /// @notice Returns the MerkleRoot that is currently live for the contract\\n function getMerkleRoot() public view returns (bytes32) {\\n if (block.timestamp >= endOfDisputePeriod && disputer == address(0)) return tree.merkleRoot;\\n else return lastTree.merkleRoot;\\n }\\n\\n // ============================ GOVERNANCE FUNCTIONS ===========================\\n\\n /// @notice Adds or removes EOAs which are trusted to update the Merkle root\\n function toggleTrusted(address eoa) external onlyGovernorOrGuardian {\\n uint256 trustedStatus = 1 - canUpdateMerkleRoot[eoa];\\n canUpdateMerkleRoot[eoa] = trustedStatus;\\n emit TrustedToggled(eoa, trustedStatus == 1);\\n }\\n\\n /// @notice Updates Merkle Tree\\n function updateTree(MerkleTree calldata _tree) external {\\n if (\\n disputer != address(0) ||\\n // A trusted address cannot update a tree right after a precedent tree update otherwise it can de facto\\n // validate a tree which has not passed the dispute period\\n ((canUpdateMerkleRoot[msg.sender] != 1 || block.timestamp < endOfDisputePeriod) &&\\n !core.isGovernorOrGuardian(msg.sender))\\n ) revert NotTrusted();\\n MerkleTree memory _lastTree = tree;\\n tree = _tree;\\n lastTree = _lastTree;\\n\\n uint48 _endOfPeriod = _endOfDisputePeriod(uint48(block.timestamp));\\n endOfDisputePeriod = _endOfPeriod;\\n emit TreeUpdated(_tree.merkleRoot, _tree.ipfsHash, _endOfPeriod);\\n }\\n\\n /// @notice Freezes the Merkle tree update until the dispute is resolved\\n /// @dev Requires a deposit of `disputeToken` that'll be slashed if the dispute is not accepted\\n /// @dev It is only possible to create a dispute within `disputePeriod` after each tree update\\n function disputeTree(string memory reason) external {\\n if (disputer != address(0)) revert UnresolvedDispute();\\n if (block.timestamp >= endOfDisputePeriod) revert InvalidDispute();\\n IERC20(disputeToken).safeTransferFrom(msg.sender, address(this), disputeAmount);\\n disputer = msg.sender;\\n emit Disputed(reason);\\n }\\n\\n /// @notice Resolve the ongoing dispute, if any\\n /// @param valid Whether the dispute was valid\\n function resolveDispute(bool valid) external onlyGovernorOrGuardian {\\n if (disputer == address(0)) revert NoDispute();\\n if (valid) {\\n IERC20(disputeToken).safeTransfer(disputer, disputeAmount);\\n // If a dispute is valid, the contract falls back to the last tree that was updated\\n _revokeTree();\\n } else {\\n IERC20(disputeToken).safeTransfer(msg.sender, disputeAmount);\\n endOfDisputePeriod = _endOfDisputePeriod(uint48(block.timestamp));\\n }\\n disputer = address(0);\\n emit DisputeResolved(valid);\\n }\\n\\n /// @notice Allows the governor or the guardian of this contract to fallback to the last version of the tree\\n /// immediately\\n function revokeTree() external onlyGovernorOrGuardian {\\n if (disputer != address(0)) revert UnresolvedDispute();\\n _revokeTree();\\n }\\n\\n /// @notice Toggles permissioned claiming for a given user\\n function toggleOnlyOperatorCanClaim(address user) external onlyTrustedOrUser(user) {\\n uint256 oldValue = onlyOperatorCanClaim[user];\\n onlyOperatorCanClaim[user] = 1 - oldValue;\\n emit OperatorClaimingToggled(user, oldValue == 0);\\n }\\n\\n /// @notice Toggles whitelisting for a given user and a given operator\\n function toggleOperator(address user, address operator) external onlyTrustedOrUser(user) {\\n uint256 oldValue = operators[user][operator];\\n operators[user][operator] = 1 - oldValue;\\n emit OperatorToggled(user, operator, oldValue == 0);\\n }\\n\\n /// @notice Recovers any ERC20 token\\n function recoverERC20(address tokenAddress, address to, uint256 amountToRecover) external onlyGovernorOrGuardian {\\n IERC20(tokenAddress).safeTransfer(to, amountToRecover);\\n emit Recovered(tokenAddress, to, amountToRecover);\\n }\\n\\n /// @notice Sets the dispute period after which a tree update becomes effective\\n function setDisputePeriod(uint48 _disputePeriod) external onlyGovernorOrGuardian {\\n disputePeriod = uint48(_disputePeriod);\\n emit DisputePeriodUpdated(_disputePeriod);\\n }\\n\\n /// @notice Sets the token used as a caution during disputes\\n function setDisputeToken(IERC20 _disputeToken) external onlyGovernorOrGuardian {\\n if (disputer != address(0)) revert UnresolvedDispute();\\n disputeToken = _disputeToken;\\n emit DisputeTokenUpdated(address(_disputeToken));\\n }\\n\\n /// @notice Sets the amount of `disputeToken` used as a caution during disputes\\n function setDisputeAmount(uint256 _disputeAmount) external onlyGovernorOrGuardian {\\n if (disputer != address(0)) revert UnresolvedDispute();\\n disputeAmount = _disputeAmount;\\n emit DisputeAmountUpdated(_disputeAmount);\\n }\\n\\n // ============================= INTERNAL FUNCTIONS ============================\\n\\n /// @notice Fallback to the last version of the tree\\n function _revokeTree() internal {\\n MerkleTree memory _tree = lastTree;\\n endOfDisputePeriod = 0;\\n tree = _tree;\\n emit Revoked();\\n emit TreeUpdated(\\n _tree.merkleRoot,\\n _tree.ipfsHash,\\n (uint48(block.timestamp) / _EPOCH_DURATION) * (_EPOCH_DURATION) // Last hour\\n );\\n }\\n\\n /// @notice Returns the end of the dispute period\\n /// @dev treeUpdate is rounded up to next hour and then `disputePeriod` hours are added\\n function _endOfDisputePeriod(uint48 treeUpdate) internal view returns (uint48) {\\n return ((treeUpdate - 1) / _EPOCH_DURATION + 1 + disputePeriod) * (_EPOCH_DURATION);\\n }\\n\\n /// @notice Checks the validity of a proof\\n /// @param leaf Hashed leaf data, the starting point of the proof\\n /// @param proof Array of hashes forming a hash chain from leaf to root\\n /// @return true If proof is correct, else false\\n function _verifyProof(bytes32 leaf, bytes32[] memory proof) internal view returns (bool) {\\n bytes32 currentHash = leaf;\\n uint256 proofLength = proof.length;\\n for (uint256 i; i < proofLength; ) {\\n if (currentHash < proof[i]) {\\n currentHash = keccak256(abi.encode(currentHash, proof[i]));\\n } else {\\n currentHash = keccak256(abi.encode(proof[i], currentHash));\\n }\\n unchecked {\\n ++i;\\n }\\n }\\n bytes32 root = getMerkleRoot();\\n if (root == bytes32(0)) revert InvalidUninitializedRoot();\\n return currentHash == root;\\n }\\n}\\n\",\"keccak256\":\"0xe59a10e2d62c9088ae8959ac6d839d995863832ea9fdb71485674264a21a9510\",\"license\":\"BUSL-1.1\"},\"contracts/interfaces/ICore.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\n\\npragma solidity ^0.8.17;\\n\\n/// @title ICore\\n/// @author Angle Labs, Inc.\\n/// @notice Interface for the `Core` contracts of smart contract modules used in Angle Labs contracts\\ninterface ICore {\\n /// @notice Checks whether an address is governor\\n /// @param admin Address to check\\n /// @return Whether the address has the `GOVERNOR_ROLE` or not\\n function isGovernor(address admin) external view returns (bool);\\n\\n /// @notice Checks whether an address is a governor or a guardian of a module\\n /// @param admin Address to check\\n /// @return Whether the address has the `GUARDIAN_ROLE` or not\\n /// @dev Governance should make sure when adding a governor to also give this governor the guardian\\n /// role by calling the `addGovernor` function\\n function isGovernorOrGuardian(address admin) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x11e92b745193d16934aaeb873c0388041dce2ef3e359a9c3315b668b05903100\",\"license\":\"GPL-3.0\"},\"contracts/utils/Errors.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\n\\npragma solidity ^0.8.17;\\n\\nerror InvalidDispute();\\nerror InvalidLengths();\\nerror InvalidParam();\\nerror InvalidParams();\\nerror InvalidProof();\\nerror InvalidUninitializedRoot();\\nerror InvalidReward();\\nerror InvalidSignature();\\nerror NoDispute();\\nerror NotGovernor();\\nerror NotGovernorOrGuardian();\\nerror NotSigned();\\nerror NotTrusted();\\nerror NotWhitelisted();\\nerror UnresolvedDispute();\\nerror ZeroAddress();\\n\",\"keccak256\":\"0x7cd16f5988dee579532a71ff4afd8668c75add546e7e4724c1aaadd888355139\",\"license\":\"GPL-3.0\"},\"contracts/utils/UUPSHelper.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\n\\n/*\\n * \\u2588 \\n ***** \\u2593\\u2593\\u2593 \\n * \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\n * ///. \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\n ***** //////// \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\n * ///////////// \\u2593\\u2593\\u2593 \\n \\u2593\\u2593 ////////////////// \\u2588 \\u2593\\u2593 \\n \\u2593\\u2593 \\u2593\\u2593 /////////////////////// \\u2593\\u2593 \\u2593\\u2593 \\n \\u2593\\u2593 \\u2593\\u2593 //////////////////////////// \\u2593\\u2593 \\u2593\\u2593 \\n \\u2593\\u2593 \\u2593\\u2593 /////////\\u2593\\u2593\\u2593///////\\u2593\\u2593\\u2593///////// \\u2593\\u2593 \\u2593\\u2593 \\n \\u2593\\u2593 ,////////////////////////////////////// \\u2593\\u2593 \\u2593\\u2593 \\n \\u2593\\u2593 ////////////////////////////////////////// \\u2593\\u2593 \\n \\u2593\\u2593 //////////////////////\\u2593\\u2593\\u2593\\u2593///////////////////// \\n ,//////////////////////////////////////////////////// \\n .////////////////////////////////////////////////////////// \\n .//////////////////////////\\u2588\\u2588.,//////////////////////////\\u2588 \\n .//////////////////////\\u2588\\u2588\\u2588\\u2588..,./////////////////////\\u2588\\u2588 \\n ...////////////////\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588.....,.////////////////\\u2588\\u2588\\u2588 \\n ,.,////////////\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588 ........,///////////\\u2588\\u2588\\u2588\\u2588 \\n .,.,//////\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588 ,.......///////\\u2588\\u2588\\u2588\\u2588 \\n ,..//\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588 ........./\\u2588\\u2588\\u2588\\u2588 \\n ..,\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588 .....,\\u2588\\u2588\\u2588 \\n .\\u2588\\u2588 ,.,\\u2588 \\n \\n \\n \\n \\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\n \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593 \\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593 \\n \\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593 \\n \\u2593\\u2593\\u2593 \\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\n*/\\n\\npragma solidity ^0.8.17;\\n\\nimport { UUPSUpgradeable } from \\\"@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol\\\";\\n\\nimport { ICore } from \\\"../interfaces/ICore.sol\\\";\\nimport \\\"../utils/Errors.sol\\\";\\n\\n/// @title UUPSHelper\\n/// @notice Helper contract for UUPSUpgradeable contracts where the upgradeability is controlled by a specific address\\n/// @author Angle Labs., Inc\\n/// @dev The 0 address check in the modifier allows the use of these modifiers during initialization\\nabstract contract UUPSHelper is UUPSUpgradeable {\\n modifier onlyGuardianUpgrader(ICore _core) {\\n if (address(_core) != address(0) && !_core.isGovernorOrGuardian(msg.sender)) revert NotGovernorOrGuardian();\\n _;\\n }\\n\\n modifier onlyGovernorUpgrader(ICore _core) {\\n if (address(_core) != address(0) && !_core.isGovernor(msg.sender)) revert NotGovernor();\\n _;\\n }\\n\\n constructor() initializer {}\\n}\\n\",\"keccak256\":\"0xb8011db6d148c8a111678c8074343c82114b923806aee0f60c48ed05f8bd6c40\",\"license\":\"GPL-3.0\"}},\"version\":1}", + "bytecode": "0x60a0604052306080523480156200001557600080fd5b50600054610100900460ff1615808015620000375750600054600160ff909116105b8062000067575062000054306200022060201b620022ed1760201c565b15801562000067575060005460ff166001145b620000bf5760405162461bcd60e51b815260206004820152602e60248201526000805160206200391683398151915260448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084015b60405180910390fd5b6000805460ff191660011790558015620000e3576000805461ff0019166101001790555b801562000119576000805461ff001916905560405160018152600080516020620039368339815191529060200160405180910390a15b50600054610100900460ff16158080156200013b5750600054600160ff909116105b806200016b575062000158306200022060201b620022ed1760201c565b1580156200016b575060005460ff166001145b620001bf5760405162461bcd60e51b815260206004820152602e60248201526000805160206200391683398151915260448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401620000b6565b6000805460ff191660011790558015620001e3576000805461ff0019166101001790555b801562000219576000805461ff001916905560405160018152600080516020620039368339815191529060200160405180910390a15b506200022f565b6001600160a01b03163b151590565b6080516136af6200026760003960008181610c4a01528181610cff01528181610ff9015281816110a901526111f201526136af6000f3fe6080604052600436106101c25760003560e01c80635cec892a116100f7578063bdac7ca311610095578063d9c9808711610064578063d9c9808714610626578063e57480e514610646578063f2f4eb2614610673578063fd54b228146106a057600080fd5b8063bdac7ca314610589578063c4d66de8146105a9578063c748d261146105c9578063cce80e7a146105f657600080fd5b806371ee95c0116100d157806371ee95c0146105145780637ee843491461053457806389e1e82a14610554578063957888351461057457600080fd5b80635cec892a1461046b578063623b9e9d146104a25780636ac56103146104c257600080fd5b80632a25dd4111610164578063495906571161013e57806349590657146103da5780634f1ef286146103ef57806352d1902d146104025780635bf31d4d1461041757600080fd5b80632a25dd411461037a5780633659cfe61461039a5780634641fdef146103ba57600080fd5b80631171bda9116101a05780631171bda9146102d557806314769142146102f55780632637588e14610322578063288278381461035a57600080fd5b806309454ba3146101c75780630c9cbf0e146101f05780630d10fca3146102b3575b600080fd5b3480156101d357600080fd5b506101dd606c5481565b6040519081526020015b60405180910390f35b3480156101fc57600080fd5b5061027461020b36600461305c565b606d6020908152600092835260408084209091529082529020805460019091015479ffffffffffffffffffffffffffffffffffffffffffffffffffff8216917a010000000000000000000000000000000000000000000000000000900465ffffffffffff169083565b6040805179ffffffffffffffffffffffffffffffffffffffffffffffffffff909416845265ffffffffffff9092166020840152908201526060016101e7565b3480156102bf57600080fd5b506102d36102ce366004613095565b6106bb565b005b3480156102e157600080fd5b506102d36102f03660046130ae565b61080f565b34801561030157600080fd5b506101dd6103103660046130ef565b606f6020526000908152604090205481565b34801561032e57600080fd5b506101dd61033d36600461305c565b607060209081526000928352604080842090915290825290205481565b34801561036657600080fd5b506102d36103753660046130ef565b610964565b34801561038657600080fd5b506102d36103953660046131cf565b610b02565b3480156103a657600080fd5b506102d36103b53660046130ef565b610c33565b3480156103c657600080fd5b506102d36103d5366004613218565b610e3d565b3480156103e657600080fd5b506101dd610f84565b6102d36103fd366004613240565b610fe2565b34801561040e57600080fd5b506101dd6111d8565b34801561042357600080fd5b50606b54610454907a010000000000000000000000000000000000000000000000000000900465ffffffffffff1681565b60405165ffffffffffff90911681526020016101e7565b34801561047757600080fd5b50606b546104549074010000000000000000000000000000000000000000900465ffffffffffff1681565b3480156104ae57600080fd5b506102d36104bd3660046130ef565b6112c4565b3480156104ce57600080fd5b50606b546104ef9073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016101e7565b34801561052057600080fd5b506102d361052f3660046132f0565b61144b565b34801561054057600080fd5b506102d361054f3660046130ef565b611885565b34801561056057600080fd5b506102d361056f3660046133c2565b6119e6565b34801561058057600080fd5b506102d3611bf0565b34801561059557600080fd5b506102d36105a436600461305c565b611d12565b3480156105b557600080fd5b506102d36105c43660046130ef565b611ecd565b3480156105d557600080fd5b506069546104ef9073ffffffffffffffffffffffffffffffffffffffff1681565b34801561060257600080fd5b50606754606854610611919082565b604080519283526020830191909152016101e7565b34801561063257600080fd5b506102d36106413660046133df565b6120e4565b34801561065257600080fd5b506101dd6106613660046130ef565b606e6020526000908152604090205481565b34801561067f57600080fd5b50606a546104ef9073ffffffffffffffffffffffffffffffffffffffff1681565b3480156106ac57600080fd5b50606554606654610611919082565b606a546040517f521d4de900000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff9091169063521d4de990602401602060405180830381865afa158015610729573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061074d91906133f7565b610783576040517f99e120bc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606b5473ffffffffffffffffffffffffffffffffffffffff16156107d3576040517f0583257400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606c8190556040518181527f39bb629f3d59f5eddf978050e1f5fabeca2b5d02dfc9c25e84f32e7da1069db4906020015b60405180910390a150565b606a546040517f521d4de900000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff9091169063521d4de990602401602060405180830381865afa15801561087d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108a191906133f7565b6108d7576040517f99e120bc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6108f873ffffffffffffffffffffffffffffffffffffffff84168383612309565b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167ffff3b3844276f57024e0b42afec1a37f75db36511e43819a4f2a63ab7862b6488360405161095791815260200190565b60405180910390a3505050565b8073ffffffffffffffffffffffffffffffffffffffff8116331480159061099b5750336000908152606e6020526040902054600114155b8015610a365750606a546040517f521d4de900000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff9091169063521d4de990602401602060405180830381865afa158015610a10573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a3491906133f7565b155b15610a6d576040517fc22a648e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff82166000908152606f6020526040902054610a9e816001613443565b73ffffffffffffffffffffffffffffffffffffffff84166000818152606f602090815260409182902093909355518315815290917f81d714ca01079a19c106993b49b2764df6bb6abe740164ef7b77ee9c100a024a910160405180910390a2505050565b606b5473ffffffffffffffffffffffffffffffffffffffff1615610b52576040517f0583257400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606b5474010000000000000000000000000000000000000000900465ffffffffffff164210610bad576040517f1a8f039500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606c54606954610bd99173ffffffffffffffffffffffffffffffffffffffff90911690339030906123e2565b606b80547fffffffffffffffffffffffff000000000000000000000000000000000000000016331790556040517f5eca00b8ed745eee61451333090bfa56aa1f2a9e696a2aebe5f1f5b6cef6f2ff9061080490839061347a565b73ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000163003610cfd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602c60248201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060448201527f64656c656761746563616c6c000000000000000000000000000000000000000060648201526084015b60405180910390fd5b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16610d727f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5473ffffffffffffffffffffffffffffffffffffffff1690565b73ffffffffffffffffffffffffffffffffffffffff1614610e15576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602c60248201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060448201527f6163746976652070726f787900000000000000000000000000000000000000006064820152608401610cf4565b610e1e81612446565b60408051600080825260208201909252610e3a91839190612530565b50565b606a546040517f521d4de900000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff9091169063521d4de990602401602060405180830381865afa158015610eab573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ecf91906133f7565b610f05576040517f99e120bc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606b805479ffffffffffffffffffffffffffffffffffffffffffffffffffff167a01000000000000000000000000000000000000000000000000000065ffffffffffff8416908102919091179091556040519081527ffdf22e84af74bd4ab6b9646f6370a02bc886ed6ac25882db14e4ebf4b8e3bc7e90602001610804565b606b5460009074010000000000000000000000000000000000000000900465ffffffffffff164210801590610fcf5750606b5473ffffffffffffffffffffffffffffffffffffffff16155b15610fdb575060655490565b5060675490565b73ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001630036110a7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602c60248201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060448201527f64656c656761746563616c6c00000000000000000000000000000000000000006064820152608401610cf4565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1661111c7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5473ffffffffffffffffffffffffffffffffffffffff1690565b73ffffffffffffffffffffffffffffffffffffffff16146111bf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602c60248201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060448201527f6163746976652070726f787900000000000000000000000000000000000000006064820152608401610cf4565b6111c882612446565b6111d482826001612530565b5050565b60003073ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000161461129f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c60448201527f6c6564207468726f7567682064656c656761746563616c6c00000000000000006064820152608401610cf4565b507f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc90565b606a546040517f521d4de900000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff9091169063521d4de990602401602060405180830381865afa158015611332573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061135691906133f7565b61138c576040517f99e120bc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606b5473ffffffffffffffffffffffffffffffffffffffff16156113dc576040517f0583257400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606980547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081179091556040517f1db8d6629941dcb63d5e0c927b89c174c714e139a4b9107a49de839d755f5d7490600090a250565b868015806114595750808614155b806114645750808414155b8061146f5750808214155b156114a6576040517f1df89e8b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60005b818110156118795760008a8a838181106114c5576114c56134cb565b90506020020160208101906114da91906130ef565b905060008989848181106114f0576114f06134cb565b905060200201602081019061150591906130ef565b9050600088888581811061151b5761151b6134cb565b905060200201359050606f60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205460011480156115a1575073ffffffffffffffffffffffffffffffffffffffff83166000908152607060209081526040808320338452909152902054155b156115d8576040517f584a793800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040805173ffffffffffffffffffffffffffffffffffffffff8086166020830152841691810191909152606081018290526000906080016040516020818303038152906040528051906020012090506116868189898881811061163d5761163d6134cb565b905060200281019061164f91906134fa565b8080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525061272f92505050565b6116bc576040517f09bde33900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff8085166000908152606d602090815260408083209387168352929052908120546117179079ffffffffffffffffffffffffffffffffffffffffffffffffffff1684613443565b9050604051806060016040528061172d8561285b565b79ffffffffffffffffffffffffffffffffffffffffffffffffffff1681526020014265ffffffffffff168152602001611764610f84565b905273ffffffffffffffffffffffffffffffffffffffff8087166000908152606d602090815260408083209389168084529382529182902084519185015165ffffffffffff167a0100000000000000000000000000000000000000000000000000000279ffffffffffffffffffffffffffffffffffffffffffffffffffff909216919091178155920151600190920191909155611802908683612309565b8373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167ff7a40077ff7a04c7e61f6f26fb13774259ddf1b6bce9ecf26a8276cdd39926838360405161186191815260200190565b60405180910390a385600101955050505050506114a9565b50505050505050505050565b606a546040517f521d4de900000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff9091169063521d4de990602401602060405180830381865afa1580156118f3573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061191791906133f7565b61194d576040517f99e120bc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff81166000908152606e602052604081205461197e906001613443565b73ffffffffffffffffffffffffffffffffffffffff83166000818152606e6020908152604091829020849055905160018414815292935090917f7628ea5f6112a16b36a8239aa208395a8e8f221688cfb3a5461faffb9700abcd910160405180910390a25050565b606a546040517f521d4de900000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff9091169063521d4de990602401602060405180830381865afa158015611a54573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a7891906133f7565b611aae576040517f99e120bc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606b5473ffffffffffffffffffffffffffffffffffffffff16611afd576040517f9375474800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8015611b3e57606b54606c54606954611b319273ffffffffffffffffffffffffffffffffffffffff91821692911690612309565b611b3961290b565b611b96565b606c54606954611b689173ffffffffffffffffffffffffffffffffffffffff909116903390612309565b611b71426129e1565b606b60146101000a81548165ffffffffffff021916908365ffffffffffff1602179055505b606b80547fffffffffffffffffffffffff000000000000000000000000000000000000000016905560405181151581527f8015c5005d9ad5d85ca80d3f894f08e0159277704c54166e5cff108800fa80cd90602001610804565b606a546040517f521d4de900000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff9091169063521d4de990602401602060405180830381865afa158015611c5e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c8291906133f7565b611cb8576040517f99e120bc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606b5473ffffffffffffffffffffffffffffffffffffffff1615611d08576040517f0583257400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b611d1061290b565b565b8173ffffffffffffffffffffffffffffffffffffffff81163314801590611d495750336000908152606e6020526040902054600114155b8015611de45750606a546040517f521d4de900000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff9091169063521d4de990602401602060405180830381865afa158015611dbe573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611de291906133f7565b155b15611e1b576040517fc22a648e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff808416600090815260706020908152604080832093861683529290522054611e59816001613443565b73ffffffffffffffffffffffffffffffffffffffff858116600081815260706020908152604080832094891680845294825291829020949094555184158152919290917f42343f44c66ea1eaffa334760d3da2cb731d2a0b3b3e30423df997faa36cc95c910160405180910390a350505050565b600054610100900460ff1615808015611eed5750600054600160ff909116105b80611f075750303b158015611f07575060005460ff166001145b611f93576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a65640000000000000000000000000000000000006064820152608401610cf4565b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790558015611ff157600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff166101001790555b73ffffffffffffffffffffffffffffffffffffffff821661203e576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606a80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff841617905580156111d457600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15050565b606b5473ffffffffffffffffffffffffffffffffffffffff161515806121e05750336000908152606e602052604090205460011415806121455750606b5474010000000000000000000000000000000000000000900465ffffffffffff1642105b80156121e05750606a546040517f521d4de900000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff9091169063521d4de990602401602060405180830381865afa1580156121ba573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121de91906133f7565b155b15612217576040517fc22a648e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b604080518082019091526065805480835260668054602080860182905286359094559285013590556067556068556000612250426129e1565b606b80547fffffffffffff000000000000ffffffffffffffffffffffffffffffffffffffff167401000000000000000000000000000000000000000065ffffffffffff841690810291909117909155604080518635815260208088013590820152908101919091529091507f23aa2e4f757a7bd974085d3e11439a843b137b30905e3ffd51b2097c34aef62e9060600160405180910390a1505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b60405173ffffffffffffffffffffffffffffffffffffffff83166024820152604481018290526123dd9084907fa9059cbb00000000000000000000000000000000000000000000000000000000906064015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152612a46565b505050565b60405173ffffffffffffffffffffffffffffffffffffffff808516602483015283166044820152606481018290526124409085907f23b872dd000000000000000000000000000000000000000000000000000000009060840161235b565b50505050565b606a5473ffffffffffffffffffffffffffffffffffffffff1680158015906124f957506040517f521d4de900000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff82169063521d4de990602401602060405180830381865afa1580156124d3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124f791906133f7565b155b156111d4576040517f99e120bc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff1615612563576123dd83612b52565b8273ffffffffffffffffffffffffffffffffffffffff166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa9250505080156125e8575060408051601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01682019092526125e591810190613562565b60015b612674576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201527f6f6e206973206e6f7420555550530000000000000000000000000000000000006064820152608401610cf4565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc8114612723576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f7860448201527f6961626c655555494400000000000000000000000000000000000000000000006064820152608401610cf4565b506123dd838383612c5c565b80516000908390825b8181101561280957848181518110612752576127526134cb565b60200260200101518310156127b35782858281518110612774576127746134cb565b6020026020010151604051602001612796929190918252602082015260400190565b604051602081830303815290604052805190602001209250612801565b8481815181106127c5576127c56134cb565b6020026020010151836040516020016127e8929190918252602082015260400190565b6040516020818303038152906040528051906020012092505b600101612738565b506000612814610f84565b90508061284d576040517f094ad65800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b919091149150505b92915050565b600079ffffffffffffffffffffffffffffffffffffffffffffffffffff821115612907576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602760248201527f53616665436173743a2076616c756520646f65736e27742066697420696e203260448201527f30382062697473000000000000000000000000000000000000000000000000006064820152608401610cf4565b5090565b60408051808201825260675480825260685460208301819052606b80547fffffffffffff000000000000ffffffffffffffffffffffffffffffffffffffff16905560659190915560665590517f44825a4b2df8acb19ce4e1afba9aa850c8b65cdb7942e2078f27d0b0960efee690600090a1805160208201517f23aa2e4f757a7bd974085d3e11439a843b137b30905e3ffd51b2097c34aef62e9190610e106129b4814261357b565b6129be91906135c7565b60408051938452602084019290925265ffffffffffff1690820152606001610804565b606b54600090610e10907a010000000000000000000000000000000000000000000000000000900465ffffffffffff1681612a1d6001866135f1565b612a27919061357b565b612a32906001613617565b612a3c9190613617565b61285591906135c7565b6000612aa8826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16612c819092919063ffffffff16565b8051909150156123dd5780806020019051810190612ac691906133f7565b6123dd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610cf4565b73ffffffffffffffffffffffffffffffffffffffff81163b612bf6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e7472616374000000000000000000000000000000000000006064820152608401610cf4565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b612c6583612c9a565b600082511180612c725750805b156123dd576124408383612ce7565b6060612c908484600085612e26565b90505b9392505050565b612ca381612b52565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b606073ffffffffffffffffffffffffffffffffffffffff83163b612d8d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e747261637400000000000000000000000000000000000000000000000000006064820152608401610cf4565b6000808473ffffffffffffffffffffffffffffffffffffffff1684604051612db59190613636565b600060405180830381855af49150503d8060008114612df0576040519150601f19603f3d011682016040523d82523d6000602084013e612df5565b606091505b5091509150612e1d828260405180606001604052806027815260200161365360279139612f41565b95945050505050565b606082471015612eb8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610cf4565b6000808673ffffffffffffffffffffffffffffffffffffffff168587604051612ee19190613636565b60006040518083038185875af1925050503d8060008114612f1e576040519150601f19603f3d011682016040523d82523d6000602084013e612f23565b606091505b5091509150612f3487838387612f5a565b925050505b949350505050565b60608315612f50575081612c93565b612c938383612ff6565b60608315612ff0578251600003612fe95773ffffffffffffffffffffffffffffffffffffffff85163b612fe9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610cf4565b5081612f39565b612f3983835b8151156130065781518083602001fd5b806040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cf4919061347a565b73ffffffffffffffffffffffffffffffffffffffff81168114610e3a57600080fd5b6000806040838503121561306f57600080fd5b823561307a8161303a565b9150602083013561308a8161303a565b809150509250929050565b6000602082840312156130a757600080fd5b5035919050565b6000806000606084860312156130c357600080fd5b83356130ce8161303a565b925060208401356130de8161303a565b929592945050506040919091013590565b60006020828403121561310157600080fd5b8135612c938161303a565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600067ffffffffffffffff808411156131565761315661310c565b604051601f85017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f0116810190828211818310171561319c5761319c61310c565b816040528093508581528686860111156131b557600080fd5b858560208301376000602087830101525050509392505050565b6000602082840312156131e157600080fd5b813567ffffffffffffffff8111156131f857600080fd5b8201601f8101841361320957600080fd5b612f398482356020840161313b565b60006020828403121561322a57600080fd5b813565ffffffffffff81168114612c9357600080fd5b6000806040838503121561325357600080fd5b823561325e8161303a565b9150602083013567ffffffffffffffff81111561327a57600080fd5b8301601f8101851361328b57600080fd5b61329a8582356020840161313b565b9150509250929050565b60008083601f8401126132b657600080fd5b50813567ffffffffffffffff8111156132ce57600080fd5b6020830191508360208260051b85010111156132e957600080fd5b9250929050565b6000806000806000806000806080898b03121561330c57600080fd5b883567ffffffffffffffff8082111561332457600080fd5b6133308c838d016132a4565b909a50985060208b013591508082111561334957600080fd5b6133558c838d016132a4565b909850965060408b013591508082111561336e57600080fd5b61337a8c838d016132a4565b909650945060608b013591508082111561339357600080fd5b506133a08b828c016132a4565b999c989b5096995094979396929594505050565b8015158114610e3a57600080fd5b6000602082840312156133d457600080fd5b8135612c93816133b4565b6000604082840312156133f157600080fd5b50919050565b60006020828403121561340957600080fd5b8151612c93816133b4565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b8181038181111561285557612855613414565b60005b83811015613471578181015183820152602001613459565b50506000910152565b6020815260008251806020840152613499816040850160208701613456565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169190910160400192915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe184360301811261352f57600080fd5b83018035915067ffffffffffffffff82111561354a57600080fd5b6020019150600581901b36038213156132e957600080fd5b60006020828403121561357457600080fd5b5051919050565b600065ffffffffffff808416806135bb577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b92169190910492915050565b65ffffffffffff8181168382160280821691908281146135e9576135e9613414565b505092915050565b65ffffffffffff82811682821603908082111561361057613610613414565b5092915050565b65ffffffffffff81811683821601908082111561361057613610613414565b60008251613648818460208701613456565b919091019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b34d02b1c5423a38ab6e0daaa965103d5485c504a385a0bee80f718a7c3fcce164736f6c63430008110033496e697469616c697a61626c653a20636f6e747261637420697320616c7265617f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498", + "deployedBytecode": "0x6080604052600436106101c25760003560e01c80635cec892a116100f7578063bdac7ca311610095578063d9c9808711610064578063d9c9808714610626578063e57480e514610646578063f2f4eb2614610673578063fd54b228146106a057600080fd5b8063bdac7ca314610589578063c4d66de8146105a9578063c748d261146105c9578063cce80e7a146105f657600080fd5b806371ee95c0116100d157806371ee95c0146105145780637ee843491461053457806389e1e82a14610554578063957888351461057457600080fd5b80635cec892a1461046b578063623b9e9d146104a25780636ac56103146104c257600080fd5b80632a25dd4111610164578063495906571161013e57806349590657146103da5780634f1ef286146103ef57806352d1902d146104025780635bf31d4d1461041757600080fd5b80632a25dd411461037a5780633659cfe61461039a5780634641fdef146103ba57600080fd5b80631171bda9116101a05780631171bda9146102d557806314769142146102f55780632637588e14610322578063288278381461035a57600080fd5b806309454ba3146101c75780630c9cbf0e146101f05780630d10fca3146102b3575b600080fd5b3480156101d357600080fd5b506101dd606c5481565b6040519081526020015b60405180910390f35b3480156101fc57600080fd5b5061027461020b36600461305c565b606d6020908152600092835260408084209091529082529020805460019091015479ffffffffffffffffffffffffffffffffffffffffffffffffffff8216917a010000000000000000000000000000000000000000000000000000900465ffffffffffff169083565b6040805179ffffffffffffffffffffffffffffffffffffffffffffffffffff909416845265ffffffffffff9092166020840152908201526060016101e7565b3480156102bf57600080fd5b506102d36102ce366004613095565b6106bb565b005b3480156102e157600080fd5b506102d36102f03660046130ae565b61080f565b34801561030157600080fd5b506101dd6103103660046130ef565b606f6020526000908152604090205481565b34801561032e57600080fd5b506101dd61033d36600461305c565b607060209081526000928352604080842090915290825290205481565b34801561036657600080fd5b506102d36103753660046130ef565b610964565b34801561038657600080fd5b506102d36103953660046131cf565b610b02565b3480156103a657600080fd5b506102d36103b53660046130ef565b610c33565b3480156103c657600080fd5b506102d36103d5366004613218565b610e3d565b3480156103e657600080fd5b506101dd610f84565b6102d36103fd366004613240565b610fe2565b34801561040e57600080fd5b506101dd6111d8565b34801561042357600080fd5b50606b54610454907a010000000000000000000000000000000000000000000000000000900465ffffffffffff1681565b60405165ffffffffffff90911681526020016101e7565b34801561047757600080fd5b50606b546104549074010000000000000000000000000000000000000000900465ffffffffffff1681565b3480156104ae57600080fd5b506102d36104bd3660046130ef565b6112c4565b3480156104ce57600080fd5b50606b546104ef9073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016101e7565b34801561052057600080fd5b506102d361052f3660046132f0565b61144b565b34801561054057600080fd5b506102d361054f3660046130ef565b611885565b34801561056057600080fd5b506102d361056f3660046133c2565b6119e6565b34801561058057600080fd5b506102d3611bf0565b34801561059557600080fd5b506102d36105a436600461305c565b611d12565b3480156105b557600080fd5b506102d36105c43660046130ef565b611ecd565b3480156105d557600080fd5b506069546104ef9073ffffffffffffffffffffffffffffffffffffffff1681565b34801561060257600080fd5b50606754606854610611919082565b604080519283526020830191909152016101e7565b34801561063257600080fd5b506102d36106413660046133df565b6120e4565b34801561065257600080fd5b506101dd6106613660046130ef565b606e6020526000908152604090205481565b34801561067f57600080fd5b50606a546104ef9073ffffffffffffffffffffffffffffffffffffffff1681565b3480156106ac57600080fd5b50606554606654610611919082565b606a546040517f521d4de900000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff9091169063521d4de990602401602060405180830381865afa158015610729573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061074d91906133f7565b610783576040517f99e120bc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606b5473ffffffffffffffffffffffffffffffffffffffff16156107d3576040517f0583257400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606c8190556040518181527f39bb629f3d59f5eddf978050e1f5fabeca2b5d02dfc9c25e84f32e7da1069db4906020015b60405180910390a150565b606a546040517f521d4de900000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff9091169063521d4de990602401602060405180830381865afa15801561087d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108a191906133f7565b6108d7576040517f99e120bc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6108f873ffffffffffffffffffffffffffffffffffffffff84168383612309565b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167ffff3b3844276f57024e0b42afec1a37f75db36511e43819a4f2a63ab7862b6488360405161095791815260200190565b60405180910390a3505050565b8073ffffffffffffffffffffffffffffffffffffffff8116331480159061099b5750336000908152606e6020526040902054600114155b8015610a365750606a546040517f521d4de900000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff9091169063521d4de990602401602060405180830381865afa158015610a10573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a3491906133f7565b155b15610a6d576040517fc22a648e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff82166000908152606f6020526040902054610a9e816001613443565b73ffffffffffffffffffffffffffffffffffffffff84166000818152606f602090815260409182902093909355518315815290917f81d714ca01079a19c106993b49b2764df6bb6abe740164ef7b77ee9c100a024a910160405180910390a2505050565b606b5473ffffffffffffffffffffffffffffffffffffffff1615610b52576040517f0583257400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606b5474010000000000000000000000000000000000000000900465ffffffffffff164210610bad576040517f1a8f039500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606c54606954610bd99173ffffffffffffffffffffffffffffffffffffffff90911690339030906123e2565b606b80547fffffffffffffffffffffffff000000000000000000000000000000000000000016331790556040517f5eca00b8ed745eee61451333090bfa56aa1f2a9e696a2aebe5f1f5b6cef6f2ff9061080490839061347a565b73ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000163003610cfd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602c60248201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060448201527f64656c656761746563616c6c000000000000000000000000000000000000000060648201526084015b60405180910390fd5b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16610d727f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5473ffffffffffffffffffffffffffffffffffffffff1690565b73ffffffffffffffffffffffffffffffffffffffff1614610e15576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602c60248201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060448201527f6163746976652070726f787900000000000000000000000000000000000000006064820152608401610cf4565b610e1e81612446565b60408051600080825260208201909252610e3a91839190612530565b50565b606a546040517f521d4de900000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff9091169063521d4de990602401602060405180830381865afa158015610eab573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ecf91906133f7565b610f05576040517f99e120bc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606b805479ffffffffffffffffffffffffffffffffffffffffffffffffffff167a01000000000000000000000000000000000000000000000000000065ffffffffffff8416908102919091179091556040519081527ffdf22e84af74bd4ab6b9646f6370a02bc886ed6ac25882db14e4ebf4b8e3bc7e90602001610804565b606b5460009074010000000000000000000000000000000000000000900465ffffffffffff164210801590610fcf5750606b5473ffffffffffffffffffffffffffffffffffffffff16155b15610fdb575060655490565b5060675490565b73ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001630036110a7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602c60248201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060448201527f64656c656761746563616c6c00000000000000000000000000000000000000006064820152608401610cf4565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1661111c7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5473ffffffffffffffffffffffffffffffffffffffff1690565b73ffffffffffffffffffffffffffffffffffffffff16146111bf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602c60248201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060448201527f6163746976652070726f787900000000000000000000000000000000000000006064820152608401610cf4565b6111c882612446565b6111d482826001612530565b5050565b60003073ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000161461129f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c60448201527f6c6564207468726f7567682064656c656761746563616c6c00000000000000006064820152608401610cf4565b507f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc90565b606a546040517f521d4de900000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff9091169063521d4de990602401602060405180830381865afa158015611332573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061135691906133f7565b61138c576040517f99e120bc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606b5473ffffffffffffffffffffffffffffffffffffffff16156113dc576040517f0583257400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606980547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081179091556040517f1db8d6629941dcb63d5e0c927b89c174c714e139a4b9107a49de839d755f5d7490600090a250565b868015806114595750808614155b806114645750808414155b8061146f5750808214155b156114a6576040517f1df89e8b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60005b818110156118795760008a8a838181106114c5576114c56134cb565b90506020020160208101906114da91906130ef565b905060008989848181106114f0576114f06134cb565b905060200201602081019061150591906130ef565b9050600088888581811061151b5761151b6134cb565b905060200201359050606f60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205460011480156115a1575073ffffffffffffffffffffffffffffffffffffffff83166000908152607060209081526040808320338452909152902054155b156115d8576040517f584a793800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040805173ffffffffffffffffffffffffffffffffffffffff8086166020830152841691810191909152606081018290526000906080016040516020818303038152906040528051906020012090506116868189898881811061163d5761163d6134cb565b905060200281019061164f91906134fa565b8080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525061272f92505050565b6116bc576040517f09bde33900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff8085166000908152606d602090815260408083209387168352929052908120546117179079ffffffffffffffffffffffffffffffffffffffffffffffffffff1684613443565b9050604051806060016040528061172d8561285b565b79ffffffffffffffffffffffffffffffffffffffffffffffffffff1681526020014265ffffffffffff168152602001611764610f84565b905273ffffffffffffffffffffffffffffffffffffffff8087166000908152606d602090815260408083209389168084529382529182902084519185015165ffffffffffff167a0100000000000000000000000000000000000000000000000000000279ffffffffffffffffffffffffffffffffffffffffffffffffffff909216919091178155920151600190920191909155611802908683612309565b8373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167ff7a40077ff7a04c7e61f6f26fb13774259ddf1b6bce9ecf26a8276cdd39926838360405161186191815260200190565b60405180910390a385600101955050505050506114a9565b50505050505050505050565b606a546040517f521d4de900000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff9091169063521d4de990602401602060405180830381865afa1580156118f3573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061191791906133f7565b61194d576040517f99e120bc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff81166000908152606e602052604081205461197e906001613443565b73ffffffffffffffffffffffffffffffffffffffff83166000818152606e6020908152604091829020849055905160018414815292935090917f7628ea5f6112a16b36a8239aa208395a8e8f221688cfb3a5461faffb9700abcd910160405180910390a25050565b606a546040517f521d4de900000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff9091169063521d4de990602401602060405180830381865afa158015611a54573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a7891906133f7565b611aae576040517f99e120bc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606b5473ffffffffffffffffffffffffffffffffffffffff16611afd576040517f9375474800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8015611b3e57606b54606c54606954611b319273ffffffffffffffffffffffffffffffffffffffff91821692911690612309565b611b3961290b565b611b96565b606c54606954611b689173ffffffffffffffffffffffffffffffffffffffff909116903390612309565b611b71426129e1565b606b60146101000a81548165ffffffffffff021916908365ffffffffffff1602179055505b606b80547fffffffffffffffffffffffff000000000000000000000000000000000000000016905560405181151581527f8015c5005d9ad5d85ca80d3f894f08e0159277704c54166e5cff108800fa80cd90602001610804565b606a546040517f521d4de900000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff9091169063521d4de990602401602060405180830381865afa158015611c5e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c8291906133f7565b611cb8576040517f99e120bc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606b5473ffffffffffffffffffffffffffffffffffffffff1615611d08576040517f0583257400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b611d1061290b565b565b8173ffffffffffffffffffffffffffffffffffffffff81163314801590611d495750336000908152606e6020526040902054600114155b8015611de45750606a546040517f521d4de900000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff9091169063521d4de990602401602060405180830381865afa158015611dbe573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611de291906133f7565b155b15611e1b576040517fc22a648e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff808416600090815260706020908152604080832093861683529290522054611e59816001613443565b73ffffffffffffffffffffffffffffffffffffffff858116600081815260706020908152604080832094891680845294825291829020949094555184158152919290917f42343f44c66ea1eaffa334760d3da2cb731d2a0b3b3e30423df997faa36cc95c910160405180910390a350505050565b600054610100900460ff1615808015611eed5750600054600160ff909116105b80611f075750303b158015611f07575060005460ff166001145b611f93576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a65640000000000000000000000000000000000006064820152608401610cf4565b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790558015611ff157600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff166101001790555b73ffffffffffffffffffffffffffffffffffffffff821661203e576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606a80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff841617905580156111d457600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15050565b606b5473ffffffffffffffffffffffffffffffffffffffff161515806121e05750336000908152606e602052604090205460011415806121455750606b5474010000000000000000000000000000000000000000900465ffffffffffff1642105b80156121e05750606a546040517f521d4de900000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff9091169063521d4de990602401602060405180830381865afa1580156121ba573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121de91906133f7565b155b15612217576040517fc22a648e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b604080518082019091526065805480835260668054602080860182905286359094559285013590556067556068556000612250426129e1565b606b80547fffffffffffff000000000000ffffffffffffffffffffffffffffffffffffffff167401000000000000000000000000000000000000000065ffffffffffff841690810291909117909155604080518635815260208088013590820152908101919091529091507f23aa2e4f757a7bd974085d3e11439a843b137b30905e3ffd51b2097c34aef62e9060600160405180910390a1505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b60405173ffffffffffffffffffffffffffffffffffffffff83166024820152604481018290526123dd9084907fa9059cbb00000000000000000000000000000000000000000000000000000000906064015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152612a46565b505050565b60405173ffffffffffffffffffffffffffffffffffffffff808516602483015283166044820152606481018290526124409085907f23b872dd000000000000000000000000000000000000000000000000000000009060840161235b565b50505050565b606a5473ffffffffffffffffffffffffffffffffffffffff1680158015906124f957506040517f521d4de900000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff82169063521d4de990602401602060405180830381865afa1580156124d3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124f791906133f7565b155b156111d4576040517f99e120bc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff1615612563576123dd83612b52565b8273ffffffffffffffffffffffffffffffffffffffff166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa9250505080156125e8575060408051601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01682019092526125e591810190613562565b60015b612674576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201527f6f6e206973206e6f7420555550530000000000000000000000000000000000006064820152608401610cf4565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc8114612723576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f7860448201527f6961626c655555494400000000000000000000000000000000000000000000006064820152608401610cf4565b506123dd838383612c5c565b80516000908390825b8181101561280957848181518110612752576127526134cb565b60200260200101518310156127b35782858281518110612774576127746134cb565b6020026020010151604051602001612796929190918252602082015260400190565b604051602081830303815290604052805190602001209250612801565b8481815181106127c5576127c56134cb565b6020026020010151836040516020016127e8929190918252602082015260400190565b6040516020818303038152906040528051906020012092505b600101612738565b506000612814610f84565b90508061284d576040517f094ad65800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b919091149150505b92915050565b600079ffffffffffffffffffffffffffffffffffffffffffffffffffff821115612907576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602760248201527f53616665436173743a2076616c756520646f65736e27742066697420696e203260448201527f30382062697473000000000000000000000000000000000000000000000000006064820152608401610cf4565b5090565b60408051808201825260675480825260685460208301819052606b80547fffffffffffff000000000000ffffffffffffffffffffffffffffffffffffffff16905560659190915560665590517f44825a4b2df8acb19ce4e1afba9aa850c8b65cdb7942e2078f27d0b0960efee690600090a1805160208201517f23aa2e4f757a7bd974085d3e11439a843b137b30905e3ffd51b2097c34aef62e9190610e106129b4814261357b565b6129be91906135c7565b60408051938452602084019290925265ffffffffffff1690820152606001610804565b606b54600090610e10907a010000000000000000000000000000000000000000000000000000900465ffffffffffff1681612a1d6001866135f1565b612a27919061357b565b612a32906001613617565b612a3c9190613617565b61285591906135c7565b6000612aa8826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16612c819092919063ffffffff16565b8051909150156123dd5780806020019051810190612ac691906133f7565b6123dd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610cf4565b73ffffffffffffffffffffffffffffffffffffffff81163b612bf6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e7472616374000000000000000000000000000000000000006064820152608401610cf4565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b612c6583612c9a565b600082511180612c725750805b156123dd576124408383612ce7565b6060612c908484600085612e26565b90505b9392505050565b612ca381612b52565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b606073ffffffffffffffffffffffffffffffffffffffff83163b612d8d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e747261637400000000000000000000000000000000000000000000000000006064820152608401610cf4565b6000808473ffffffffffffffffffffffffffffffffffffffff1684604051612db59190613636565b600060405180830381855af49150503d8060008114612df0576040519150601f19603f3d011682016040523d82523d6000602084013e612df5565b606091505b5091509150612e1d828260405180606001604052806027815260200161365360279139612f41565b95945050505050565b606082471015612eb8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610cf4565b6000808673ffffffffffffffffffffffffffffffffffffffff168587604051612ee19190613636565b60006040518083038185875af1925050503d8060008114612f1e576040519150601f19603f3d011682016040523d82523d6000602084013e612f23565b606091505b5091509150612f3487838387612f5a565b925050505b949350505050565b60608315612f50575081612c93565b612c938383612ff6565b60608315612ff0578251600003612fe95773ffffffffffffffffffffffffffffffffffffffff85163b612fe9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610cf4565b5081612f39565b612f3983835b8151156130065781518083602001fd5b806040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cf4919061347a565b73ffffffffffffffffffffffffffffffffffffffff81168114610e3a57600080fd5b6000806040838503121561306f57600080fd5b823561307a8161303a565b9150602083013561308a8161303a565b809150509250929050565b6000602082840312156130a757600080fd5b5035919050565b6000806000606084860312156130c357600080fd5b83356130ce8161303a565b925060208401356130de8161303a565b929592945050506040919091013590565b60006020828403121561310157600080fd5b8135612c938161303a565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600067ffffffffffffffff808411156131565761315661310c565b604051601f85017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f0116810190828211818310171561319c5761319c61310c565b816040528093508581528686860111156131b557600080fd5b858560208301376000602087830101525050509392505050565b6000602082840312156131e157600080fd5b813567ffffffffffffffff8111156131f857600080fd5b8201601f8101841361320957600080fd5b612f398482356020840161313b565b60006020828403121561322a57600080fd5b813565ffffffffffff81168114612c9357600080fd5b6000806040838503121561325357600080fd5b823561325e8161303a565b9150602083013567ffffffffffffffff81111561327a57600080fd5b8301601f8101851361328b57600080fd5b61329a8582356020840161313b565b9150509250929050565b60008083601f8401126132b657600080fd5b50813567ffffffffffffffff8111156132ce57600080fd5b6020830191508360208260051b85010111156132e957600080fd5b9250929050565b6000806000806000806000806080898b03121561330c57600080fd5b883567ffffffffffffffff8082111561332457600080fd5b6133308c838d016132a4565b909a50985060208b013591508082111561334957600080fd5b6133558c838d016132a4565b909850965060408b013591508082111561336e57600080fd5b61337a8c838d016132a4565b909650945060608b013591508082111561339357600080fd5b506133a08b828c016132a4565b999c989b5096995094979396929594505050565b8015158114610e3a57600080fd5b6000602082840312156133d457600080fd5b8135612c93816133b4565b6000604082840312156133f157600080fd5b50919050565b60006020828403121561340957600080fd5b8151612c93816133b4565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b8181038181111561285557612855613414565b60005b83811015613471578181015183820152602001613459565b50506000910152565b6020815260008251806020840152613499816040850160208701613456565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169190910160400192915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe184360301811261352f57600080fd5b83018035915067ffffffffffffffff82111561354a57600080fd5b6020019150600581901b36038213156132e957600080fd5b60006020828403121561357457600080fd5b5051919050565b600065ffffffffffff808416806135bb577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b92169190910492915050565b65ffffffffffff8181168382160280821691908281146135e9576135e9613414565b505092915050565b65ffffffffffff82811682821603908082111561361057613610613414565b5092915050565b65ffffffffffff81811683821601908082111561361057613610613414565b60008251613648818460208701613456565b919091019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b34d02b1c5423a38ab6e0daaa965103d5485c504a385a0bee80f718a7c3fcce164736f6c63430008110033", + "devdoc": { + "author": "Angle Labs. Inc", + "kind": "dev", + "methods": { + "claim(address[],address[],uint256[],bytes32[][])": { + "details": "Anyone may call this function for anyone else, funds go to destination regardless, it's just a question of who provides the proof and pays the gas: `msg.sender` is used only for addresses that require a trusted operator", + "params": { + "amounts": "Amount of tokens that will be sent to the corresponding users", + "proofs": "Array of hashes bridging from a leaf `(hash of user | token | amount)` to the Merkle root", + "tokens": "ERC20 claimed", + "users": "Recipient of tokens" + } + }, + "disputeTree(string)": { + "details": "Requires a deposit of `disputeToken` that'll be slashed if the dispute is not acceptedIt is only possible to create a dispute within `disputePeriod` after each tree update" + }, + "proxiableUUID()": { + "details": "Implementation of the ERC1822 {proxiableUUID} function. This returns the storage slot used by the implementation. It is used to validate the implementation's compatibility when performing an upgrade. IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this function revert if invoked through a proxy. This is guaranteed by the `notDelegated` modifier." + }, + "resolveDispute(bool)": { + "params": { + "valid": "Whether the dispute was valid" + } + }, + "upgradeTo(address)": { + "details": "Upgrade the implementation of the proxy to `newImplementation`. Calls {_authorizeUpgrade}. Emits an {Upgraded} event." + }, + "upgradeToAndCall(address,bytes)": { + "details": "Upgrade the implementation of the proxy to `newImplementation`, and subsequently execute the function call encoded in `data`. Calls {_authorizeUpgrade}. Emits an {Upgraded} event." + } + }, + "stateVariables": { + "disputer": { + "details": "Used to store if there is an ongoing dispute" + } + }, + "title": "Distributor", + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": { + "canUpdateMerkleRoot(address)": { + "notice": "Trusted EOAs to update the Merkle root" + }, + "claim(address[],address[],uint256[],bytes32[][])": { + "notice": "Claims rewards for a given set of users" + }, + "claimed(address,address)": { + "notice": "Mapping user -> token -> amount to track claimed amounts" + }, + "core()": { + "notice": "`Core` contract handling access control" + }, + "disputeAmount()": { + "notice": "Amount to deposit to freeze the roots update" + }, + "disputePeriod()": { + "notice": "Time after which a change in a tree becomes effective, in EPOCH_DURATION" + }, + "disputeToken()": { + "notice": "Token to deposit to freeze the roots update" + }, + "disputeTree(string)": { + "notice": "Freezes the Merkle tree update until the dispute is resolved" + }, + "disputer()": { + "notice": "Address which created the dispute" + }, + "endOfDisputePeriod()": { + "notice": "When the current tree will become valid" + }, + "getMerkleRoot()": { + "notice": "Returns the MerkleRoot that is currently live for the contract" + }, + "lastTree()": { + "notice": "Tree that was in place in the contract before the last `tree` update" + }, + "onlyOperatorCanClaim(address)": { + "notice": "Whether or not to disable permissionless claiming" + }, + "operators(address,address)": { + "notice": "user -> operator -> authorisation to claim" + }, + "recoverERC20(address,address,uint256)": { + "notice": "Recovers any ERC20 token" + }, + "resolveDispute(bool)": { + "notice": "Resolve the ongoing dispute, if any" + }, + "revokeTree()": { + "notice": "Allows the governor or the guardian of this contract to fallback to the last version of the tree immediately" + }, + "setDisputeAmount(uint256)": { + "notice": "Sets the amount of `disputeToken` used as a caution during disputes" + }, + "setDisputePeriod(uint48)": { + "notice": "Sets the dispute period after which a tree update becomes effective" + }, + "setDisputeToken(address)": { + "notice": "Sets the token used as a caution during disputes" + }, + "toggleOnlyOperatorCanClaim(address)": { + "notice": "Toggles permissioned claiming for a given user" + }, + "toggleOperator(address,address)": { + "notice": "Toggles whitelisting for a given user and a given operator" + }, + "toggleTrusted(address)": { + "notice": "Adds or removes EOAs which are trusted to update the Merkle root" + }, + "tree()": { + "notice": "Tree of claimable tokens through this contract" + }, + "updateTree((bytes32,bytes32))": { + "notice": "Updates Merkle Tree" + } + }, + "notice": "Allows LPs on AMMs with concentrated liquidity to claim the rewards that were distributed to them", + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 395, + "contract": "contracts/Distributor.sol:Distributor", + "label": "_initialized", + "offset": 0, + "slot": "0", + "type": "t_uint8" + }, + { + "astId": 398, + "contract": "contracts/Distributor.sol:Distributor", + "label": "_initializing", + "offset": 1, + "slot": "0", + "type": "t_bool" + }, + { + "astId": 377, + "contract": "contracts/Distributor.sol:Distributor", + "label": "__gap", + "offset": 0, + "slot": "1", + "type": "t_array(t_uint256)50_storage" + }, + { + "astId": 692, + "contract": "contracts/Distributor.sol:Distributor", + "label": "__gap", + "offset": 0, + "slot": "51", + "type": "t_array(t_uint256)50_storage" + }, + { + "astId": 6919, + "contract": "contracts/Distributor.sol:Distributor", + "label": "tree", + "offset": 0, + "slot": "101", + "type": "t_struct(MerkleTree)6897_storage" + }, + { + "astId": 6923, + "contract": "contracts/Distributor.sol:Distributor", + "label": "lastTree", + "offset": 0, + "slot": "103", + "type": "t_struct(MerkleTree)6897_storage" + }, + { + "astId": 6927, + "contract": "contracts/Distributor.sol:Distributor", + "label": "disputeToken", + "offset": 0, + "slot": "105", + "type": "t_contract(IERC20)1266" + }, + { + "astId": 6931, + "contract": "contracts/Distributor.sol:Distributor", + "label": "core", + "offset": 0, + "slot": "106", + "type": "t_contract(ICore)8866" + }, + { + "astId": 6934, + "contract": "contracts/Distributor.sol:Distributor", + "label": "disputer", + "offset": 0, + "slot": "107", + "type": "t_address" + }, + { + "astId": 6937, + "contract": "contracts/Distributor.sol:Distributor", + "label": "endOfDisputePeriod", + "offset": 20, + "slot": "107", + "type": "t_uint48" + }, + { + "astId": 6940, + "contract": "contracts/Distributor.sol:Distributor", + "label": "disputePeriod", + "offset": 26, + "slot": "107", + "type": "t_uint48" + }, + { + "astId": 6943, + "contract": "contracts/Distributor.sol:Distributor", + "label": "disputeAmount", + "offset": 0, + "slot": "108", + "type": "t_uint256" + }, + { + "astId": 6951, + "contract": "contracts/Distributor.sol:Distributor", + "label": "claimed", + "offset": 0, + "slot": "109", + "type": "t_mapping(t_address,t_mapping(t_address,t_struct(Claim)6904_storage))" + }, + { + "astId": 6956, + "contract": "contracts/Distributor.sol:Distributor", + "label": "canUpdateMerkleRoot", + "offset": 0, + "slot": "110", + "type": "t_mapping(t_address,t_uint256)" + }, + { + "astId": 6961, + "contract": "contracts/Distributor.sol:Distributor", + "label": "onlyOperatorCanClaim", + "offset": 0, + "slot": "111", + "type": "t_mapping(t_address,t_uint256)" + }, + { + "astId": 6968, + "contract": "contracts/Distributor.sol:Distributor", + "label": "operators", + "offset": 0, + "slot": "112", + "type": "t_mapping(t_address,t_mapping(t_address,t_uint256))" + }, + { + "astId": 6972, + "contract": "contracts/Distributor.sol:Distributor", + "label": "__gap", + "offset": 0, + "slot": "113", + "type": "t_array(t_uint256)38_storage" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_array(t_uint256)38_storage": { + "base": "t_uint256", + "encoding": "inplace", + "label": "uint256[38]", + "numberOfBytes": "1216" + }, + "t_array(t_uint256)50_storage": { + "base": "t_uint256", + "encoding": "inplace", + "label": "uint256[50]", + "numberOfBytes": "1600" + }, + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_bytes32": { + "encoding": "inplace", + "label": "bytes32", + "numberOfBytes": "32" + }, + "t_contract(ICore)8866": { + "encoding": "inplace", + "label": "contract ICore", + "numberOfBytes": "20" + }, + "t_contract(IERC20)1266": { + "encoding": "inplace", + "label": "contract IERC20", + "numberOfBytes": "20" + }, + "t_mapping(t_address,t_mapping(t_address,t_struct(Claim)6904_storage))": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => mapping(address => struct Claim))", + "numberOfBytes": "32", + "value": "t_mapping(t_address,t_struct(Claim)6904_storage)" + }, + "t_mapping(t_address,t_mapping(t_address,t_uint256))": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => mapping(address => uint256))", + "numberOfBytes": "32", + "value": "t_mapping(t_address,t_uint256)" + }, + "t_mapping(t_address,t_struct(Claim)6904_storage)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => struct Claim)", + "numberOfBytes": "32", + "value": "t_struct(Claim)6904_storage" + }, + "t_mapping(t_address,t_uint256)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => uint256)", + "numberOfBytes": "32", + "value": "t_uint256" + }, + "t_struct(Claim)6904_storage": { + "encoding": "inplace", + "label": "struct Claim", + "members": [ + { + "astId": 6899, + "contract": "contracts/Distributor.sol:Distributor", + "label": "amount", + "offset": 0, + "slot": "0", + "type": "t_uint208" + }, + { + "astId": 6901, + "contract": "contracts/Distributor.sol:Distributor", + "label": "timestamp", + "offset": 26, + "slot": "0", + "type": "t_uint48" + }, + { + "astId": 6903, + "contract": "contracts/Distributor.sol:Distributor", + "label": "merkleRoot", + "offset": 0, + "slot": "1", + "type": "t_bytes32" + } + ], + "numberOfBytes": "64" + }, + "t_struct(MerkleTree)6897_storage": { + "encoding": "inplace", + "label": "struct MerkleTree", + "members": [ + { + "astId": 6894, + "contract": "contracts/Distributor.sol:Distributor", + "label": "merkleRoot", + "offset": 0, + "slot": "0", + "type": "t_bytes32" + }, + { + "astId": 6896, + "contract": "contracts/Distributor.sol:Distributor", + "label": "ipfsHash", + "offset": 0, + "slot": "1", + "type": "t_bytes32" + } + ], + "numberOfBytes": "64" + }, + "t_uint208": { + "encoding": "inplace", + "label": "uint208", + "numberOfBytes": "26" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + }, + "t_uint48": { + "encoding": "inplace", + "label": "uint48", + "numberOfBytes": "6" + }, + "t_uint8": { + "encoding": "inplace", + "label": "uint8", + "numberOfBytes": "1" + } + } + } +} \ No newline at end of file diff --git a/deployments/coredao/solcInputs/1d17a992f70400315a977c7229541e31.json b/deployments/coredao/solcInputs/1d17a992f70400315a977c7229541e31.json new file mode 100644 index 0000000..3683843 --- /dev/null +++ b/deployments/coredao/solcInputs/1d17a992f70400315a977c7229541e31.json @@ -0,0 +1,132 @@ +{ + "language": "Solidity", + "sources": { + "@openzeppelin/contracts-upgradeable/interfaces/draft-IERC1822Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\n * proxy whose upgrades are fully controlled by the current implementation.\n */\ninterface IERC1822ProxiableUpgradeable {\n /**\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\n * address.\n *\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\n * function revert if invoked through a proxy.\n */\n function proxiableUUID() external view returns (bytes32);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/proxy/beacon/IBeaconUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\n */\ninterface IBeaconUpgradeable {\n /**\n * @dev Must return an address that can be used as a delegate call target.\n *\n * {BeaconProxy} will check that this address is a contract.\n */\n function implementation() external view returns (address);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/proxy/ERC1967/ERC1967UpgradeUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (proxy/ERC1967/ERC1967Upgrade.sol)\n\npragma solidity ^0.8.2;\n\nimport \"../beacon/IBeaconUpgradeable.sol\";\nimport \"../../interfaces/draft-IERC1822Upgradeable.sol\";\nimport \"../../utils/AddressUpgradeable.sol\";\nimport \"../../utils/StorageSlotUpgradeable.sol\";\nimport \"../utils/Initializable.sol\";\n\n/**\n * @dev This abstract contract provides getters and event emitting update functions for\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\n *\n * _Available since v4.1._\n *\n * @custom:oz-upgrades-unsafe-allow delegatecall\n */\nabstract contract ERC1967UpgradeUpgradeable is Initializable {\n function __ERC1967Upgrade_init() internal onlyInitializing {\n }\n\n function __ERC1967Upgrade_init_unchained() internal onlyInitializing {\n }\n // This is the keccak-256 hash of \"eip1967.proxy.rollback\" subtracted by 1\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\n\n /**\n * @dev Storage slot with the address of the current implementation.\n * This is the keccak-256 hash of \"eip1967.proxy.implementation\" subtracted by 1, and is\n * validated in the constructor.\n */\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n\n /**\n * @dev Emitted when the implementation is upgraded.\n */\n event Upgraded(address indexed implementation);\n\n /**\n * @dev Returns the current implementation address.\n */\n function _getImplementation() internal view returns (address) {\n return StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value;\n }\n\n /**\n * @dev Stores a new address in the EIP1967 implementation slot.\n */\n function _setImplementation(address newImplementation) private {\n require(AddressUpgradeable.isContract(newImplementation), \"ERC1967: new implementation is not a contract\");\n StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\n }\n\n /**\n * @dev Perform implementation upgrade\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeTo(address newImplementation) internal {\n _setImplementation(newImplementation);\n emit Upgraded(newImplementation);\n }\n\n /**\n * @dev Perform implementation upgrade with additional setup call.\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeToAndCall(\n address newImplementation,\n bytes memory data,\n bool forceCall\n ) internal {\n _upgradeTo(newImplementation);\n if (data.length > 0 || forceCall) {\n _functionDelegateCall(newImplementation, data);\n }\n }\n\n /**\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeToAndCallUUPS(\n address newImplementation,\n bytes memory data,\n bool forceCall\n ) internal {\n // Upgrades from old implementations will perform a rollback test. This test requires the new\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\n // this special case will break upgrade paths from old UUPS implementation to new ones.\n if (StorageSlotUpgradeable.getBooleanSlot(_ROLLBACK_SLOT).value) {\n _setImplementation(newImplementation);\n } else {\n try IERC1822ProxiableUpgradeable(newImplementation).proxiableUUID() returns (bytes32 slot) {\n require(slot == _IMPLEMENTATION_SLOT, \"ERC1967Upgrade: unsupported proxiableUUID\");\n } catch {\n revert(\"ERC1967Upgrade: new implementation is not UUPS\");\n }\n _upgradeToAndCall(newImplementation, data, forceCall);\n }\n }\n\n /**\n * @dev Storage slot with the admin of the contract.\n * This is the keccak-256 hash of \"eip1967.proxy.admin\" subtracted by 1, and is\n * validated in the constructor.\n */\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\n\n /**\n * @dev Emitted when the admin account has changed.\n */\n event AdminChanged(address previousAdmin, address newAdmin);\n\n /**\n * @dev Returns the current admin.\n */\n function _getAdmin() internal view returns (address) {\n return StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value;\n }\n\n /**\n * @dev Stores a new address in the EIP1967 admin slot.\n */\n function _setAdmin(address newAdmin) private {\n require(newAdmin != address(0), \"ERC1967: new admin is the zero address\");\n StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\n }\n\n /**\n * @dev Changes the admin of the proxy.\n *\n * Emits an {AdminChanged} event.\n */\n function _changeAdmin(address newAdmin) internal {\n emit AdminChanged(_getAdmin(), newAdmin);\n _setAdmin(newAdmin);\n }\n\n /**\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\n */\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\n\n /**\n * @dev Emitted when the beacon is upgraded.\n */\n event BeaconUpgraded(address indexed beacon);\n\n /**\n * @dev Returns the current beacon.\n */\n function _getBeacon() internal view returns (address) {\n return StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value;\n }\n\n /**\n * @dev Stores a new beacon in the EIP1967 beacon slot.\n */\n function _setBeacon(address newBeacon) private {\n require(AddressUpgradeable.isContract(newBeacon), \"ERC1967: new beacon is not a contract\");\n require(\n AddressUpgradeable.isContract(IBeaconUpgradeable(newBeacon).implementation()),\n \"ERC1967: beacon implementation is not a contract\"\n );\n StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value = newBeacon;\n }\n\n /**\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\n *\n * Emits a {BeaconUpgraded} event.\n */\n function _upgradeBeaconToAndCall(\n address newBeacon,\n bytes memory data,\n bool forceCall\n ) internal {\n _setBeacon(newBeacon);\n emit BeaconUpgraded(newBeacon);\n if (data.length > 0 || forceCall) {\n _functionDelegateCall(IBeaconUpgradeable(newBeacon).implementation(), data);\n }\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function _functionDelegateCall(address target, bytes memory data) private returns (bytes memory) {\n require(AddressUpgradeable.isContract(target), \"Address: delegate call to non-contract\");\n\n // solhint-disable-next-line avoid-low-level-calls\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return AddressUpgradeable.verifyCallResult(success, returndata, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.1) (proxy/utils/Initializable.sol)\n\npragma solidity ^0.8.2;\n\nimport \"../../utils/AddressUpgradeable.sol\";\n\n/**\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\n *\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\n * reused. This mechanism prevents re-execution of each \"step\" but allows the creation of new initialization steps in\n * case an upgrade adds a module that needs to be initialized.\n *\n * For example:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * contract MyToken is ERC20Upgradeable {\n * function initialize() initializer public {\n * __ERC20_init(\"MyToken\", \"MTK\");\n * }\n * }\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\n * function initializeV2() reinitializer(2) public {\n * __ERC20Permit_init(\"MyToken\");\n * }\n * }\n * ```\n *\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\n *\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\n *\n * [CAUTION]\n * ====\n * Avoid leaving a contract uninitialized.\n *\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * /// @custom:oz-upgrades-unsafe-allow constructor\n * constructor() {\n * _disableInitializers();\n * }\n * ```\n * ====\n */\nabstract contract Initializable {\n /**\n * @dev Indicates that the contract has been initialized.\n * @custom:oz-retyped-from bool\n */\n uint8 private _initialized;\n\n /**\n * @dev Indicates that the contract is in the process of being initialized.\n */\n bool private _initializing;\n\n /**\n * @dev Triggered when the contract has been initialized or reinitialized.\n */\n event Initialized(uint8 version);\n\n /**\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\n * `onlyInitializing` functions can be used to initialize parent contracts.\n *\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\n * constructor.\n *\n * Emits an {Initialized} event.\n */\n modifier initializer() {\n bool isTopLevelCall = !_initializing;\n require(\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\n \"Initializable: contract is already initialized\"\n );\n _initialized = 1;\n if (isTopLevelCall) {\n _initializing = true;\n }\n _;\n if (isTopLevelCall) {\n _initializing = false;\n emit Initialized(1);\n }\n }\n\n /**\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\n * used to initialize parent contracts.\n *\n * A reinitializer may be used after the original initialization step. This is essential to configure modules that\n * are added through upgrades and that require initialization.\n *\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\n * cannot be nested. If one is invoked in the context of another, execution will revert.\n *\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\n * a contract, executing them in the right order is up to the developer or operator.\n *\n * WARNING: setting the version to 255 will prevent any future reinitialization.\n *\n * Emits an {Initialized} event.\n */\n modifier reinitializer(uint8 version) {\n require(!_initializing && _initialized < version, \"Initializable: contract is already initialized\");\n _initialized = version;\n _initializing = true;\n _;\n _initializing = false;\n emit Initialized(version);\n }\n\n /**\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\n */\n modifier onlyInitializing() {\n require(_initializing, \"Initializable: contract is not initializing\");\n _;\n }\n\n /**\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\n * through proxies.\n *\n * Emits an {Initialized} event the first time it is successfully executed.\n */\n function _disableInitializers() internal virtual {\n require(!_initializing, \"Initializable: contract is initializing\");\n if (_initialized < type(uint8).max) {\n _initialized = type(uint8).max;\n emit Initialized(type(uint8).max);\n }\n }\n\n /**\n * @dev Returns the highest version that has been initialized. See {reinitializer}.\n */\n function _getInitializedVersion() internal view returns (uint8) {\n return _initialized;\n }\n\n /**\n * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.\n */\n function _isInitializing() internal view returns (bool) {\n return _initializing;\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (proxy/utils/UUPSUpgradeable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../interfaces/draft-IERC1822Upgradeable.sol\";\nimport \"../ERC1967/ERC1967UpgradeUpgradeable.sol\";\nimport \"./Initializable.sol\";\n\n/**\n * @dev An upgradeability mechanism designed for UUPS proxies. The functions included here can perform an upgrade of an\n * {ERC1967Proxy}, when this contract is set as the implementation behind such a proxy.\n *\n * A security mechanism ensures that an upgrade does not turn off upgradeability accidentally, although this risk is\n * reinstated if the upgrade retains upgradeability but removes the security mechanism, e.g. by replacing\n * `UUPSUpgradeable` with a custom implementation of upgrades.\n *\n * The {_authorizeUpgrade} function must be overridden to include access restriction to the upgrade mechanism.\n *\n * _Available since v4.1._\n */\nabstract contract UUPSUpgradeable is Initializable, IERC1822ProxiableUpgradeable, ERC1967UpgradeUpgradeable {\n function __UUPSUpgradeable_init() internal onlyInitializing {\n }\n\n function __UUPSUpgradeable_init_unchained() internal onlyInitializing {\n }\n /// @custom:oz-upgrades-unsafe-allow state-variable-immutable state-variable-assignment\n address private immutable __self = address(this);\n\n /**\n * @dev Check that the execution is being performed through a delegatecall call and that the execution context is\n * a proxy contract with an implementation (as defined in ERC1967) pointing to self. This should only be the case\n * for UUPS and transparent proxies that are using the current contract as their implementation. Execution of a\n * function through ERC1167 minimal proxies (clones) would not normally pass this test, but is not guaranteed to\n * fail.\n */\n modifier onlyProxy() {\n require(address(this) != __self, \"Function must be called through delegatecall\");\n require(_getImplementation() == __self, \"Function must be called through active proxy\");\n _;\n }\n\n /**\n * @dev Check that the execution is not being performed through a delegate call. This allows a function to be\n * callable on the implementing contract but not through proxies.\n */\n modifier notDelegated() {\n require(address(this) == __self, \"UUPSUpgradeable: must not be called through delegatecall\");\n _;\n }\n\n /**\n * @dev Implementation of the ERC1822 {proxiableUUID} function. This returns the storage slot used by the\n * implementation. It is used to validate the implementation's compatibility when performing an upgrade.\n *\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\n * function revert if invoked through a proxy. This is guaranteed by the `notDelegated` modifier.\n */\n function proxiableUUID() external view virtual override notDelegated returns (bytes32) {\n return _IMPLEMENTATION_SLOT;\n }\n\n /**\n * @dev Upgrade the implementation of the proxy to `newImplementation`.\n *\n * Calls {_authorizeUpgrade}.\n *\n * Emits an {Upgraded} event.\n */\n function upgradeTo(address newImplementation) external virtual onlyProxy {\n _authorizeUpgrade(newImplementation);\n _upgradeToAndCallUUPS(newImplementation, new bytes(0), false);\n }\n\n /**\n * @dev Upgrade the implementation of the proxy to `newImplementation`, and subsequently execute the function call\n * encoded in `data`.\n *\n * Calls {_authorizeUpgrade}.\n *\n * Emits an {Upgraded} event.\n */\n function upgradeToAndCall(address newImplementation, bytes memory data) external payable virtual onlyProxy {\n _authorizeUpgrade(newImplementation);\n _upgradeToAndCallUUPS(newImplementation, data, true);\n }\n\n /**\n * @dev Function that should revert when `msg.sender` is not authorized to upgrade the contract. Called by\n * {upgradeTo} and {upgradeToAndCall}.\n *\n * Normally, this function will use an xref:access.adoc[access control] modifier such as {Ownable-onlyOwner}.\n *\n * ```solidity\n * function _authorizeUpgrade(address) internal override onlyOwner {}\n * ```\n */\n function _authorizeUpgrade(address newImplementation) internal virtual;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (security/ReentrancyGuard.sol)\n\npragma solidity ^0.8.0;\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Contract module that helps prevent reentrant calls to a function.\n *\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\n * available, which can be applied to functions to make sure there are no nested\n * (reentrant) calls to them.\n *\n * Note that because there is a single `nonReentrant` guard, functions marked as\n * `nonReentrant` may not call one another. This can be worked around by making\n * those functions `private`, and then adding `external` `nonReentrant` entry\n * points to them.\n *\n * TIP: If you would like to learn more about reentrancy and alternative ways\n * to protect against it, check out our blog post\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\n */\nabstract contract ReentrancyGuardUpgradeable is Initializable {\n // Booleans are more expensive than uint256 or any type that takes up a full\n // word because each write operation emits an extra SLOAD to first read the\n // slot's contents, replace the bits taken up by the boolean, and then write\n // back. This is the compiler's defense against contract upgrades and\n // pointer aliasing, and it cannot be disabled.\n\n // The values being non-zero value makes deployment a bit more expensive,\n // but in exchange the refund on every call to nonReentrant will be lower in\n // amount. Since refunds are capped to a percentage of the total\n // transaction's gas, it is best to keep them low in cases like this one, to\n // increase the likelihood of the full refund coming into effect.\n uint256 private constant _NOT_ENTERED = 1;\n uint256 private constant _ENTERED = 2;\n\n uint256 private _status;\n\n function __ReentrancyGuard_init() internal onlyInitializing {\n __ReentrancyGuard_init_unchained();\n }\n\n function __ReentrancyGuard_init_unchained() internal onlyInitializing {\n _status = _NOT_ENTERED;\n }\n\n /**\n * @dev Prevents a contract from calling itself, directly or indirectly.\n * Calling a `nonReentrant` function from another `nonReentrant`\n * function is not supported. It is possible to prevent this from happening\n * by making the `nonReentrant` function external, and making it call a\n * `private` function that does the actual work.\n */\n modifier nonReentrant() {\n _nonReentrantBefore();\n _;\n _nonReentrantAfter();\n }\n\n function _nonReentrantBefore() private {\n // On the first call to nonReentrant, _status will be _NOT_ENTERED\n require(_status != _ENTERED, \"ReentrancyGuard: reentrant call\");\n\n // Any calls to nonReentrant after this point will fail\n _status = _ENTERED;\n }\n\n function _nonReentrantAfter() private {\n // By storing the original value once again, a refund is triggered (see\n // https://eips.ethereum.org/EIPS/eip-2200)\n _status = _NOT_ENTERED;\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[49] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20Upgradeable {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary AddressUpgradeable {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/StorageSlotUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/StorageSlot.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Library for reading and writing primitive types to specific storage slots.\n *\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\n * This library helps with reading and writing to such slots without the need for inline assembly.\n *\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\n *\n * Example usage to set ERC1967 implementation slot:\n * ```\n * contract ERC1967 {\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n *\n * function _getImplementation() internal view returns (address) {\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\n * }\n *\n * function _setImplementation(address newImplementation) internal {\n * require(Address.isContract(newImplementation), \"ERC1967: new implementation is not a contract\");\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\n * }\n * }\n * ```\n *\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\n */\nlibrary StorageSlotUpgradeable {\n struct AddressSlot {\n address value;\n }\n\n struct BooleanSlot {\n bool value;\n }\n\n struct Bytes32Slot {\n bytes32 value;\n }\n\n struct Uint256Slot {\n uint256 value;\n }\n\n /**\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\n */\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\n */\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\n */\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\n */\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n */\ninterface IERC20Permit {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also apply here.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `deadline` must be a timestamp in the future.\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\n * over the EIP712-formatted function arguments.\n * - the signature must use ``owner``'s current nonce (see {nonces}).\n *\n * For more information on the signature format, see the\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\n * section].\n */\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n\n /**\n * @dev Returns the current nonce for `owner`. This value must be\n * included whenever a signature is generated for {permit}.\n *\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\n * prevents a signature from being used multiple times.\n */\n function nonces(address owner) external view returns (uint256);\n\n /**\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\n */\n // solhint-disable-next-line func-name-mixedcase\n function DOMAIN_SEPARATOR() external view returns (bytes32);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20Metadata is IERC20 {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/IERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\nimport \"../extensions/draft-IERC20Permit.sol\";\nimport \"../../../utils/Address.sol\";\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n using Address for address;\n\n function safeTransfer(\n IERC20 token,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n function safeTransferFrom(\n IERC20 token,\n address from,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\n }\n\n /**\n * @dev Deprecated. This function has issues similar to the ones found in\n * {IERC20-approve}, and its usage is discouraged.\n *\n * Whenever possible, use {safeIncreaseAllowance} and\n * {safeDecreaseAllowance} instead.\n */\n function safeApprove(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n // safeApprove should only be called when setting an initial allowance,\n // or when resetting it to zero. To increase and decrease it, use\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\n require(\n (value == 0) || (token.allowance(address(this), spender) == 0),\n \"SafeERC20: approve from non-zero to non-zero allowance\"\n );\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\n }\n\n function safeIncreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n uint256 newAllowance = token.allowance(address(this), spender) + value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n\n function safeDecreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n unchecked {\n uint256 oldAllowance = token.allowance(address(this), spender);\n require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\n uint256 newAllowance = oldAllowance - value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n }\n\n function safePermit(\n IERC20Permit token,\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal {\n uint256 nonceBefore = token.nonces(owner);\n token.permit(owner, spender, value, deadline, v, r, s);\n uint256 nonceAfter = token.nonces(owner);\n require(nonceAfter == nonceBefore + 1, \"SafeERC20: permit did not succeed\");\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data, \"SafeERC20: low-level call failed\");\n if (returndata.length > 0) {\n // Return data is optional\n require(abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Address.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/cryptography/ECDSA.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/ECDSA.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../Strings.sol\";\n\n/**\n * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.\n *\n * These functions can be used to verify that a message was signed by the holder\n * of the private keys of a given address.\n */\nlibrary ECDSA {\n enum RecoverError {\n NoError,\n InvalidSignature,\n InvalidSignatureLength,\n InvalidSignatureS,\n InvalidSignatureV // Deprecated in v4.8\n }\n\n function _throwError(RecoverError error) private pure {\n if (error == RecoverError.NoError) {\n return; // no error: do nothing\n } else if (error == RecoverError.InvalidSignature) {\n revert(\"ECDSA: invalid signature\");\n } else if (error == RecoverError.InvalidSignatureLength) {\n revert(\"ECDSA: invalid signature length\");\n } else if (error == RecoverError.InvalidSignatureS) {\n revert(\"ECDSA: invalid signature 's' value\");\n }\n }\n\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with\n * `signature` or error string. This address can then be used for verification purposes.\n *\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {toEthSignedMessageHash} on it.\n *\n * Documentation for signature generation:\n * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]\n * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]\n *\n * _Available since v4.3._\n */\n function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {\n if (signature.length == 65) {\n bytes32 r;\n bytes32 s;\n uint8 v;\n // ecrecover takes the signature parameters, and the only way to get them\n // currently is to use assembly.\n /// @solidity memory-safe-assembly\n assembly {\n r := mload(add(signature, 0x20))\n s := mload(add(signature, 0x40))\n v := byte(0, mload(add(signature, 0x60)))\n }\n return tryRecover(hash, v, r, s);\n } else {\n return (address(0), RecoverError.InvalidSignatureLength);\n }\n }\n\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with\n * `signature`. This address can then be used for verification purposes.\n *\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {toEthSignedMessageHash} on it.\n */\n function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, signature);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.\n *\n * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]\n *\n * _Available since v4.3._\n */\n function tryRecover(\n bytes32 hash,\n bytes32 r,\n bytes32 vs\n ) internal pure returns (address, RecoverError) {\n bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);\n uint8 v = uint8((uint256(vs) >> 255) + 27);\n return tryRecover(hash, v, r, s);\n }\n\n /**\n * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.\n *\n * _Available since v4.2._\n */\n function recover(\n bytes32 hash,\n bytes32 r,\n bytes32 vs\n ) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, r, vs);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Overload of {ECDSA-tryRecover} that receives the `v`,\n * `r` and `s` signature fields separately.\n *\n * _Available since v4.3._\n */\n function tryRecover(\n bytes32 hash,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal pure returns (address, RecoverError) {\n // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature\n // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines\n // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most\n // signatures from current libraries generate a unique signature with an s-value in the lower half order.\n //\n // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value\n // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or\n // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept\n // these malleable signatures as well.\n if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {\n return (address(0), RecoverError.InvalidSignatureS);\n }\n\n // If the signature is valid (and not malleable), return the signer address\n address signer = ecrecover(hash, v, r, s);\n if (signer == address(0)) {\n return (address(0), RecoverError.InvalidSignature);\n }\n\n return (signer, RecoverError.NoError);\n }\n\n /**\n * @dev Overload of {ECDSA-recover} that receives the `v`,\n * `r` and `s` signature fields separately.\n */\n function recover(\n bytes32 hash,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, v, r, s);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Returns an Ethereum Signed Message, created from a `hash`. This\n * produces hash corresponding to the one signed with the\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n * JSON-RPC method as part of EIP-191.\n *\n * See {recover}.\n */\n function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {\n // 32 is the length in bytes of hash,\n // enforced by the type signature above\n return keccak256(abi.encodePacked(\"\\x19Ethereum Signed Message:\\n32\", hash));\n }\n\n /**\n * @dev Returns an Ethereum Signed Message, created from `s`. This\n * produces hash corresponding to the one signed with the\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n * JSON-RPC method as part of EIP-191.\n *\n * See {recover}.\n */\n function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(\"\\x19Ethereum Signed Message:\\n\", Strings.toString(s.length), s));\n }\n\n /**\n * @dev Returns an Ethereum Signed Typed Data, created from a\n * `domainSeparator` and a `structHash`. This produces hash corresponding\n * to the one signed with the\n * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]\n * JSON-RPC method as part of EIP-712.\n *\n * See {recover}.\n */\n function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(\"\\x19\\x01\", domainSeparator, structHash));\n }\n}\n" + }, + "@openzeppelin/contracts/utils/math/Math.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary Math {\n enum Rounding {\n Down, // Toward negative infinity\n Up, // Toward infinity\n Zero // Toward zero\n }\n\n /**\n * @dev Returns the largest of two numbers.\n */\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two numbers.\n */\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two numbers. The result is rounded towards\n * zero.\n */\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b) / 2 can overflow.\n return (a & b) + (a ^ b) / 2;\n }\n\n /**\n * @dev Returns the ceiling of the division of two numbers.\n *\n * This differs from standard division with `/` in that it rounds up instead\n * of rounding down.\n */\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b - 1) / b can overflow on addition, so we distribute.\n return a == 0 ? 0 : (a - 1) / b + 1;\n }\n\n /**\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\n * with further edits by Uniswap Labs also under MIT license.\n */\n function mulDiv(\n uint256 x,\n uint256 y,\n uint256 denominator\n ) internal pure returns (uint256 result) {\n unchecked {\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\n // variables such that product = prod1 * 2^256 + prod0.\n uint256 prod0; // Least significant 256 bits of the product\n uint256 prod1; // Most significant 256 bits of the product\n assembly {\n let mm := mulmod(x, y, not(0))\n prod0 := mul(x, y)\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n }\n\n // Handle non-overflow cases, 256 by 256 division.\n if (prod1 == 0) {\n return prod0 / denominator;\n }\n\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\n require(denominator > prod1);\n\n ///////////////////////////////////////////////\n // 512 by 256 division.\n ///////////////////////////////////////////////\n\n // Make division exact by subtracting the remainder from [prod1 prod0].\n uint256 remainder;\n assembly {\n // Compute remainder using mulmod.\n remainder := mulmod(x, y, denominator)\n\n // Subtract 256 bit number from 512 bit number.\n prod1 := sub(prod1, gt(remainder, prod0))\n prod0 := sub(prod0, remainder)\n }\n\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\n // See https://cs.stackexchange.com/q/138556/92363.\n\n // Does not overflow because the denominator cannot be zero at this stage in the function.\n uint256 twos = denominator & (~denominator + 1);\n assembly {\n // Divide denominator by twos.\n denominator := div(denominator, twos)\n\n // Divide [prod1 prod0] by twos.\n prod0 := div(prod0, twos)\n\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\n twos := add(div(sub(0, twos), twos), 1)\n }\n\n // Shift in bits from prod1 into prod0.\n prod0 |= prod1 * twos;\n\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\n // four bits. That is, denominator * inv = 1 mod 2^4.\n uint256 inverse = (3 * denominator) ^ 2;\n\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\n // in modular arithmetic, doubling the correct bits in each step.\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\n\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\n // is no longer required.\n result = prod0 * inverse;\n return result;\n }\n }\n\n /**\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\n */\n function mulDiv(\n uint256 x,\n uint256 y,\n uint256 denominator,\n Rounding rounding\n ) internal pure returns (uint256) {\n uint256 result = mulDiv(x, y, denominator);\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\n result += 1;\n }\n return result;\n }\n\n /**\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\n *\n * Inspired by Henry S. Warren, Jr.'s \"Hacker's Delight\" (Chapter 11).\n */\n function sqrt(uint256 a) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\n //\n // We know that the \"msb\" (most significant bit) of our target number `a` is a power of 2 such that we have\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\n //\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\n // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\n // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\n //\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\n uint256 result = 1 << (log2(a) >> 1);\n\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\n // into the expected uint128 result.\n unchecked {\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n return min(result, a / result);\n }\n }\n\n /**\n * @notice Calculates sqrt(a), following the selected rounding direction.\n */\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = sqrt(a);\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 2, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 128;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 64;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 32;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 16;\n }\n if (value >> 8 > 0) {\n value >>= 8;\n result += 8;\n }\n if (value >> 4 > 0) {\n value >>= 4;\n result += 4;\n }\n if (value >> 2 > 0) {\n value >>= 2;\n result += 2;\n }\n if (value >> 1 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log2(value);\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 10, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >= 10**64) {\n value /= 10**64;\n result += 64;\n }\n if (value >= 10**32) {\n value /= 10**32;\n result += 32;\n }\n if (value >= 10**16) {\n value /= 10**16;\n result += 16;\n }\n if (value >= 10**8) {\n value /= 10**8;\n result += 8;\n }\n if (value >= 10**4) {\n value /= 10**4;\n result += 4;\n }\n if (value >= 10**2) {\n value /= 10**2;\n result += 2;\n }\n if (value >= 10**1) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log10(value);\n return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 256, rounded down, of a positive value.\n * Returns 0 if given 0.\n *\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\n */\n function log256(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 16;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 8;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 4;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 2;\n }\n if (value >> 8 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log256(value);\n return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/math/SafeCast.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SafeCast.sol)\n// This file was procedurally generated from scripts/generate/templates/SafeCast.js.\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Wrappers over Solidity's uintXX/intXX casting operators with added overflow\n * checks.\n *\n * Downcasting from uint256/int256 in Solidity does not revert on overflow. This can\n * easily result in undesired exploitation or bugs, since developers usually\n * assume that overflows raise errors. `SafeCast` restores this intuition by\n * reverting the transaction when such an operation overflows.\n *\n * Using this library instead of the unchecked operations eliminates an entire\n * class of bugs, so it's recommended to use it always.\n *\n * Can be combined with {SafeMath} and {SignedSafeMath} to extend it to smaller types, by performing\n * all math on `uint256` and `int256` and then downcasting.\n */\nlibrary SafeCast {\n /**\n * @dev Returns the downcasted uint248 from uint256, reverting on\n * overflow (when the input is greater than largest uint248).\n *\n * Counterpart to Solidity's `uint248` operator.\n *\n * Requirements:\n *\n * - input must fit into 248 bits\n *\n * _Available since v4.7._\n */\n function toUint248(uint256 value) internal pure returns (uint248) {\n require(value <= type(uint248).max, \"SafeCast: value doesn't fit in 248 bits\");\n return uint248(value);\n }\n\n /**\n * @dev Returns the downcasted uint240 from uint256, reverting on\n * overflow (when the input is greater than largest uint240).\n *\n * Counterpart to Solidity's `uint240` operator.\n *\n * Requirements:\n *\n * - input must fit into 240 bits\n *\n * _Available since v4.7._\n */\n function toUint240(uint256 value) internal pure returns (uint240) {\n require(value <= type(uint240).max, \"SafeCast: value doesn't fit in 240 bits\");\n return uint240(value);\n }\n\n /**\n * @dev Returns the downcasted uint232 from uint256, reverting on\n * overflow (when the input is greater than largest uint232).\n *\n * Counterpart to Solidity's `uint232` operator.\n *\n * Requirements:\n *\n * - input must fit into 232 bits\n *\n * _Available since v4.7._\n */\n function toUint232(uint256 value) internal pure returns (uint232) {\n require(value <= type(uint232).max, \"SafeCast: value doesn't fit in 232 bits\");\n return uint232(value);\n }\n\n /**\n * @dev Returns the downcasted uint224 from uint256, reverting on\n * overflow (when the input is greater than largest uint224).\n *\n * Counterpart to Solidity's `uint224` operator.\n *\n * Requirements:\n *\n * - input must fit into 224 bits\n *\n * _Available since v4.2._\n */\n function toUint224(uint256 value) internal pure returns (uint224) {\n require(value <= type(uint224).max, \"SafeCast: value doesn't fit in 224 bits\");\n return uint224(value);\n }\n\n /**\n * @dev Returns the downcasted uint216 from uint256, reverting on\n * overflow (when the input is greater than largest uint216).\n *\n * Counterpart to Solidity's `uint216` operator.\n *\n * Requirements:\n *\n * - input must fit into 216 bits\n *\n * _Available since v4.7._\n */\n function toUint216(uint256 value) internal pure returns (uint216) {\n require(value <= type(uint216).max, \"SafeCast: value doesn't fit in 216 bits\");\n return uint216(value);\n }\n\n /**\n * @dev Returns the downcasted uint208 from uint256, reverting on\n * overflow (when the input is greater than largest uint208).\n *\n * Counterpart to Solidity's `uint208` operator.\n *\n * Requirements:\n *\n * - input must fit into 208 bits\n *\n * _Available since v4.7._\n */\n function toUint208(uint256 value) internal pure returns (uint208) {\n require(value <= type(uint208).max, \"SafeCast: value doesn't fit in 208 bits\");\n return uint208(value);\n }\n\n /**\n * @dev Returns the downcasted uint200 from uint256, reverting on\n * overflow (when the input is greater than largest uint200).\n *\n * Counterpart to Solidity's `uint200` operator.\n *\n * Requirements:\n *\n * - input must fit into 200 bits\n *\n * _Available since v4.7._\n */\n function toUint200(uint256 value) internal pure returns (uint200) {\n require(value <= type(uint200).max, \"SafeCast: value doesn't fit in 200 bits\");\n return uint200(value);\n }\n\n /**\n * @dev Returns the downcasted uint192 from uint256, reverting on\n * overflow (when the input is greater than largest uint192).\n *\n * Counterpart to Solidity's `uint192` operator.\n *\n * Requirements:\n *\n * - input must fit into 192 bits\n *\n * _Available since v4.7._\n */\n function toUint192(uint256 value) internal pure returns (uint192) {\n require(value <= type(uint192).max, \"SafeCast: value doesn't fit in 192 bits\");\n return uint192(value);\n }\n\n /**\n * @dev Returns the downcasted uint184 from uint256, reverting on\n * overflow (when the input is greater than largest uint184).\n *\n * Counterpart to Solidity's `uint184` operator.\n *\n * Requirements:\n *\n * - input must fit into 184 bits\n *\n * _Available since v4.7._\n */\n function toUint184(uint256 value) internal pure returns (uint184) {\n require(value <= type(uint184).max, \"SafeCast: value doesn't fit in 184 bits\");\n return uint184(value);\n }\n\n /**\n * @dev Returns the downcasted uint176 from uint256, reverting on\n * overflow (when the input is greater than largest uint176).\n *\n * Counterpart to Solidity's `uint176` operator.\n *\n * Requirements:\n *\n * - input must fit into 176 bits\n *\n * _Available since v4.7._\n */\n function toUint176(uint256 value) internal pure returns (uint176) {\n require(value <= type(uint176).max, \"SafeCast: value doesn't fit in 176 bits\");\n return uint176(value);\n }\n\n /**\n * @dev Returns the downcasted uint168 from uint256, reverting on\n * overflow (when the input is greater than largest uint168).\n *\n * Counterpart to Solidity's `uint168` operator.\n *\n * Requirements:\n *\n * - input must fit into 168 bits\n *\n * _Available since v4.7._\n */\n function toUint168(uint256 value) internal pure returns (uint168) {\n require(value <= type(uint168).max, \"SafeCast: value doesn't fit in 168 bits\");\n return uint168(value);\n }\n\n /**\n * @dev Returns the downcasted uint160 from uint256, reverting on\n * overflow (when the input is greater than largest uint160).\n *\n * Counterpart to Solidity's `uint160` operator.\n *\n * Requirements:\n *\n * - input must fit into 160 bits\n *\n * _Available since v4.7._\n */\n function toUint160(uint256 value) internal pure returns (uint160) {\n require(value <= type(uint160).max, \"SafeCast: value doesn't fit in 160 bits\");\n return uint160(value);\n }\n\n /**\n * @dev Returns the downcasted uint152 from uint256, reverting on\n * overflow (when the input is greater than largest uint152).\n *\n * Counterpart to Solidity's `uint152` operator.\n *\n * Requirements:\n *\n * - input must fit into 152 bits\n *\n * _Available since v4.7._\n */\n function toUint152(uint256 value) internal pure returns (uint152) {\n require(value <= type(uint152).max, \"SafeCast: value doesn't fit in 152 bits\");\n return uint152(value);\n }\n\n /**\n * @dev Returns the downcasted uint144 from uint256, reverting on\n * overflow (when the input is greater than largest uint144).\n *\n * Counterpart to Solidity's `uint144` operator.\n *\n * Requirements:\n *\n * - input must fit into 144 bits\n *\n * _Available since v4.7._\n */\n function toUint144(uint256 value) internal pure returns (uint144) {\n require(value <= type(uint144).max, \"SafeCast: value doesn't fit in 144 bits\");\n return uint144(value);\n }\n\n /**\n * @dev Returns the downcasted uint136 from uint256, reverting on\n * overflow (when the input is greater than largest uint136).\n *\n * Counterpart to Solidity's `uint136` operator.\n *\n * Requirements:\n *\n * - input must fit into 136 bits\n *\n * _Available since v4.7._\n */\n function toUint136(uint256 value) internal pure returns (uint136) {\n require(value <= type(uint136).max, \"SafeCast: value doesn't fit in 136 bits\");\n return uint136(value);\n }\n\n /**\n * @dev Returns the downcasted uint128 from uint256, reverting on\n * overflow (when the input is greater than largest uint128).\n *\n * Counterpart to Solidity's `uint128` operator.\n *\n * Requirements:\n *\n * - input must fit into 128 bits\n *\n * _Available since v2.5._\n */\n function toUint128(uint256 value) internal pure returns (uint128) {\n require(value <= type(uint128).max, \"SafeCast: value doesn't fit in 128 bits\");\n return uint128(value);\n }\n\n /**\n * @dev Returns the downcasted uint120 from uint256, reverting on\n * overflow (when the input is greater than largest uint120).\n *\n * Counterpart to Solidity's `uint120` operator.\n *\n * Requirements:\n *\n * - input must fit into 120 bits\n *\n * _Available since v4.7._\n */\n function toUint120(uint256 value) internal pure returns (uint120) {\n require(value <= type(uint120).max, \"SafeCast: value doesn't fit in 120 bits\");\n return uint120(value);\n }\n\n /**\n * @dev Returns the downcasted uint112 from uint256, reverting on\n * overflow (when the input is greater than largest uint112).\n *\n * Counterpart to Solidity's `uint112` operator.\n *\n * Requirements:\n *\n * - input must fit into 112 bits\n *\n * _Available since v4.7._\n */\n function toUint112(uint256 value) internal pure returns (uint112) {\n require(value <= type(uint112).max, \"SafeCast: value doesn't fit in 112 bits\");\n return uint112(value);\n }\n\n /**\n * @dev Returns the downcasted uint104 from uint256, reverting on\n * overflow (when the input is greater than largest uint104).\n *\n * Counterpart to Solidity's `uint104` operator.\n *\n * Requirements:\n *\n * - input must fit into 104 bits\n *\n * _Available since v4.7._\n */\n function toUint104(uint256 value) internal pure returns (uint104) {\n require(value <= type(uint104).max, \"SafeCast: value doesn't fit in 104 bits\");\n return uint104(value);\n }\n\n /**\n * @dev Returns the downcasted uint96 from uint256, reverting on\n * overflow (when the input is greater than largest uint96).\n *\n * Counterpart to Solidity's `uint96` operator.\n *\n * Requirements:\n *\n * - input must fit into 96 bits\n *\n * _Available since v4.2._\n */\n function toUint96(uint256 value) internal pure returns (uint96) {\n require(value <= type(uint96).max, \"SafeCast: value doesn't fit in 96 bits\");\n return uint96(value);\n }\n\n /**\n * @dev Returns the downcasted uint88 from uint256, reverting on\n * overflow (when the input is greater than largest uint88).\n *\n * Counterpart to Solidity's `uint88` operator.\n *\n * Requirements:\n *\n * - input must fit into 88 bits\n *\n * _Available since v4.7._\n */\n function toUint88(uint256 value) internal pure returns (uint88) {\n require(value <= type(uint88).max, \"SafeCast: value doesn't fit in 88 bits\");\n return uint88(value);\n }\n\n /**\n * @dev Returns the downcasted uint80 from uint256, reverting on\n * overflow (when the input is greater than largest uint80).\n *\n * Counterpart to Solidity's `uint80` operator.\n *\n * Requirements:\n *\n * - input must fit into 80 bits\n *\n * _Available since v4.7._\n */\n function toUint80(uint256 value) internal pure returns (uint80) {\n require(value <= type(uint80).max, \"SafeCast: value doesn't fit in 80 bits\");\n return uint80(value);\n }\n\n /**\n * @dev Returns the downcasted uint72 from uint256, reverting on\n * overflow (when the input is greater than largest uint72).\n *\n * Counterpart to Solidity's `uint72` operator.\n *\n * Requirements:\n *\n * - input must fit into 72 bits\n *\n * _Available since v4.7._\n */\n function toUint72(uint256 value) internal pure returns (uint72) {\n require(value <= type(uint72).max, \"SafeCast: value doesn't fit in 72 bits\");\n return uint72(value);\n }\n\n /**\n * @dev Returns the downcasted uint64 from uint256, reverting on\n * overflow (when the input is greater than largest uint64).\n *\n * Counterpart to Solidity's `uint64` operator.\n *\n * Requirements:\n *\n * - input must fit into 64 bits\n *\n * _Available since v2.5._\n */\n function toUint64(uint256 value) internal pure returns (uint64) {\n require(value <= type(uint64).max, \"SafeCast: value doesn't fit in 64 bits\");\n return uint64(value);\n }\n\n /**\n * @dev Returns the downcasted uint56 from uint256, reverting on\n * overflow (when the input is greater than largest uint56).\n *\n * Counterpart to Solidity's `uint56` operator.\n *\n * Requirements:\n *\n * - input must fit into 56 bits\n *\n * _Available since v4.7._\n */\n function toUint56(uint256 value) internal pure returns (uint56) {\n require(value <= type(uint56).max, \"SafeCast: value doesn't fit in 56 bits\");\n return uint56(value);\n }\n\n /**\n * @dev Returns the downcasted uint48 from uint256, reverting on\n * overflow (when the input is greater than largest uint48).\n *\n * Counterpart to Solidity's `uint48` operator.\n *\n * Requirements:\n *\n * - input must fit into 48 bits\n *\n * _Available since v4.7._\n */\n function toUint48(uint256 value) internal pure returns (uint48) {\n require(value <= type(uint48).max, \"SafeCast: value doesn't fit in 48 bits\");\n return uint48(value);\n }\n\n /**\n * @dev Returns the downcasted uint40 from uint256, reverting on\n * overflow (when the input is greater than largest uint40).\n *\n * Counterpart to Solidity's `uint40` operator.\n *\n * Requirements:\n *\n * - input must fit into 40 bits\n *\n * _Available since v4.7._\n */\n function toUint40(uint256 value) internal pure returns (uint40) {\n require(value <= type(uint40).max, \"SafeCast: value doesn't fit in 40 bits\");\n return uint40(value);\n }\n\n /**\n * @dev Returns the downcasted uint32 from uint256, reverting on\n * overflow (when the input is greater than largest uint32).\n *\n * Counterpart to Solidity's `uint32` operator.\n *\n * Requirements:\n *\n * - input must fit into 32 bits\n *\n * _Available since v2.5._\n */\n function toUint32(uint256 value) internal pure returns (uint32) {\n require(value <= type(uint32).max, \"SafeCast: value doesn't fit in 32 bits\");\n return uint32(value);\n }\n\n /**\n * @dev Returns the downcasted uint24 from uint256, reverting on\n * overflow (when the input is greater than largest uint24).\n *\n * Counterpart to Solidity's `uint24` operator.\n *\n * Requirements:\n *\n * - input must fit into 24 bits\n *\n * _Available since v4.7._\n */\n function toUint24(uint256 value) internal pure returns (uint24) {\n require(value <= type(uint24).max, \"SafeCast: value doesn't fit in 24 bits\");\n return uint24(value);\n }\n\n /**\n * @dev Returns the downcasted uint16 from uint256, reverting on\n * overflow (when the input is greater than largest uint16).\n *\n * Counterpart to Solidity's `uint16` operator.\n *\n * Requirements:\n *\n * - input must fit into 16 bits\n *\n * _Available since v2.5._\n */\n function toUint16(uint256 value) internal pure returns (uint16) {\n require(value <= type(uint16).max, \"SafeCast: value doesn't fit in 16 bits\");\n return uint16(value);\n }\n\n /**\n * @dev Returns the downcasted uint8 from uint256, reverting on\n * overflow (when the input is greater than largest uint8).\n *\n * Counterpart to Solidity's `uint8` operator.\n *\n * Requirements:\n *\n * - input must fit into 8 bits\n *\n * _Available since v2.5._\n */\n function toUint8(uint256 value) internal pure returns (uint8) {\n require(value <= type(uint8).max, \"SafeCast: value doesn't fit in 8 bits\");\n return uint8(value);\n }\n\n /**\n * @dev Converts a signed int256 into an unsigned uint256.\n *\n * Requirements:\n *\n * - input must be greater than or equal to 0.\n *\n * _Available since v3.0._\n */\n function toUint256(int256 value) internal pure returns (uint256) {\n require(value >= 0, \"SafeCast: value must be positive\");\n return uint256(value);\n }\n\n /**\n * @dev Returns the downcasted int248 from int256, reverting on\n * overflow (when the input is less than smallest int248 or\n * greater than largest int248).\n *\n * Counterpart to Solidity's `int248` operator.\n *\n * Requirements:\n *\n * - input must fit into 248 bits\n *\n * _Available since v4.7._\n */\n function toInt248(int256 value) internal pure returns (int248 downcasted) {\n downcasted = int248(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 248 bits\");\n }\n\n /**\n * @dev Returns the downcasted int240 from int256, reverting on\n * overflow (when the input is less than smallest int240 or\n * greater than largest int240).\n *\n * Counterpart to Solidity's `int240` operator.\n *\n * Requirements:\n *\n * - input must fit into 240 bits\n *\n * _Available since v4.7._\n */\n function toInt240(int256 value) internal pure returns (int240 downcasted) {\n downcasted = int240(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 240 bits\");\n }\n\n /**\n * @dev Returns the downcasted int232 from int256, reverting on\n * overflow (when the input is less than smallest int232 or\n * greater than largest int232).\n *\n * Counterpart to Solidity's `int232` operator.\n *\n * Requirements:\n *\n * - input must fit into 232 bits\n *\n * _Available since v4.7._\n */\n function toInt232(int256 value) internal pure returns (int232 downcasted) {\n downcasted = int232(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 232 bits\");\n }\n\n /**\n * @dev Returns the downcasted int224 from int256, reverting on\n * overflow (when the input is less than smallest int224 or\n * greater than largest int224).\n *\n * Counterpart to Solidity's `int224` operator.\n *\n * Requirements:\n *\n * - input must fit into 224 bits\n *\n * _Available since v4.7._\n */\n function toInt224(int256 value) internal pure returns (int224 downcasted) {\n downcasted = int224(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 224 bits\");\n }\n\n /**\n * @dev Returns the downcasted int216 from int256, reverting on\n * overflow (when the input is less than smallest int216 or\n * greater than largest int216).\n *\n * Counterpart to Solidity's `int216` operator.\n *\n * Requirements:\n *\n * - input must fit into 216 bits\n *\n * _Available since v4.7._\n */\n function toInt216(int256 value) internal pure returns (int216 downcasted) {\n downcasted = int216(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 216 bits\");\n }\n\n /**\n * @dev Returns the downcasted int208 from int256, reverting on\n * overflow (when the input is less than smallest int208 or\n * greater than largest int208).\n *\n * Counterpart to Solidity's `int208` operator.\n *\n * Requirements:\n *\n * - input must fit into 208 bits\n *\n * _Available since v4.7._\n */\n function toInt208(int256 value) internal pure returns (int208 downcasted) {\n downcasted = int208(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 208 bits\");\n }\n\n /**\n * @dev Returns the downcasted int200 from int256, reverting on\n * overflow (when the input is less than smallest int200 or\n * greater than largest int200).\n *\n * Counterpart to Solidity's `int200` operator.\n *\n * Requirements:\n *\n * - input must fit into 200 bits\n *\n * _Available since v4.7._\n */\n function toInt200(int256 value) internal pure returns (int200 downcasted) {\n downcasted = int200(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 200 bits\");\n }\n\n /**\n * @dev Returns the downcasted int192 from int256, reverting on\n * overflow (when the input is less than smallest int192 or\n * greater than largest int192).\n *\n * Counterpart to Solidity's `int192` operator.\n *\n * Requirements:\n *\n * - input must fit into 192 bits\n *\n * _Available since v4.7._\n */\n function toInt192(int256 value) internal pure returns (int192 downcasted) {\n downcasted = int192(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 192 bits\");\n }\n\n /**\n * @dev Returns the downcasted int184 from int256, reverting on\n * overflow (when the input is less than smallest int184 or\n * greater than largest int184).\n *\n * Counterpart to Solidity's `int184` operator.\n *\n * Requirements:\n *\n * - input must fit into 184 bits\n *\n * _Available since v4.7._\n */\n function toInt184(int256 value) internal pure returns (int184 downcasted) {\n downcasted = int184(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 184 bits\");\n }\n\n /**\n * @dev Returns the downcasted int176 from int256, reverting on\n * overflow (when the input is less than smallest int176 or\n * greater than largest int176).\n *\n * Counterpart to Solidity's `int176` operator.\n *\n * Requirements:\n *\n * - input must fit into 176 bits\n *\n * _Available since v4.7._\n */\n function toInt176(int256 value) internal pure returns (int176 downcasted) {\n downcasted = int176(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 176 bits\");\n }\n\n /**\n * @dev Returns the downcasted int168 from int256, reverting on\n * overflow (when the input is less than smallest int168 or\n * greater than largest int168).\n *\n * Counterpart to Solidity's `int168` operator.\n *\n * Requirements:\n *\n * - input must fit into 168 bits\n *\n * _Available since v4.7._\n */\n function toInt168(int256 value) internal pure returns (int168 downcasted) {\n downcasted = int168(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 168 bits\");\n }\n\n /**\n * @dev Returns the downcasted int160 from int256, reverting on\n * overflow (when the input is less than smallest int160 or\n * greater than largest int160).\n *\n * Counterpart to Solidity's `int160` operator.\n *\n * Requirements:\n *\n * - input must fit into 160 bits\n *\n * _Available since v4.7._\n */\n function toInt160(int256 value) internal pure returns (int160 downcasted) {\n downcasted = int160(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 160 bits\");\n }\n\n /**\n * @dev Returns the downcasted int152 from int256, reverting on\n * overflow (when the input is less than smallest int152 or\n * greater than largest int152).\n *\n * Counterpart to Solidity's `int152` operator.\n *\n * Requirements:\n *\n * - input must fit into 152 bits\n *\n * _Available since v4.7._\n */\n function toInt152(int256 value) internal pure returns (int152 downcasted) {\n downcasted = int152(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 152 bits\");\n }\n\n /**\n * @dev Returns the downcasted int144 from int256, reverting on\n * overflow (when the input is less than smallest int144 or\n * greater than largest int144).\n *\n * Counterpart to Solidity's `int144` operator.\n *\n * Requirements:\n *\n * - input must fit into 144 bits\n *\n * _Available since v4.7._\n */\n function toInt144(int256 value) internal pure returns (int144 downcasted) {\n downcasted = int144(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 144 bits\");\n }\n\n /**\n * @dev Returns the downcasted int136 from int256, reverting on\n * overflow (when the input is less than smallest int136 or\n * greater than largest int136).\n *\n * Counterpart to Solidity's `int136` operator.\n *\n * Requirements:\n *\n * - input must fit into 136 bits\n *\n * _Available since v4.7._\n */\n function toInt136(int256 value) internal pure returns (int136 downcasted) {\n downcasted = int136(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 136 bits\");\n }\n\n /**\n * @dev Returns the downcasted int128 from int256, reverting on\n * overflow (when the input is less than smallest int128 or\n * greater than largest int128).\n *\n * Counterpart to Solidity's `int128` operator.\n *\n * Requirements:\n *\n * - input must fit into 128 bits\n *\n * _Available since v3.1._\n */\n function toInt128(int256 value) internal pure returns (int128 downcasted) {\n downcasted = int128(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 128 bits\");\n }\n\n /**\n * @dev Returns the downcasted int120 from int256, reverting on\n * overflow (when the input is less than smallest int120 or\n * greater than largest int120).\n *\n * Counterpart to Solidity's `int120` operator.\n *\n * Requirements:\n *\n * - input must fit into 120 bits\n *\n * _Available since v4.7._\n */\n function toInt120(int256 value) internal pure returns (int120 downcasted) {\n downcasted = int120(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 120 bits\");\n }\n\n /**\n * @dev Returns the downcasted int112 from int256, reverting on\n * overflow (when the input is less than smallest int112 or\n * greater than largest int112).\n *\n * Counterpart to Solidity's `int112` operator.\n *\n * Requirements:\n *\n * - input must fit into 112 bits\n *\n * _Available since v4.7._\n */\n function toInt112(int256 value) internal pure returns (int112 downcasted) {\n downcasted = int112(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 112 bits\");\n }\n\n /**\n * @dev Returns the downcasted int104 from int256, reverting on\n * overflow (when the input is less than smallest int104 or\n * greater than largest int104).\n *\n * Counterpart to Solidity's `int104` operator.\n *\n * Requirements:\n *\n * - input must fit into 104 bits\n *\n * _Available since v4.7._\n */\n function toInt104(int256 value) internal pure returns (int104 downcasted) {\n downcasted = int104(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 104 bits\");\n }\n\n /**\n * @dev Returns the downcasted int96 from int256, reverting on\n * overflow (when the input is less than smallest int96 or\n * greater than largest int96).\n *\n * Counterpart to Solidity's `int96` operator.\n *\n * Requirements:\n *\n * - input must fit into 96 bits\n *\n * _Available since v4.7._\n */\n function toInt96(int256 value) internal pure returns (int96 downcasted) {\n downcasted = int96(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 96 bits\");\n }\n\n /**\n * @dev Returns the downcasted int88 from int256, reverting on\n * overflow (when the input is less than smallest int88 or\n * greater than largest int88).\n *\n * Counterpart to Solidity's `int88` operator.\n *\n * Requirements:\n *\n * - input must fit into 88 bits\n *\n * _Available since v4.7._\n */\n function toInt88(int256 value) internal pure returns (int88 downcasted) {\n downcasted = int88(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 88 bits\");\n }\n\n /**\n * @dev Returns the downcasted int80 from int256, reverting on\n * overflow (when the input is less than smallest int80 or\n * greater than largest int80).\n *\n * Counterpart to Solidity's `int80` operator.\n *\n * Requirements:\n *\n * - input must fit into 80 bits\n *\n * _Available since v4.7._\n */\n function toInt80(int256 value) internal pure returns (int80 downcasted) {\n downcasted = int80(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 80 bits\");\n }\n\n /**\n * @dev Returns the downcasted int72 from int256, reverting on\n * overflow (when the input is less than smallest int72 or\n * greater than largest int72).\n *\n * Counterpart to Solidity's `int72` operator.\n *\n * Requirements:\n *\n * - input must fit into 72 bits\n *\n * _Available since v4.7._\n */\n function toInt72(int256 value) internal pure returns (int72 downcasted) {\n downcasted = int72(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 72 bits\");\n }\n\n /**\n * @dev Returns the downcasted int64 from int256, reverting on\n * overflow (when the input is less than smallest int64 or\n * greater than largest int64).\n *\n * Counterpart to Solidity's `int64` operator.\n *\n * Requirements:\n *\n * - input must fit into 64 bits\n *\n * _Available since v3.1._\n */\n function toInt64(int256 value) internal pure returns (int64 downcasted) {\n downcasted = int64(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 64 bits\");\n }\n\n /**\n * @dev Returns the downcasted int56 from int256, reverting on\n * overflow (when the input is less than smallest int56 or\n * greater than largest int56).\n *\n * Counterpart to Solidity's `int56` operator.\n *\n * Requirements:\n *\n * - input must fit into 56 bits\n *\n * _Available since v4.7._\n */\n function toInt56(int256 value) internal pure returns (int56 downcasted) {\n downcasted = int56(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 56 bits\");\n }\n\n /**\n * @dev Returns the downcasted int48 from int256, reverting on\n * overflow (when the input is less than smallest int48 or\n * greater than largest int48).\n *\n * Counterpart to Solidity's `int48` operator.\n *\n * Requirements:\n *\n * - input must fit into 48 bits\n *\n * _Available since v4.7._\n */\n function toInt48(int256 value) internal pure returns (int48 downcasted) {\n downcasted = int48(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 48 bits\");\n }\n\n /**\n * @dev Returns the downcasted int40 from int256, reverting on\n * overflow (when the input is less than smallest int40 or\n * greater than largest int40).\n *\n * Counterpart to Solidity's `int40` operator.\n *\n * Requirements:\n *\n * - input must fit into 40 bits\n *\n * _Available since v4.7._\n */\n function toInt40(int256 value) internal pure returns (int40 downcasted) {\n downcasted = int40(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 40 bits\");\n }\n\n /**\n * @dev Returns the downcasted int32 from int256, reverting on\n * overflow (when the input is less than smallest int32 or\n * greater than largest int32).\n *\n * Counterpart to Solidity's `int32` operator.\n *\n * Requirements:\n *\n * - input must fit into 32 bits\n *\n * _Available since v3.1._\n */\n function toInt32(int256 value) internal pure returns (int32 downcasted) {\n downcasted = int32(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 32 bits\");\n }\n\n /**\n * @dev Returns the downcasted int24 from int256, reverting on\n * overflow (when the input is less than smallest int24 or\n * greater than largest int24).\n *\n * Counterpart to Solidity's `int24` operator.\n *\n * Requirements:\n *\n * - input must fit into 24 bits\n *\n * _Available since v4.7._\n */\n function toInt24(int256 value) internal pure returns (int24 downcasted) {\n downcasted = int24(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 24 bits\");\n }\n\n /**\n * @dev Returns the downcasted int16 from int256, reverting on\n * overflow (when the input is less than smallest int16 or\n * greater than largest int16).\n *\n * Counterpart to Solidity's `int16` operator.\n *\n * Requirements:\n *\n * - input must fit into 16 bits\n *\n * _Available since v3.1._\n */\n function toInt16(int256 value) internal pure returns (int16 downcasted) {\n downcasted = int16(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 16 bits\");\n }\n\n /**\n * @dev Returns the downcasted int8 from int256, reverting on\n * overflow (when the input is less than smallest int8 or\n * greater than largest int8).\n *\n * Counterpart to Solidity's `int8` operator.\n *\n * Requirements:\n *\n * - input must fit into 8 bits\n *\n * _Available since v3.1._\n */\n function toInt8(int256 value) internal pure returns (int8 downcasted) {\n downcasted = int8(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 8 bits\");\n }\n\n /**\n * @dev Converts an unsigned uint256 into a signed int256.\n *\n * Requirements:\n *\n * - input must be less than or equal to maxInt256.\n *\n * _Available since v3.0._\n */\n function toInt256(uint256 value) internal pure returns (int256) {\n // Note: Unsafe cast below is okay because `type(int256).max` is guaranteed to be positive\n require(value <= uint256(type(int256).max), \"SafeCast: value doesn't fit in an int256\");\n return int256(value);\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Strings.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./math/Math.sol\";\n\n/**\n * @dev String operations.\n */\nlibrary Strings {\n bytes16 private constant _SYMBOLS = \"0123456789abcdef\";\n uint8 private constant _ADDRESS_LENGTH = 20;\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n */\n function toString(uint256 value) internal pure returns (string memory) {\n unchecked {\n uint256 length = Math.log10(value) + 1;\n string memory buffer = new string(length);\n uint256 ptr;\n /// @solidity memory-safe-assembly\n assembly {\n ptr := add(buffer, add(32, length))\n }\n while (true) {\n ptr--;\n /// @solidity memory-safe-assembly\n assembly {\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\n }\n value /= 10;\n if (value == 0) break;\n }\n return buffer;\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n */\n function toHexString(uint256 value) internal pure returns (string memory) {\n unchecked {\n return toHexString(value, Math.log256(value) + 1);\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n */\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n bytes memory buffer = new bytes(2 * length + 2);\n buffer[0] = \"0\";\n buffer[1] = \"x\";\n for (uint256 i = 2 * length + 1; i > 1; --i) {\n buffer[i] = _SYMBOLS[value & 0xf];\n value >>= 4;\n }\n require(value == 0, \"Strings: hex length insufficient\");\n return string(buffer);\n }\n\n /**\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\n */\n function toHexString(address addr) internal pure returns (string memory) {\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\n }\n}\n" + }, + "contracts/deprecated/OldDistributor.sol": { + "content": "// SPDX-License-Identifier: BUSL-1.1\n\n/*\n * █ \n ***** ▓▓▓ \n * ▓▓▓▓▓▓▓ \n * ///. ▓▓▓▓▓▓▓▓▓▓▓▓▓ \n ***** //////// ▓▓▓▓▓▓▓ \n * ///////////// ▓▓▓ \n ▓▓ ////////////////// █ ▓▓ \n ▓▓ ▓▓ /////////////////////// ▓▓ ▓▓ \n ▓▓ ▓▓ //////////////////////////// ▓▓ ▓▓ \n ▓▓ ▓▓ /////////▓▓▓///////▓▓▓///////// ▓▓ ▓▓ \n ▓▓ ,////////////////////////////////////// ▓▓ ▓▓ \n ▓▓ ////////////////////////////////////////// ▓▓ \n ▓▓ //////////////////////▓▓▓▓///////////////////// \n ,//////////////////////////////////////////////////// \n .////////////////////////////////////////////////////////// \n .//////////////////////////██.,//////////////////////////█ \n .//////////////////////████..,./////////////////////██ \n ...////////////////███████.....,.////////////////███ \n ,.,////////////████████ ........,///////////████ \n .,.,//////█████████ ,.......///////████ \n ,..//████████ ........./████ \n ..,██████ .....,███ \n .██ ,.,█ \n \n \n \n ▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓ ▓▓▓▓▓▓▓▓▓▓ \n ▓▓▓▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓ ▓▓ ▓▓▓▓ \n ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓ ▓▓▓▓▓ \n ▓▓▓ ▓▓ ▓▓▓ ▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ \n*/\n\npragma solidity ^0.8.17;\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport \"@openzeppelin/contracts/utils/math/SafeCast.sol\";\n\nimport \"../utils/UUPSHelper.sol\";\n\nstruct MerkleTree {\n // Root of a Merkle tree which leaves are `(address user, address token, uint amount)`\n // representing an amount of tokens accumulated by `user`.\n // The Merkle tree is assumed to have only increasing amounts: that is to say if a user can claim 1,\n // then after the amount associated in the Merkle tree for this token should be x > 1\n bytes32 merkleRoot;\n // Ipfs hash of the tree data\n bytes32 ipfsHash;\n}\n\nstruct Claim {\n uint208 amount;\n uint48 timestamp;\n}\n\n/// @title OldDistributor\n/// @notice Allows LPs on AMMs with concentrated liquidity to claim the rewards that were distributed to them\n/// @author Angle Labs. Inc\ncontract OldDistributor is UUPSHelper {\n using SafeERC20 for IERC20;\n\n // ================================= VARIABLES =================================\n\n /// @notice Tree of claimable tokens through this contract\n MerkleTree public tree;\n\n /// @notice Tree that was in place in the contract before the last `tree` update\n MerkleTree public lastTree;\n\n /// @notice Token to deposit to freeze the roots update\n IERC20 public disputeToken;\n\n /// @notice `Core` contract handling access control\n ICore public core;\n\n /// @notice Address which created the dispute\n /// @dev Used to store if there is an ongoing dispute\n address public disputer;\n\n /// @notice Last time the `tree` was updated\n uint48 public lastTreeUpdate;\n\n /// @notice Time before which a change in a tree becomes effective\n uint48 public disputePeriod;\n\n /// @notice Amount to deposit to freeze the roots update\n uint256 public disputeAmount;\n\n /// @notice Mapping user -> token -> amount to track claimed amounts\n mapping(address => mapping(address => Claim)) public claimed;\n\n /// @notice Trusted EOAs to update the Merkle root\n mapping(address => uint256) public canUpdateMerkleRoot;\n\n /// @notice Whether or not to disable permissionless claiming\n mapping(address => uint256) public onlyOperatorCanClaim;\n\n /// @notice user -> operator -> authorisation to claim\n mapping(address => mapping(address => uint256)) public operators;\n\n uint256[38] private __gap;\n\n // =================================== EVENTS ==================================\n\n event Claimed(address user, address token, uint256 amount);\n event Disputed(string reason);\n event DisputePeriodUpdated(uint48 _disputePeriod);\n event DisputeTokenUpdated(address indexed _disputeToken);\n event DisputeAmountUpdated(uint256 _disputeAmount);\n event DisputeResolved(bool valid);\n event OperatorClaimingToggled(address user, bool isEnabled);\n event OperatorToggled(address user, address operator, bool isWhitelisted);\n event Recovered(address indexed token, address indexed to, uint256 amount);\n event TreeUpdated(bytes32 merkleRoot, bytes32 ipfsHash);\n event TrustedToggled(address indexed eoa, bool trust);\n\n // ================================= MODIFIERS =================================\n\n /// @notice Checks whether the `msg.sender` has the governor role or the guardian role\n modifier onlyGovernorOrGuardian() {\n if (!core.isGovernorOrGuardian(msg.sender)) revert NotGovernorOrGuardian();\n _;\n }\n\n /// @notice Checks whether the `msg.sender` is the `user` address or is a trusted address\n modifier onlyTrustedOrUser(address user) {\n if (user != msg.sender && canUpdateMerkleRoot[msg.sender] != 1 && !core.isGovernorOrGuardian(msg.sender))\n revert NotTrusted();\n _;\n }\n\n // ================================ CONSTRUCTOR ================================\n\n constructor() initializer {}\n\n function initialize(ICore _core) external initializer {\n if (address(_core) == address(0)) revert ZeroAddress();\n core = _core;\n }\n\n /// @inheritdoc UUPSUpgradeable\n function _authorizeUpgrade(address) internal view override onlyGuardianUpgrader(core) {}\n\n // =============================== MAIN FUNCTION ===============================\n\n /// @notice Claims rewards for a given set of users\n /// @dev Anyone may call this function for anyone else, funds go to destination regardless, it's just a question of\n /// who provides the proof and pays the gas: `msg.sender` is used only for addresses that require a trusted operator\n /// @param users Recipient of tokens\n /// @param tokens ERC20 claimed\n /// @param amounts Amount of tokens that will be sent to the corresponding users\n /// @param proofs Array of hashes bridging from a leaf `(hash of user | token | amount)` to the Merkle root\n function claim(\n address[] calldata users,\n address[] calldata tokens,\n uint256[] calldata amounts,\n bytes32[][] calldata proofs\n ) external {\n uint256 usersLength = users.length;\n if (\n usersLength == 0 ||\n usersLength != tokens.length ||\n usersLength != amounts.length ||\n usersLength != proofs.length\n ) revert InvalidLengths();\n\n for (uint256 i; i < usersLength; ) {\n address user = users[i];\n address token = tokens[i];\n uint256 amount = amounts[i];\n\n // Checking if only an approved operator can claim for `user`\n if (onlyOperatorCanClaim[user] == 1 && operators[user][msg.sender] == 0) revert NotWhitelisted();\n\n // Verifying proof\n bytes32 leaf = keccak256(abi.encode(user, token, amount));\n if (!_verifyProof(leaf, proofs[i])) revert InvalidProof();\n\n // Closing reentrancy gate here\n uint256 toSend = amount - claimed[user][token].amount;\n claimed[user][token] = Claim(SafeCast.toUint208(amount), uint48(block.timestamp));\n\n IERC20(token).safeTransfer(user, toSend);\n emit Claimed(user, token, toSend);\n unchecked {\n ++i;\n }\n }\n }\n\n /// @notice Returns the MerkleRoot that is currently live for the contract\n function getMerkleRoot() public view returns (bytes32) {\n if (block.timestamp - lastTreeUpdate >= disputePeriod) return tree.merkleRoot;\n else return lastTree.merkleRoot;\n }\n\n // ============================ GOVERNANCE FUNCTIONS ===========================\n\n /// @notice Adds or removes EOAs which are trusted to update the Merkle root\n function toggleTrusted(address eoa) external onlyGovernorOrGuardian {\n uint256 trustedStatus = 1 - canUpdateMerkleRoot[eoa];\n canUpdateMerkleRoot[eoa] = trustedStatus;\n emit TrustedToggled(eoa, trustedStatus == 1);\n }\n\n /// @notice Updates Merkle Tree\n function updateTree(MerkleTree calldata _tree) external {\n if (\n disputer != address(0) ||\n // A trusted address cannot update a tree right after a precedent tree update otherwise it can de facto\n // validate a tree which has not passed the dispute period\n ((canUpdateMerkleRoot[msg.sender] != 1 || block.timestamp - lastTreeUpdate < disputePeriod) &&\n !core.isGovernorOrGuardian(msg.sender))\n ) revert NotTrusted();\n MerkleTree memory _lastTree = tree;\n tree = _tree;\n lastTree = _lastTree;\n lastTreeUpdate = uint48(block.timestamp);\n emit TreeUpdated(_tree.merkleRoot, _tree.ipfsHash);\n }\n\n /// @notice Freezes the Merkle tree update until the dispute is resolved\n /// @dev Requires a deposit of `disputeToken` that'll be slashed if the dispute is not accepted\n /// @dev It is only possible to create a dispute for `disputePeriod` after each tree update\n function disputeTree(string memory reason) external {\n if (block.timestamp - lastTreeUpdate >= disputePeriod) revert InvalidDispute();\n IERC20(disputeToken).safeTransferFrom(msg.sender, address(this), disputeAmount);\n disputer = msg.sender;\n emit Disputed(reason);\n }\n\n /// @notice Resolve the ongoing dispute, if any\n /// @param valid Whether the dispute was valid\n function resolveDispute(bool valid) external onlyGovernorOrGuardian {\n if (disputer == address(0)) revert NoDispute();\n if (valid) {\n IERC20(disputeToken).safeTransfer(disputer, disputeAmount);\n // If a dispute is valid, the contract falls back to the last tree that was updated\n _revokeTree();\n } else {\n IERC20(disputeToken).safeTransfer(msg.sender, disputeAmount);\n lastTreeUpdate = uint48(block.timestamp);\n }\n disputer = address(0);\n emit DisputeResolved(valid);\n }\n\n /// @notice Allows the governor or the guardian of this contract to fallback to the last version of the tree\n /// immediately\n function revokeTree() external onlyGovernorOrGuardian {\n if (disputer != address(0)) revert UnresolvedDispute();\n _revokeTree();\n }\n\n /// @notice Toggles permissioned claiming for a given user\n function toggleOnlyOperatorCanClaim(address user) external onlyTrustedOrUser(user) {\n uint256 oldValue = onlyOperatorCanClaim[user];\n onlyOperatorCanClaim[user] = 1 - oldValue;\n emit OperatorClaimingToggled(user, oldValue == 0);\n }\n\n /// @notice Toggles whitelisting for a given user and a given operator\n function toggleOperator(address user, address operator) external onlyTrustedOrUser(user) {\n uint256 oldValue = operators[user][operator];\n operators[user][operator] = 1 - oldValue;\n emit OperatorToggled(user, operator, oldValue == 0);\n }\n\n /// @notice Recovers any ERC20 token\n function recoverERC20(address tokenAddress, address to, uint256 amountToRecover) external onlyGovernorOrGuardian {\n IERC20(tokenAddress).safeTransfer(to, amountToRecover);\n emit Recovered(tokenAddress, to, amountToRecover);\n }\n\n /// @notice Sets the dispute period before which a tree update becomes effective\n function setDisputePeriod(uint48 _disputePeriod) external onlyGovernorOrGuardian {\n if (_disputePeriod > block.timestamp) revert InvalidParam();\n disputePeriod = uint48(_disputePeriod);\n emit DisputePeriodUpdated(_disputePeriod);\n }\n\n /// @notice Sets the token used as a caution during disputes\n function setDisputeToken(IERC20 _disputeToken) external onlyGovernorOrGuardian {\n if (disputer != address(0)) revert UnresolvedDispute();\n disputeToken = _disputeToken;\n emit DisputeTokenUpdated(address(_disputeToken));\n }\n\n /// @notice Sets the amount of `disputeToken` used as a caution during disputes\n function setDisputeAmount(uint256 _disputeAmount) external onlyGovernorOrGuardian {\n if (disputer != address(0)) revert UnresolvedDispute();\n disputeAmount = _disputeAmount;\n emit DisputeAmountUpdated(_disputeAmount);\n }\n\n // ============================= INTERNAL FUNCTIONS ============================\n\n /// @notice Fallback to the last version of the tree\n function _revokeTree() internal {\n MerkleTree memory _tree = lastTree;\n lastTreeUpdate = 0;\n tree = _tree;\n emit TreeUpdated(_tree.merkleRoot, _tree.ipfsHash);\n }\n\n /// @notice Checks the validity of a proof\n /// @param leaf Hashed leaf data, the starting point of the proof\n /// @param proof Array of hashes forming a hash chain from leaf to root\n /// @return true If proof is correct, else false\n function _verifyProof(bytes32 leaf, bytes32[] memory proof) internal view returns (bool) {\n bytes32 currentHash = leaf;\n uint256 proofLength = proof.length;\n for (uint256 i; i < proofLength; ) {\n if (currentHash < proof[i]) {\n currentHash = keccak256(abi.encode(currentHash, proof[i]));\n } else {\n currentHash = keccak256(abi.encode(proof[i], currentHash));\n }\n unchecked {\n ++i;\n }\n }\n bytes32 root = getMerkleRoot();\n if (root == bytes32(0)) revert InvalidUninitializedRoot();\n return currentHash == root;\n }\n}\n" + }, + "contracts/DistributionCreator.sol": { + "content": "// SPDX-License-Identifier: BUSL-1.1\n\n/*\n * █ \n ***** ▓▓▓ \n * ▓▓▓▓▓▓▓ \n * ///. ▓▓▓▓▓▓▓▓▓▓▓▓▓ \n ***** //////// ▓▓▓▓▓▓▓ \n * ///////////// ▓▓▓ \n ▓▓ ////////////////// █ ▓▓ \n ▓▓ ▓▓ /////////////////////// ▓▓ ▓▓ \n ▓▓ ▓▓ //////////////////////////// ▓▓ ▓▓ \n ▓▓ ▓▓ /////////▓▓▓///////▓▓▓///////// ▓▓ ▓▓ \n ▓▓ ,////////////////////////////////////// ▓▓ ▓▓ \n ▓▓ ////////////////////////////////////////// ▓▓ \n ▓▓ //////////////////////▓▓▓▓///////////////////// \n ,//////////////////////////////////////////////////// \n .////////////////////////////////////////////////////////// \n .//////////////////////////██.,//////////////////////////█ \n .//////////////////////████..,./////////////////////██ \n ...////////////////███████.....,.////////////////███ \n ,.,////////////████████ ........,///////////████ \n .,.,//////█████████ ,.......///////████ \n ,..//████████ ........./████ \n ..,██████ .....,███ \n .██ ,.,█ \n \n \n \n ▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓ ▓▓▓▓▓▓▓▓▓▓ \n ▓▓▓▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓ ▓▓ ▓▓▓▓ \n ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓ ▓▓▓▓▓ \n ▓▓▓ ▓▓ ▓▓▓ ▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ \n*/\n\npragma solidity ^0.8.17;\n\nimport { ReentrancyGuardUpgradeable } from \"@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol\";\nimport { IERC20, IERC20Metadata } from \"@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol\";\nimport { SafeERC20 } from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport { ECDSA } from \"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\";\n\nimport { IUniswapV3Pool } from \"./interfaces/external/uniswap/IUniswapV3Pool.sol\";\n\nimport \"./utils/UUPSHelper.sol\";\nimport { DistributionParameters } from \"./struct/DistributionParameters.sol\";\nimport { UniswapTokenData, ExtensiveDistributionParameters } from \"./struct/ExtensiveDistributionParameters.sol\";\nimport { RewardTokenAmounts } from \"./struct/RewardTokenAmounts.sol\";\n\ninterface IDistributionCreator {\n function tryGetExtensiveDistributionParameters(\n DistributionParameters memory distribution\n ) external view returns (bool success, ExtensiveDistributionParameters memory extensiveParams);\n}\n\n/// @title DistributionCreator\n/// @author Angle Labs, Inc.\n/// @notice Manages the distribution of rewards across different pools with concentrated liquidity (like on Uniswap V3)\n/// @dev This contract is mostly a helper for APIs built on top of Merkl\n/// @dev People depositing rewards must have signed a `message` with the conditions for using the\n/// product\n//solhint-disable\ncontract DistributionCreator is UUPSHelper, ReentrancyGuardUpgradeable {\n using SafeERC20 for IERC20;\n\n // =========================== CONSTANTS / VARIABLES ===========================\n\n /// @notice Epoch duration\n uint32 public constant EPOCH_DURATION = 3600;\n\n /// @notice Base for fee computation\n uint256 public constant BASE_9 = 1e9;\n\n /// @notice `Core` contract handling access control\n ICore public core;\n\n /// @notice User contract for distributing rewards\n address public distributor;\n\n /// @notice Address to which fees are forwarded\n address public feeRecipient;\n\n /// @notice Value (in base 10**9) of the fees taken when creating a distribution for a pool which do not\n /// have a whitelisted token in it\n uint256 public fees;\n\n /// @notice Message that needs to be acknowledged by users creating a distribution\n string public message;\n\n /// @notice Hash of the message that needs to be signed\n bytes32 public messageHash;\n\n /// @notice List of all rewards ever distributed or to be distributed in the contract\n /// @dev An attacker could try to populate this list. It shouldn't be an issue as only view functions\n /// iterate on it\n DistributionParameters[] public distributionList;\n\n /// @notice Maps an address to its fee rebate\n mapping(address => uint256) public feeRebate;\n\n /// @notice Maps a token to whether it is whitelisted or not. No fees are to be paid for incentives given\n /// on pools with whitelisted tokens\n mapping(address => uint256) public isWhitelistedToken;\n\n /// @notice Maps an address to its nonce for creating a distribution\n mapping(address => uint256) public nonces;\n\n /// @notice Maps an address to the last valid hash signed\n mapping(address => bytes32) public userSignatures;\n\n /// @notice Maps a user to whether it is whitelisted for not signing\n mapping(address => uint256) public userSignatureWhitelist;\n\n /// @notice Maps a token to the minimum amount that must be sent per epoch for a distribution to be valid\n /// @dev If `rewardTokenMinAmounts[token] == 0`, then `token` cannot be used as a reward\n mapping(address => uint256) public rewardTokenMinAmounts;\n\n /// @notice List of all reward tokens that have at some point been accepted\n address[] public rewardTokens;\n\n uint256[36] private __gap;\n\n // =================================== EVENTS ==================================\n\n event DistributorUpdated(address indexed _distributor);\n event FeeRebateUpdated(address indexed user, uint256 userFeeRebate);\n event FeeRecipientUpdated(address indexed _feeRecipient);\n event FeesSet(uint256 _fees);\n event MessageUpdated(bytes32 _messageHash);\n event NewDistribution(DistributionParameters distribution, address indexed sender);\n event RewardTokenMinimumAmountUpdated(address indexed token, uint256 amount);\n event TokenWhitelistToggled(address indexed token, uint256 toggleStatus);\n event UserSigned(bytes32 messageHash, address indexed user);\n event UserSigningWhitelistToggled(address indexed user, uint256 toggleStatus);\n\n // ================================= MODIFIERS =================================\n\n /// @notice Checks whether the `msg.sender` has the governor role or the guardian role\n modifier onlyGovernorOrGuardian() {\n if (!core.isGovernorOrGuardian(msg.sender)) revert NotGovernorOrGuardian();\n _;\n }\n\n /// @notice Checks whether an address has signed the message or not\n modifier hasSigned() {\n if (\n userSignatureWhitelist[msg.sender] == 0 &&\n userSignatures[msg.sender] != messageHash &&\n userSignatureWhitelist[tx.origin] == 0 &&\n userSignatures[tx.origin] != messageHash\n ) revert NotSigned();\n _;\n }\n\n // ================================ CONSTRUCTOR ================================\n\n function initialize(ICore _core, address _distributor, uint256 _fees) external initializer {\n if (address(_core) == address(0) || _distributor == address(0)) revert ZeroAddress();\n if (_fees >= BASE_9) revert InvalidParam();\n distributor = _distributor;\n core = _core;\n fees = _fees;\n }\n\n constructor() initializer {}\n\n /// @inheritdoc UUPSUpgradeable\n function _authorizeUpgrade(address) internal view override onlyGuardianUpgrader(core) {}\n\n // ============================== DEPOSIT FUNCTION =============================\n\n /// @notice Creates a `distribution` to incentivize a given pool for a specific period of time\n /// @return distributionAmount How many reward tokens are actually taken into consideration in the contract\n /// @dev If the address specified as a UniV3 pool is not effectively a pool, it will not be handled by the\n /// distribution script and rewards may be lost\n /// @dev Reward tokens sent as part of distributions must have been whitelisted before and amounts\n /// sent should be bigger than a minimum amount specific to each token\n /// @dev The `positionWrappers` specified in the `distribution` struct need to be supported by the script\n /// List of supported `positionWrappers` can be found in the docs.\n /// @dev If the pool incentivized contains one whitelisted token, then no fees are taken on the rewards\n /// @dev This function reverts if the sender has not signed the message `messageHash` once through one of\n /// the functions enabling to sign\n function createDistribution(\n DistributionParameters memory distribution\n ) external hasSigned returns (uint256 distributionAmount) {\n return _createDistribution(distribution);\n }\n\n /// @notice Same as the function above but for multiple distributions at once\n /// @return List of all the distribution amounts actually deposited for each `distribution` in the `distributions` list\n function createDistributions(\n DistributionParameters[] memory distributions\n ) external hasSigned returns (uint256[] memory) {\n uint256 distributionsLength = distributions.length;\n uint256[] memory distributionAmounts = new uint256[](distributionsLength);\n for (uint256 i; i < distributionsLength; ) {\n distributionAmounts[i] = _createDistribution(distributions[i]);\n unchecked {\n ++i;\n }\n }\n return distributionAmounts;\n }\n\n /// @notice Checks whether the `msg.sender`'s `signature` is compatible with the message\n /// to sign and stores the signature\n /// @dev If you signed the message once, and the message has not been modified, then you do not\n /// need to sign again\n function sign(bytes calldata signature) external {\n _sign(signature);\n }\n\n /// @notice Combines signing the message and creating a distribution\n function signAndCreateDistribution(\n DistributionParameters memory distribution,\n bytes calldata signature\n ) external returns (uint256 distributionAmount) {\n _sign(signature);\n return _createDistribution(distribution);\n }\n\n /// @notice Internal version of `createDistribution`\n function _createDistribution(\n DistributionParameters memory distribution\n ) internal nonReentrant returns (uint256 distributionAmount) {\n uint32 epochStart = _getRoundedEpoch(distribution.epochStart);\n uint256 minDistributionAmount = rewardTokenMinAmounts[distribution.rewardToken];\n distribution.epochStart = epochStart;\n // Reward are not accepted in the following conditions:\n if (\n // if epoch parameters lead to a past distribution\n epochStart + EPOCH_DURATION < block.timestamp ||\n // if the amount of epochs for which this distribution should last is zero\n distribution.numEpoch == 0 ||\n // if the distribution parameters are not correctly specified\n distribution.propFees + distribution.propToken0 + distribution.propToken1 != 1e4 ||\n // if boosted addresses get less than non-boosted addresses in case of\n (distribution.boostingAddress != address(0) && distribution.boostedReward < 1e4) ||\n // if the type of the position wrappers is not well specified\n distribution.positionWrappers.length != distribution.wrapperTypes.length ||\n // if the reward token is not whitelisted as an incentive token\n minDistributionAmount == 0 ||\n // if the amount distributed is too small with respect to what is allowed\n distribution.amount / distribution.numEpoch < minDistributionAmount\n ) revert InvalidReward();\n distributionAmount = distribution.amount;\n // Computing fees: these are waived for whitelisted addresses and if there is a whitelisted token in a pool\n uint256 userFeeRebate = feeRebate[msg.sender];\n if (\n userFeeRebate < BASE_9 &&\n // Algebra pools also have these `token0` and `token1` parameters\n isWhitelistedToken[IUniswapV3Pool(distribution.uniV3Pool).token0()] == 0 &&\n isWhitelistedToken[IUniswapV3Pool(distribution.uniV3Pool).token1()] == 0\n ) {\n uint256 _fees = (fees * (BASE_9 - userFeeRebate)) / BASE_9;\n uint256 distributionAmountMinusFees = (distributionAmount * (BASE_9 - _fees)) / BASE_9;\n address _feeRecipient = feeRecipient;\n _feeRecipient = _feeRecipient == address(0) ? address(this) : _feeRecipient;\n IERC20(distribution.rewardToken).safeTransferFrom(\n msg.sender,\n _feeRecipient,\n distributionAmount - distributionAmountMinusFees\n );\n distributionAmount = distributionAmountMinusFees;\n distribution.amount = distributionAmount;\n }\n\n IERC20(distribution.rewardToken).safeTransferFrom(msg.sender, distributor, distributionAmount);\n uint256 senderNonce = nonces[msg.sender];\n nonces[msg.sender] = senderNonce + 1;\n distribution.rewardId = bytes32(keccak256(abi.encodePacked(msg.sender, senderNonce)));\n distributionList.push(distribution);\n emit NewDistribution(distribution, msg.sender);\n }\n\n /// @notice Internal version of the `sign` function\n function _sign(bytes calldata signature) internal {\n bytes32 _messageHash = messageHash;\n if (ECDSA.recover(_messageHash, signature) != msg.sender) revert InvalidSignature();\n userSignatures[msg.sender] = _messageHash;\n emit UserSigned(_messageHash, msg.sender);\n }\n\n // ================================= UI HELPERS ================================\n // These functions are not to be queried on-chain and hence are not optimized for gas consumption\n\n /// @notice Returns the list of all distributions ever made or to be done in the future\n function getAllDistributions() external view returns (DistributionParameters[] memory) {\n return distributionList;\n }\n\n /// @notice Returns the list of all currently active distributions on pools of supported AMMs (like Uniswap V3)\n function getActiveDistributions()\n external\n view\n returns (ExtensiveDistributionParameters[] memory searchDistributions)\n {\n uint32 roundedEpoch = _getRoundedEpoch(uint32(block.timestamp));\n (searchDistributions, ) = _getPoolDistributionsBetweenEpochs(\n address(0),\n roundedEpoch,\n roundedEpoch + EPOCH_DURATION,\n 0,\n type(uint32).max\n );\n }\n\n /// @notice Similar to `getActiveDistributions()` with additional parameters to prevent out of gas error\n /// @param skip Disregard distibutions with a global index lower than `skip`\n /// @param first Limit the length of the returned array to `first`\n /// @return searchDistributions Eligible distributions\n /// @return lastIndexDistribution Index of the last distribution assessed in the list of all distributions\n /// For pagniation purpose, in case of out of gas, you can call back the same function but with `skip` set to `lastIndexDistribution`\n function getActiveDistributions(\n uint32 skip,\n uint32 first\n )\n external\n view\n returns (ExtensiveDistributionParameters[] memory searchDistributions, uint256 lastIndexDistribution)\n {\n uint32 roundedEpoch = _getRoundedEpoch(uint32(block.timestamp));\n return _getPoolDistributionsBetweenEpochs(address(0), roundedEpoch, roundedEpoch + EPOCH_DURATION, skip, first);\n }\n\n /// @notice Returns the list of all the reward tokens supported as well as their minimum amounts\n function getValidRewardTokens() external view returns (RewardTokenAmounts[] memory) {\n uint256 length;\n uint256 rewardTokenListLength = rewardTokens.length;\n RewardTokenAmounts[] memory validRewardTokens = new RewardTokenAmounts[](rewardTokenListLength);\n for (uint32 i; i < rewardTokenListLength; ) {\n address token = rewardTokens[i];\n uint256 minAmount = rewardTokenMinAmounts[token];\n if (minAmount > 0) {\n validRewardTokens[length] = RewardTokenAmounts(token, minAmount);\n length += 1;\n }\n unchecked {\n ++i;\n }\n }\n assembly {\n mstore(validRewardTokens, length)\n }\n return validRewardTokens;\n }\n\n /// @notice Returns the list of all the distributions that were or that are going to be live at\n /// a specific epoch\n function getDistributionsForEpoch(\n uint32 epoch\n ) external view returns (ExtensiveDistributionParameters[] memory searchDistributions) {\n uint32 roundedEpoch = _getRoundedEpoch(epoch);\n (searchDistributions, ) = _getPoolDistributionsBetweenEpochs(\n address(0),\n roundedEpoch,\n roundedEpoch + EPOCH_DURATION,\n 0,\n type(uint32).max\n );\n }\n\n /// @notice Similar to `getDistributionsForEpoch(uint256 epoch)` with additional parameters to prevent out of gas error\n /// @param skip Disregard distibutions with a global index lower than `skip`\n /// @param first Limit the length of the returned array to `first`\n /// @return searchDistributions Eligible distributions\n /// @return lastIndexDistribution Index of the last distribution assessed in the list of all distributions\n /// For pagniation purpose, in case of out of gas, you can call back the same function but with `skip` set to `lastIndexDistribution`\n function getDistributionsForEpoch(\n uint32 epoch,\n uint32 skip,\n uint32 first\n ) external view returns (ExtensiveDistributionParameters[] memory, uint256 lastIndexDistribution) {\n uint32 roundedEpoch = _getRoundedEpoch(epoch);\n return _getPoolDistributionsBetweenEpochs(address(0), roundedEpoch, roundedEpoch + EPOCH_DURATION, skip, first);\n }\n\n /// @notice Gets the distributions that were or will be live at some point between `epochStart` (included) and `epochEnd` (excluded)\n /// @dev If a distribution starts during `epochEnd`, it is not be returned by this function\n /// @dev Conversely, if a distribution starts after `epochStart` and ends before `epochEnd`, it is returned by this function\n function getDistributionsBetweenEpochs(\n uint32 epochStart,\n uint32 epochEnd\n ) external view returns (ExtensiveDistributionParameters[] memory searchDistributions) {\n (searchDistributions, ) = _getPoolDistributionsBetweenEpochs(\n address(0),\n _getRoundedEpoch(epochStart),\n _getRoundedEpoch(epochEnd),\n 0,\n type(uint32).max\n );\n }\n\n /// @notice Similar to `getDistributionsBetweenEpochs(uint256 epochStart, uint256 epochEnd)` with additional parameters to prevent out of gas error\n /// @param skip Disregard distibutions with a global index lower than `skip`\n /// @param first Limit the length of the returned array to `first`\n /// @return searchDistributions Eligible distributions\n /// @return lastIndexDistribution Index of the last distribution assessed in the list of all distributions\n /// For pagniation purpose, in case of out of gas, you can call back the same function but with `skip` set to `lastIndexDistribution`\n function getDistributionsBetweenEpochs(\n uint32 epochStart,\n uint32 epochEnd,\n uint32 skip,\n uint32 first\n ) external view returns (ExtensiveDistributionParameters[] memory, uint256 lastIndexDistribution) {\n return\n _getPoolDistributionsBetweenEpochs(\n address(0),\n _getRoundedEpoch(epochStart),\n _getRoundedEpoch(epochEnd),\n skip,\n first\n );\n }\n\n /// @notice Returns the list of all distributions that were or will be live after `epochStart` (included)\n function getDistributionsAfterEpoch(\n uint32 epochStart\n ) external view returns (ExtensiveDistributionParameters[] memory searchDistributions) {\n (searchDistributions, ) = _getPoolDistributionsBetweenEpochs(\n address(0),\n _getRoundedEpoch(epochStart),\n type(uint32).max,\n 0,\n type(uint32).max\n );\n }\n\n /// @notice Similar to `getDistributionsAfterEpoch(uint256 epochStart)` with additional parameters to prevent out of gas error\n /// @param skip Disregard distibutions with a global index lower than `skip`\n /// @param first Limit the length of the returned array to `first`\n /// @return searchDistributions Eligible distributions\n /// @return lastIndexDistribution Index of the last distribution assessed in the list of all distributions\n /// For pagniation purpose, in case of out of gas, you can call back the same function but with `skip` set to `lastIndexDistribution`\n function getDistributionsAfterEpoch(\n uint32 epochStart,\n uint32 skip,\n uint32 first\n ) external view returns (ExtensiveDistributionParameters[] memory, uint256 lastIndexDistribution) {\n return\n _getPoolDistributionsBetweenEpochs(address(0), _getRoundedEpoch(epochStart), type(uint32).max, skip, first);\n }\n\n /// @notice Returns the list of all currently active distributions for a specific UniswapV3 pool\n function getActivePoolDistributions(\n address uniV3Pool\n ) external view returns (ExtensiveDistributionParameters[] memory searchDistributions) {\n uint32 roundedEpoch = _getRoundedEpoch(uint32(block.timestamp));\n (searchDistributions, ) = _getPoolDistributionsBetweenEpochs(\n uniV3Pool,\n roundedEpoch,\n roundedEpoch + EPOCH_DURATION,\n 0,\n type(uint32).max\n );\n }\n\n /// @notice Similar to `getActivePoolDistributions(address uniV3Pool)` with additional parameters to prevent out of gas error\n /// @param skip Disregard distibutions with a global index lower than `skip`\n /// @param first Limit the length of the returned array to `first`\n /// @return searchDistributions Eligible distributions\n /// @return lastIndexDistribution Index of the last distribution assessed in the list of all distributions\n /// For pagniation purpose, in case of out of gas, you can call back the same function but with `skip` set to `lastIndexDistribution`\n function getActivePoolDistributions(\n address uniV3Pool,\n uint32 skip,\n uint32 first\n ) external view returns (ExtensiveDistributionParameters[] memory, uint256 lastIndexDistribution) {\n uint32 roundedEpoch = _getRoundedEpoch(uint32(block.timestamp));\n return _getPoolDistributionsBetweenEpochs(uniV3Pool, roundedEpoch, roundedEpoch + EPOCH_DURATION, skip, first);\n }\n\n /// @notice Returns the list of all the distributions that were or that are going to be live at a\n /// specific epoch and for a specific pool\n function getPoolDistributionsForEpoch(\n address uniV3Pool,\n uint32 epoch\n ) external view returns (ExtensiveDistributionParameters[] memory searchDistributions) {\n uint32 roundedEpoch = _getRoundedEpoch(epoch);\n (searchDistributions, ) = _getPoolDistributionsBetweenEpochs(\n uniV3Pool,\n roundedEpoch,\n roundedEpoch + EPOCH_DURATION,\n 0,\n type(uint32).max\n );\n }\n\n /// @notice Similar to `getPoolDistributionsForEpoch(address uniV3Pool,uint32 epoch)` with additional parameters to prevent out of gas error\n /// @param skip Disregard distibutions with a global index lower than `skip`\n /// @param first Limit the length of the returned array to `first`\n /// @return searchDistributions Eligible distributions\n /// @return lastIndexDistribution Index of the last distribution assessed in the list of all distributions\n /// For pagniation purpose, in case of out of gas, you can call back the same function but with `skip` set to `lastIndexDistribution`\n function getPoolDistributionsForEpoch(\n address uniV3Pool,\n uint32 epoch,\n uint32 skip,\n uint32 first\n ) external view returns (ExtensiveDistributionParameters[] memory, uint256 lastIndexDistribution) {\n uint32 roundedEpoch = _getRoundedEpoch(epoch);\n return _getPoolDistributionsBetweenEpochs(uniV3Pool, roundedEpoch, roundedEpoch + EPOCH_DURATION, skip, first);\n }\n\n /// @notice Returns the list of all distributions that were or will be live at some point between\n /// `epochStart` (included) and `epochEnd` (excluded) for a specific pool\n function getPoolDistributionsBetweenEpochs(\n address uniV3Pool,\n uint32 epochStart,\n uint32 epochEnd\n ) external view returns (ExtensiveDistributionParameters[] memory searchDistributions) {\n (searchDistributions, ) = _getPoolDistributionsBetweenEpochs(\n uniV3Pool,\n _getRoundedEpoch(epochStart),\n _getRoundedEpoch(epochEnd),\n 0,\n type(uint32).max\n );\n }\n\n /// @notice Similar to `getPoolDistributionsBetweenEpochs(address uniV3Pool,uint32 epochStart, uint32 epochEnd)` with additional parameters to prevent out of gas error\n /// @param skip Disregard distibutions with a global index lower than `skip`\n /// @param first Limit the length of the returned array to `first`\n /// @return searchDistributions Eligible distributions\n /// @return lastIndexDistribution Index of the last distribution assessed in the list of all distributions\n /// For pagniation purpose, in case of out of gas, you can call back the same function but with `skip` set to `lastIndexDistribution`\n function getPoolDistributionsBetweenEpochs(\n address uniV3Pool,\n uint32 epochStart,\n uint32 epochEnd,\n uint32 skip,\n uint32 first\n ) external view returns (ExtensiveDistributionParameters[] memory, uint256 lastIndexDistribution) {\n return\n _getPoolDistributionsBetweenEpochs(\n uniV3Pool,\n _getRoundedEpoch(epochStart),\n _getRoundedEpoch(epochEnd),\n skip,\n first\n );\n }\n\n /// @notice Returns the list of all distributions that were or will be live after `epochStart` (included)\n /// for a specific pool\n function getPoolDistributionsAfterEpoch(\n address uniV3Pool,\n uint32 epochStart\n ) external view returns (ExtensiveDistributionParameters[] memory searchDistributions) {\n (searchDistributions, ) = _getPoolDistributionsBetweenEpochs(\n uniV3Pool,\n _getRoundedEpoch(epochStart),\n type(uint32).max,\n 0,\n type(uint32).max\n );\n }\n\n /// @notice Similar to `getPoolDistributionsAfterEpoch(address uniV3Pool,uint32 epochStart)` with additional parameters to prevent out of gas error\n /// @param skip Disregard distibutions with a global index lower than `skip`\n /// @param first Limit the length of the returned array to `first`\n /// @return searchDistributions Eligible distributions\n /// @return lastIndexDistribution Index of the last distribution assessed in the list of all distributions\n /// For pagniation purpose, in case of out of gas, you can call back the same function but with `skip` set to `lastIndexDistribution`\n function getPoolDistributionsAfterEpoch(\n address uniV3Pool,\n uint32 epochStart,\n uint32 skip,\n uint32 first\n ) external view returns (ExtensiveDistributionParameters[] memory, uint256 lastIndexDistribution) {\n return\n _getPoolDistributionsBetweenEpochs(uniV3Pool, _getRoundedEpoch(epochStart), type(uint32).max, skip, first);\n }\n\n // ============================ GOVERNANCE FUNCTIONS ===========================\n\n /// @notice Sets a new `distributor` to which rewards should be distributed\n function setNewDistributor(address _distributor) external onlyGovernorOrGuardian {\n if (_distributor == address(0)) revert InvalidParam();\n distributor = _distributor;\n emit DistributorUpdated(_distributor);\n }\n\n /// @notice Sets the fees on deposit\n function setFees(uint256 _fees) external onlyGovernorOrGuardian {\n if (_fees >= BASE_9) revert InvalidParam();\n fees = _fees;\n emit FeesSet(_fees);\n }\n\n /// @notice Sets fee rebates for a given user\n function setUserFeeRebate(address user, uint256 userFeeRebate) external onlyGovernorOrGuardian {\n feeRebate[user] = userFeeRebate;\n emit FeeRebateUpdated(user, userFeeRebate);\n }\n\n /// @notice Toggles the fee whitelist for `token`\n function toggleTokenWhitelist(address token) external onlyGovernorOrGuardian {\n uint256 toggleStatus = 1 - isWhitelistedToken[token];\n isWhitelistedToken[token] = toggleStatus;\n emit TokenWhitelistToggled(token, toggleStatus);\n }\n\n /// @notice Recovers fees accrued on the contract for a list of `tokens`\n function recoverFees(IERC20[] calldata tokens, address to) external onlyGovernorOrGuardian {\n uint256 tokensLength = tokens.length;\n for (uint256 i; i < tokensLength; ) {\n tokens[i].safeTransfer(to, tokens[i].balanceOf(address(this)));\n unchecked {\n ++i;\n }\n }\n }\n\n /// @notice Sets the minimum amounts per distribution epoch for different reward tokens\n function setRewardTokenMinAmounts(\n address[] calldata tokens,\n uint256[] calldata amounts\n ) external onlyGovernorOrGuardian {\n uint256 tokensLength = tokens.length;\n if (tokensLength != amounts.length) revert InvalidLengths();\n for (uint256 i; i < tokensLength; ++i) {\n uint256 amount = amounts[i];\n // Basic logic check to make sure there are no duplicates in the `rewardTokens` table. If a token is\n // removed then re-added, it will appear as a duplicate in the list\n if (amount > 0 && rewardTokenMinAmounts[tokens[i]] == 0) rewardTokens.push(tokens[i]);\n rewardTokenMinAmounts[tokens[i]] = amount;\n emit RewardTokenMinimumAmountUpdated(tokens[i], amount);\n }\n }\n\n /// @notice Sets a new address to receive fees\n function setFeeRecipient(address _feeRecipient) external onlyGovernorOrGuardian {\n feeRecipient = _feeRecipient;\n emit FeeRecipientUpdated(_feeRecipient);\n }\n\n /// @notice Sets the message that needs to be signed by users before posting rewards\n function setMessage(string memory _message) external onlyGovernorOrGuardian {\n message = _message;\n bytes32 _messageHash = ECDSA.toEthSignedMessageHash(bytes(_message));\n messageHash = _messageHash;\n emit MessageUpdated(_messageHash);\n }\n\n /// @notice Toggles the whitelist status for `user` when it comes to signing messages before depositing rewards.\n function toggleSigningWhitelist(address user) external onlyGovernorOrGuardian {\n uint256 whitelistStatus = 1 - userSignatureWhitelist[user];\n userSignatureWhitelist[user] = whitelistStatus;\n emit UserSigningWhitelistToggled(user, whitelistStatus);\n }\n\n // ============================== INTERNAL HELPERS =============================\n\n /// @notice Rounds an `epoch` timestamp to the start of the corresponding period\n function _getRoundedEpoch(uint32 epoch) internal pure returns (uint32) {\n return (epoch / EPOCH_DURATION) * EPOCH_DURATION;\n }\n\n /// @notice Checks whether `distribution` was live between `roundedEpochStart` and `roundedEpochEnd`\n function _isDistributionLiveBetweenEpochs(\n DistributionParameters memory distribution,\n uint32 roundedEpochStart,\n uint32 roundedEpochEnd\n ) internal pure returns (bool) {\n uint256 distributionEpochStart = distribution.epochStart;\n return (distributionEpochStart + distribution.numEpoch * EPOCH_DURATION > roundedEpochStart &&\n distributionEpochStart < roundedEpochEnd);\n }\n\n /// @notice Fetches data for `token` on the Uniswap `pool`\n function _getUniswapTokenData(\n IERC20Metadata token,\n address pool\n ) internal view returns (UniswapTokenData memory data) {\n data.add = address(token);\n data.decimals = token.decimals();\n data.symbol = token.symbol();\n data.poolBalance = token.balanceOf(pool);\n }\n\n /// @notice Fetches extra data about the parameters in a distribution\n function getExtensiveDistributionParameters(\n DistributionParameters memory distribution\n ) external view returns (ExtensiveDistributionParameters memory extensiveParams) {\n extensiveParams.base = distribution;\n try IUniswapV3Pool(distribution.uniV3Pool).fee() returns (uint24 fee) {\n extensiveParams.poolFee = fee;\n } catch {\n extensiveParams.poolFee = 0;\n }\n extensiveParams.token0 = _getUniswapTokenData(\n IERC20Metadata(IUniswapV3Pool(distribution.uniV3Pool).token0()),\n distribution.uniV3Pool\n );\n extensiveParams.token1 = _getUniswapTokenData(\n IERC20Metadata(IUniswapV3Pool(distribution.uniV3Pool).token1()),\n distribution.uniV3Pool\n );\n extensiveParams.rewardTokenSymbol = IERC20Metadata(distribution.rewardToken).symbol();\n extensiveParams.rewardTokenDecimals = IERC20Metadata(distribution.rewardToken).decimals();\n }\n\n /// @notice Tries to fetch extra data about the parameters in a distribution\n function tryGetExtensiveDistributionParameters(\n DistributionParameters memory distribution\n ) external returns (bool success, ExtensiveDistributionParameters memory extensiveParams) {\n (bool callSuccess, bytes memory returndata) = address(this).delegatecall(\n abi.encodeWithSelector(DistributionCreator.getExtensiveDistributionParameters.selector, distribution)\n );\n success = callSuccess;\n if (success) {\n extensiveParams = abi.decode(returndata, (ExtensiveDistributionParameters));\n }\n return (success, extensiveParams);\n }\n\n /// @notice Gets the list of all the distributions for `uniV3Pool` that have been active between `epochStart` and `epochEnd` (excluded)\n /// @dev If the `uniV3Pool` parameter is equal to 0, then this function will return the distributions for all pools\n function _getPoolDistributionsBetweenEpochs(\n address uniV3Pool,\n uint32 epochStart,\n uint32 epochEnd,\n uint32 skip,\n uint32 first\n ) internal view returns (ExtensiveDistributionParameters[] memory, uint256) {\n uint256 length;\n uint256 distributionListLength = distributionList.length;\n uint256 returnSize = first > distributionListLength ? distributionListLength : first;\n ExtensiveDistributionParameters[] memory activeRewards = new ExtensiveDistributionParameters[](returnSize);\n uint32 i = skip;\n while (i < distributionListLength) {\n DistributionParameters memory distribution = distributionList[i];\n if (\n _isDistributionLiveBetweenEpochs(distribution, epochStart, epochEnd) &&\n (uniV3Pool == address(0) || distribution.uniV3Pool == uniV3Pool)\n ) {\n (bool success, ExtensiveDistributionParameters memory extensiveParams) = IDistributionCreator(\n address(this)\n ).tryGetExtensiveDistributionParameters(distribution);\n if (success) {\n activeRewards[length] = extensiveParams;\n length += 1;\n }\n }\n unchecked {\n ++i;\n }\n if (length == returnSize) break;\n }\n assembly {\n mstore(activeRewards, length)\n }\n return (activeRewards, i);\n }\n}\n" + }, + "contracts/Distributor.sol": { + "content": "// SPDX-License-Identifier: BUSL-1.1\n\n/*\n * █ \n ***** ▓▓▓ \n * ▓▓▓▓▓▓▓ \n * ///. ▓▓▓▓▓▓▓▓▓▓▓▓▓ \n ***** //////// ▓▓▓▓▓▓▓ \n * ///////////// ▓▓▓ \n ▓▓ ////////////////// █ ▓▓ \n ▓▓ ▓▓ /////////////////////// ▓▓ ▓▓ \n ▓▓ ▓▓ //////////////////////////// ▓▓ ▓▓ \n ▓▓ ▓▓ /////////▓▓▓///////▓▓▓///////// ▓▓ ▓▓ \n ▓▓ ,////////////////////////////////////// ▓▓ ▓▓ \n ▓▓ ////////////////////////////////////////// ▓▓ \n ▓▓ //////////////////////▓▓▓▓///////////////////// \n ,//////////////////////////////////////////////////// \n .////////////////////////////////////////////////////////// \n .//////////////////////////██.,//////////////////////////█ \n .//////////////////////████..,./////////////////////██ \n ...////////////////███████.....,.////////////////███ \n ,.,////////////████████ ........,///////////████ \n .,.,//////█████████ ,.......///////████ \n ,..//████████ ........./████ \n ..,██████ .....,███ \n .██ ,.,█ \n \n \n \n ▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓ ▓▓▓▓▓▓▓▓▓▓ \n ▓▓▓▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓ ▓▓ ▓▓▓▓ \n ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓ ▓▓▓▓▓ \n ▓▓▓ ▓▓ ▓▓▓ ▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ \n*/\n\npragma solidity ^0.8.17;\n\nimport { IERC20 } from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport { SafeERC20 } from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport { SafeCast } from \"@openzeppelin/contracts/utils/math/SafeCast.sol\";\n\nimport \"./utils/UUPSHelper.sol\";\n\nstruct MerkleTree {\n // Root of a Merkle tree which leaves are `(address user, address token, uint amount)`\n // representing an amount of tokens accumulated by `user`.\n // The Merkle tree is assumed to have only increasing amounts: that is to say if a user can claim 1,\n // then after the amount associated in the Merkle tree for this token should be x > 1\n bytes32 merkleRoot;\n // Ipfs hash of the tree data\n bytes32 ipfsHash;\n}\n\nstruct Claim {\n uint208 amount;\n uint48 timestamp;\n bytes32 merkleRoot;\n}\n\n/// @title Distributor\n/// @notice Allows LPs on AMMs with concentrated liquidity to claim the rewards that were distributed to them\n/// @author Angle Labs. Inc\ncontract Distributor is UUPSHelper {\n using SafeERC20 for IERC20;\n\n /// @notice Epoch duration\n uint32 internal constant _EPOCH_DURATION = 3600;\n\n // ================================= VARIABLES =================================\n\n /// @notice Tree of claimable tokens through this contract\n MerkleTree public tree;\n\n /// @notice Tree that was in place in the contract before the last `tree` update\n MerkleTree public lastTree;\n\n /// @notice Token to deposit to freeze the roots update\n IERC20 public disputeToken;\n\n /// @notice `Core` contract handling access control\n ICore public core;\n\n /// @notice Address which created the dispute\n /// @dev Used to store if there is an ongoing dispute\n address public disputer;\n\n /// @notice When the current tree will become valid\n uint48 public endOfDisputePeriod;\n\n /// @notice Time after which a change in a tree becomes effective, in EPOCH_DURATION\n uint48 public disputePeriod;\n\n /// @notice Amount to deposit to freeze the roots update\n uint256 public disputeAmount;\n\n /// @notice Mapping user -> token -> amount to track claimed amounts\n mapping(address => mapping(address => Claim)) public claimed;\n\n /// @notice Trusted EOAs to update the Merkle root\n mapping(address => uint256) public canUpdateMerkleRoot;\n\n /// @notice Whether or not to disable permissionless claiming\n mapping(address => uint256) public onlyOperatorCanClaim;\n\n /// @notice user -> operator -> authorisation to claim\n mapping(address => mapping(address => uint256)) public operators;\n\n uint256[38] private __gap;\n\n // =================================== EVENTS ==================================\n\n event Claimed(address indexed user, address indexed token, uint256 amount);\n event DisputeAmountUpdated(uint256 _disputeAmount);\n event Disputed(string reason);\n event DisputePeriodUpdated(uint48 _disputePeriod);\n event DisputeResolved(bool valid);\n event DisputeTokenUpdated(address indexed _disputeToken);\n event OperatorClaimingToggled(address indexed user, bool isEnabled);\n event OperatorToggled(address indexed user, address indexed operator, bool isWhitelisted);\n event Recovered(address indexed token, address indexed to, uint256 amount);\n event Revoked(); // With this event an indexer could maintain a table (timestamp, merkleRootUpdate)\n event TreeUpdated(bytes32 merkleRoot, bytes32 ipfsHash, uint48 endOfDisputePeriod);\n event TrustedToggled(address indexed eoa, bool trust);\n\n // ================================= MODIFIERS =================================\n\n /// @notice Checks whether the `msg.sender` has the governor role or the guardian role\n modifier onlyGovernorOrGuardian() {\n if (!core.isGovernorOrGuardian(msg.sender)) revert NotGovernorOrGuardian();\n _;\n }\n\n /// @notice Checks whether the `msg.sender` is the `user` address or is a trusted address\n modifier onlyTrustedOrUser(address user) {\n if (user != msg.sender && canUpdateMerkleRoot[msg.sender] != 1 && !core.isGovernorOrGuardian(msg.sender))\n revert NotTrusted();\n _;\n }\n\n // ================================ CONSTRUCTOR ================================\n\n constructor() initializer {}\n\n function initialize(ICore _core) external initializer {\n if (address(_core) == address(0)) revert ZeroAddress();\n core = _core;\n }\n\n /// @inheritdoc UUPSUpgradeable\n function _authorizeUpgrade(address) internal view override onlyGuardianUpgrader(core) {}\n\n // =============================== MAIN FUNCTION ===============================\n\n /// @notice Claims rewards for a given set of users\n /// @dev Anyone may call this function for anyone else, funds go to destination regardless, it's just a question of\n /// who provides the proof and pays the gas: `msg.sender` is used only for addresses that require a trusted operator\n /// @param users Recipient of tokens\n /// @param tokens ERC20 claimed\n /// @param amounts Amount of tokens that will be sent to the corresponding users\n /// @param proofs Array of hashes bridging from a leaf `(hash of user | token | amount)` to the Merkle root\n function claim(\n address[] calldata users,\n address[] calldata tokens,\n uint256[] calldata amounts,\n bytes32[][] calldata proofs\n ) external {\n uint256 usersLength = users.length;\n if (\n usersLength == 0 ||\n usersLength != tokens.length ||\n usersLength != amounts.length ||\n usersLength != proofs.length\n ) revert InvalidLengths();\n\n for (uint256 i; i < usersLength; ) {\n address user = users[i];\n address token = tokens[i];\n uint256 amount = amounts[i];\n\n // Checking if only an approved operator can claim for `user`\n if (onlyOperatorCanClaim[user] == 1 && operators[user][msg.sender] == 0) revert NotWhitelisted();\n\n // Verifying proof\n bytes32 leaf = keccak256(abi.encode(user, token, amount));\n if (!_verifyProof(leaf, proofs[i])) revert InvalidProof();\n\n // Closing reentrancy gate here\n uint256 toSend = amount - claimed[user][token].amount;\n claimed[user][token] = Claim(SafeCast.toUint208(amount), uint48(block.timestamp), getMerkleRoot());\n\n IERC20(token).safeTransfer(user, toSend);\n emit Claimed(user, token, toSend);\n unchecked {\n ++i;\n }\n }\n }\n\n /// @notice Returns the MerkleRoot that is currently live for the contract\n function getMerkleRoot() public view returns (bytes32) {\n if (block.timestamp >= endOfDisputePeriod && disputer == address(0)) return tree.merkleRoot;\n else return lastTree.merkleRoot;\n }\n\n // ============================ GOVERNANCE FUNCTIONS ===========================\n\n /// @notice Adds or removes EOAs which are trusted to update the Merkle root\n function toggleTrusted(address eoa) external onlyGovernorOrGuardian {\n uint256 trustedStatus = 1 - canUpdateMerkleRoot[eoa];\n canUpdateMerkleRoot[eoa] = trustedStatus;\n emit TrustedToggled(eoa, trustedStatus == 1);\n }\n\n /// @notice Updates Merkle Tree\n function updateTree(MerkleTree calldata _tree) external {\n if (\n disputer != address(0) ||\n // A trusted address cannot update a tree right after a precedent tree update otherwise it can de facto\n // validate a tree which has not passed the dispute period\n ((canUpdateMerkleRoot[msg.sender] != 1 || block.timestamp < endOfDisputePeriod) &&\n !core.isGovernorOrGuardian(msg.sender))\n ) revert NotTrusted();\n MerkleTree memory _lastTree = tree;\n tree = _tree;\n lastTree = _lastTree;\n\n uint48 _endOfPeriod = _endOfDisputePeriod(uint48(block.timestamp));\n endOfDisputePeriod = _endOfPeriod;\n emit TreeUpdated(_tree.merkleRoot, _tree.ipfsHash, _endOfPeriod);\n }\n\n /// @notice Freezes the Merkle tree update until the dispute is resolved\n /// @dev Requires a deposit of `disputeToken` that'll be slashed if the dispute is not accepted\n /// @dev It is only possible to create a dispute within `disputePeriod` after each tree update\n function disputeTree(string memory reason) external {\n if (disputer != address(0)) revert UnresolvedDispute();\n if (block.timestamp >= endOfDisputePeriod) revert InvalidDispute();\n IERC20(disputeToken).safeTransferFrom(msg.sender, address(this), disputeAmount);\n disputer = msg.sender;\n emit Disputed(reason);\n }\n\n /// @notice Resolve the ongoing dispute, if any\n /// @param valid Whether the dispute was valid\n function resolveDispute(bool valid) external onlyGovernorOrGuardian {\n if (disputer == address(0)) revert NoDispute();\n if (valid) {\n IERC20(disputeToken).safeTransfer(disputer, disputeAmount);\n // If a dispute is valid, the contract falls back to the last tree that was updated\n _revokeTree();\n } else {\n IERC20(disputeToken).safeTransfer(msg.sender, disputeAmount);\n endOfDisputePeriod = _endOfDisputePeriod(uint48(block.timestamp));\n }\n disputer = address(0);\n emit DisputeResolved(valid);\n }\n\n /// @notice Allows the governor or the guardian of this contract to fallback to the last version of the tree\n /// immediately\n function revokeTree() external onlyGovernorOrGuardian {\n if (disputer != address(0)) revert UnresolvedDispute();\n _revokeTree();\n }\n\n /// @notice Toggles permissioned claiming for a given user\n function toggleOnlyOperatorCanClaim(address user) external onlyTrustedOrUser(user) {\n uint256 oldValue = onlyOperatorCanClaim[user];\n onlyOperatorCanClaim[user] = 1 - oldValue;\n emit OperatorClaimingToggled(user, oldValue == 0);\n }\n\n /// @notice Toggles whitelisting for a given user and a given operator\n function toggleOperator(address user, address operator) external onlyTrustedOrUser(user) {\n uint256 oldValue = operators[user][operator];\n operators[user][operator] = 1 - oldValue;\n emit OperatorToggled(user, operator, oldValue == 0);\n }\n\n /// @notice Recovers any ERC20 token\n function recoverERC20(address tokenAddress, address to, uint256 amountToRecover) external onlyGovernorOrGuardian {\n IERC20(tokenAddress).safeTransfer(to, amountToRecover);\n emit Recovered(tokenAddress, to, amountToRecover);\n }\n\n /// @notice Sets the dispute period after which a tree update becomes effective\n function setDisputePeriod(uint48 _disputePeriod) external onlyGovernorOrGuardian {\n disputePeriod = uint48(_disputePeriod);\n emit DisputePeriodUpdated(_disputePeriod);\n }\n\n /// @notice Sets the token used as a caution during disputes\n function setDisputeToken(IERC20 _disputeToken) external onlyGovernorOrGuardian {\n if (disputer != address(0)) revert UnresolvedDispute();\n disputeToken = _disputeToken;\n emit DisputeTokenUpdated(address(_disputeToken));\n }\n\n /// @notice Sets the amount of `disputeToken` used as a caution during disputes\n function setDisputeAmount(uint256 _disputeAmount) external onlyGovernorOrGuardian {\n if (disputer != address(0)) revert UnresolvedDispute();\n disputeAmount = _disputeAmount;\n emit DisputeAmountUpdated(_disputeAmount);\n }\n\n // ============================= INTERNAL FUNCTIONS ============================\n\n /// @notice Fallback to the last version of the tree\n function _revokeTree() internal {\n MerkleTree memory _tree = lastTree;\n endOfDisputePeriod = 0;\n tree = _tree;\n emit Revoked();\n emit TreeUpdated(\n _tree.merkleRoot,\n _tree.ipfsHash,\n (uint48(block.timestamp) / _EPOCH_DURATION) * (_EPOCH_DURATION) // Last hour\n );\n }\n\n /// @notice Returns the end of the dispute period\n /// @dev treeUpdate is rounded up to next hour and then `disputePeriod` hours are added\n function _endOfDisputePeriod(uint48 treeUpdate) internal view returns (uint48) {\n return ((treeUpdate - 1) / _EPOCH_DURATION + 1 + disputePeriod) * (_EPOCH_DURATION);\n }\n\n /// @notice Checks the validity of a proof\n /// @param leaf Hashed leaf data, the starting point of the proof\n /// @param proof Array of hashes forming a hash chain from leaf to root\n /// @return true If proof is correct, else false\n function _verifyProof(bytes32 leaf, bytes32[] memory proof) internal view returns (bool) {\n bytes32 currentHash = leaf;\n uint256 proofLength = proof.length;\n for (uint256 i; i < proofLength; ) {\n if (currentHash < proof[i]) {\n currentHash = keccak256(abi.encode(currentHash, proof[i]));\n } else {\n currentHash = keccak256(abi.encode(proof[i], currentHash));\n }\n unchecked {\n ++i;\n }\n }\n bytes32 root = getMerkleRoot();\n if (root == bytes32(0)) revert InvalidUninitializedRoot();\n return currentHash == root;\n }\n}\n" + }, + "contracts/interfaces/external/uniswap/IUniswapV3Pool.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity >=0.5.0;\n\n/// @title Pool state that never changes\n/// @notice These parameters are fixed for a pool forever, i.e., the methods will always return the same values\ninterface IUniswapV3Pool {\n /// @notice The first of the two tokens of the pool, sorted by address\n /// @return The token contract address\n function token0() external view returns (address);\n\n /// @notice The second of the two tokens of the pool, sorted by address\n /// @return The token contract address\n function token1() external view returns (address);\n\n /// @notice The pool's fee in hundredths of a bip, i.e. 1e-6\n /// @return The fee\n function fee() external view returns (uint24);\n}\n" + }, + "contracts/interfaces/IAgToken.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport { IERC20Upgradeable } from \"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\";\n\n/// @title IAgToken\n/// @author Angle Core Team\n/// @notice Interface for the stablecoins `AgToken` contracts\n/// @dev This interface only contains functions of the `AgToken` contract which are called by other contracts\n/// of this module or of the first module of the Angle Protocol\ninterface IAgToken is IERC20Upgradeable {\n // ======================= Minter Role Only Functions ===========================\n\n /// @notice Lets the `StableMaster` contract or another whitelisted contract mint agTokens\n /// @param account Address to mint to\n /// @param amount Amount to mint\n /// @dev The contracts allowed to issue agTokens are the `StableMaster` contract, `VaultManager` contracts\n /// associated to this stablecoin as well as the flash loan module (if activated) and potentially contracts\n /// whitelisted by governance\n function mint(address account, uint256 amount) external;\n\n /// @notice Burns `amount` tokens from a `burner` address after being asked to by `sender`\n /// @param amount Amount of tokens to burn\n /// @param burner Address to burn from\n /// @param sender Address which requested the burn from `burner`\n /// @dev This method is to be called by a contract with the minter right after being requested\n /// to do so by a `sender` address willing to burn tokens from another `burner` address\n /// @dev The method checks the allowance between the `sender` and the `burner`\n function burnFrom(uint256 amount, address burner, address sender) external;\n\n /// @notice Burns `amount` tokens from a `burner` address\n /// @param amount Amount of tokens to burn\n /// @param burner Address to burn from\n /// @dev This method is to be called by a contract with a minter right on the AgToken after being\n /// requested to do so by an address willing to burn tokens from its address\n function burnSelf(uint256 amount, address burner) external;\n\n // ========================= Treasury Only Functions ===========================\n\n /// @notice Adds a minter in the contract\n /// @param minter Minter address to add\n /// @dev Zero address checks are performed directly in the `Treasury` contract\n function addMinter(address minter) external;\n\n /// @notice Removes a minter from the contract\n /// @param minter Minter address to remove\n /// @dev This function can also be called by a minter wishing to revoke itself\n function removeMinter(address minter) external;\n\n /// @notice Sets a new treasury contract\n /// @param _treasury New treasury address\n function setTreasury(address _treasury) external;\n\n // ========================= External functions ================================\n\n /// @notice Checks whether an address has the right to mint agTokens\n /// @param minter Address for which the minting right should be checked\n /// @return Whether the address has the right to mint agTokens or not\n function isMinter(address minter) external view returns (bool);\n}\n" + }, + "contracts/interfaces/ICore.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\n/// @title ICore\n/// @author Angle Labs, Inc.\n/// @notice Interface for the `Core` contracts of smart contract modules used in Angle Labs contracts\ninterface ICore {\n /// @notice Checks whether an address is governor\n /// @param admin Address to check\n /// @return Whether the address has the `GOVERNOR_ROLE` or not\n function isGovernor(address admin) external view returns (bool);\n\n /// @notice Checks whether an address is a governor or a guardian of a module\n /// @param admin Address to check\n /// @return Whether the address has the `GUARDIAN_ROLE` or not\n /// @dev Governance should make sure when adding a governor to also give this governor the guardian\n /// role by calling the `addGovernor` function\n function isGovernorOrGuardian(address admin) external view returns (bool);\n}\n" + }, + "contracts/interfaces/ITreasury.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport { IAgToken } from \"./IAgToken.sol\";\nimport { ICore } from \"./ICore.sol\";\n\n/// @title ITreasury\n/// @author Angle Core Team\n/// @notice Interface for the `Treasury` contract\n/// @dev This interface only contains functions of the `Treasury` which are called by other contracts\n/// of this module\ninterface ITreasury {\n /// @notice Stablecoin handled by this `treasury` contract\n function stablecoin() external view returns (IAgToken);\n\n /// @notice Checks whether a given address has the governor role\n /// @param admin Address to check\n /// @return Whether the address has the governor role\n /// @dev Access control is only kept in the `CoreBorrow` contract\n function isGovernor(address admin) external view returns (bool);\n\n /// @notice Checks whether a given address has the guardian or the governor role\n /// @param admin Address to check\n /// @return Whether the address has the guardian or the governor role\n /// @dev Access control is only kept in the `CoreBorrow` contract which means that this function\n /// queries the `CoreBorrow` contract\n function isGovernorOrGuardian(address admin) external view returns (bool);\n}\n" + }, + "contracts/middleman/MerklGaugeMiddleman.sol": { + "content": "// SPDX-License-Identifier: BUSL-1.1\n\n/*\n * █ \n ***** ▓▓▓ \n * ▓▓▓▓▓▓▓ \n * ///. ▓▓▓▓▓▓▓▓▓▓▓▓▓ \n ***** //////// ▓▓▓▓▓▓▓ \n * ///////////// ▓▓▓ \n ▓▓ ////////////////// █ ▓▓ \n ▓▓ ▓▓ /////////////////////// ▓▓ ▓▓ \n ▓▓ ▓▓ //////////////////////////// ▓▓ ▓▓ \n ▓▓ ▓▓ /////////▓▓▓///////▓▓▓///////// ▓▓ ▓▓ \n ▓▓ ,////////////////////////////////////// ▓▓ ▓▓ \n ▓▓ ////////////////////////////////////////// ▓▓ \n ▓▓ //////////////////////▓▓▓▓///////////////////// \n ,//////////////////////////////////////////////////// \n .////////////////////////////////////////////////////////// \n .//////////////////////////██.,//////////////////////////█ \n .//////////////////////████..,./////////////////////██ \n ...////////////////███████.....,.////////////////███ \n ,.,////////////████████ ........,///////////████ \n .,.,//////█████████ ,.......///////████ \n ,..//████████ ........./████ \n ..,██████ .....,███ \n .██ ,.,█ \n \n \n \n ▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓ ▓▓▓▓▓▓▓▓▓▓ \n ▓▓▓▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓ ▓▓ ▓▓▓▓ \n ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓ ▓▓▓▓▓ \n ▓▓▓ ▓▓ ▓▓▓ ▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ \n*/\n\npragma solidity ^0.8.17;\n\nimport { IERC20 } from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport { SafeERC20 } from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\n\nimport \"../DistributionCreator.sol\";\n\n/// @title MerklGaugeMiddleman\n/// @author Angle Labs, Inc.\n/// @notice Manages the transfer of ANGLE rewards to the `DistributionCreator` contract\n/// @dev This contract is built under the assumption that the `DistributionCreator` contract has already whitelisted\n/// this contract for it to distribute rewards without having to sign a message\n/// @dev Transient funds left in this contract after a call may be exploited\ncontract MerklGaugeMiddleman {\n using SafeERC20 for IERC20;\n\n // ================================= PARAMETERS ================================\n\n /// @notice Contract handling access control\n ICore public accessControlManager;\n\n /// @notice Maps a gauge to its reward parameters\n mapping(address => DistributionParameters) public gaugeParams;\n\n // =================================== EVENT ===================================\n\n event GaugeSet(address indexed gauge);\n\n constructor(ICore _accessControlManager) {\n if (address(_accessControlManager) == address(0)) revert ZeroAddress();\n accessControlManager = _accessControlManager;\n IERC20 _angle = angle();\n // Condition left here for testing purposes\n if (address(_angle) != address(0))\n _angle.safeIncreaseAllowance(address(merklDistributionCreator()), type(uint256).max);\n }\n\n // ================================= REFERENCES ================================\n\n /// @notice Address of the ANGLE token\n function angle() public view virtual returns (IERC20) {\n return IERC20(0x31429d1856aD1377A8A0079410B297e1a9e214c2);\n }\n\n /// @notice Address of the Merkl contract managing rewards to be distributed\n /// @dev Address is the same across the different chains on which it is deployed\n function merklDistributionCreator() public view virtual returns (DistributionCreator) {\n return DistributionCreator(0x8BB4C975Ff3c250e0ceEA271728547f3802B36Fd);\n }\n\n // ============================= EXTERNAL FUNCTIONS ============================\n\n /// @notice Restores the allowance for the ANGLE token to the `DistributionCreator` contract\n function setAngleAllowance() external {\n IERC20 _angle = angle();\n address manager = address(merklDistributionCreator());\n uint256 currentAllowance = _angle.allowance(address(this), manager);\n if (currentAllowance < type(uint256).max)\n _angle.safeIncreaseAllowance(manager, type(uint256).max - currentAllowance);\n }\n\n /// @notice Specifies the reward distribution parameters for `gauge`\n function setGauge(address gauge, DistributionParameters memory params) external {\n if (!accessControlManager.isGovernorOrGuardian(msg.sender)) revert NotGovernorOrGuardian();\n DistributionCreator manager = merklDistributionCreator();\n if (\n gauge == address(0) ||\n params.rewardToken != address(angle()) ||\n (manager.isWhitelistedToken(IUniswapV3Pool(params.uniV3Pool).token0()) == 0 &&\n manager.isWhitelistedToken(IUniswapV3Pool(params.uniV3Pool).token1()) == 0)\n ) revert InvalidParams();\n gaugeParams[gauge] = params;\n emit GaugeSet(gauge);\n }\n\n /// @notice Transmits rewards from the `AngleDistributor` to the `DistributionCreator` with the correct\n /// parameters\n /// @dev Callable by any contract\n /// @dev This method can be used to recover leftover ANGLE tokens in the contract\n function notifyReward(address gauge, uint256 amount) public {\n DistributionParameters memory params = gaugeParams[gauge];\n if (params.uniV3Pool == address(0)) revert InvalidParams();\n if (amount == 0) amount = angle().balanceOf(address(this));\n params.epochStart = uint32(block.timestamp);\n params.amount = amount;\n DistributionCreator creator = merklDistributionCreator();\n if (amount > 0) {\n // Need to deal with minimum distribution amounts\n if (amount > creator.rewardTokenMinAmounts(address(angle())) * params.numEpoch) {\n merklDistributionCreator().createDistribution(params);\n } else {\n // Sending leftover ANGLE tokens to the `msg.sender`\n angle().safeTransfer(msg.sender, amount);\n }\n }\n }\n\n /// @notice Fetches tokens and transmits rewards in the same transaction\n function notifyRewardWithTransfer(address gauge, uint256 amount) external {\n angle().safeTransferFrom(msg.sender, address(this), amount);\n notifyReward(gauge, amount);\n }\n}\n" + }, + "contracts/middleman/MerklGaugeMiddlemanPolygon.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"./MerklGaugeMiddleman.sol\";\n\n/// @title MerklGaugeMiddlemanPolygon\n/// @author Angle Labs, Inc.\ncontract MerklGaugeMiddlemanPolygon is MerklGaugeMiddleman {\n constructor(ICore _accessControlManager) MerklGaugeMiddleman(_accessControlManager) {}\n\n function angle() public pure override returns (IERC20) {\n return IERC20(0x900F717EA076E1E7a484ad9DD2dB81CEEc60eBF1);\n }\n}\n" + }, + "contracts/mock/MockMerklGaugeMiddleman.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"../middleman/MerklGaugeMiddleman.sol\";\n\ncontract MockMerklGaugeMiddleman is MerklGaugeMiddleman {\n address public angleDistributorAddress;\n IERC20 public angleAddress;\n DistributionCreator public manager;\n\n constructor(ICore _coreBorrow) MerklGaugeMiddleman(_coreBorrow) {}\n\n function angle() public view override returns (IERC20) {\n return angleAddress;\n }\n\n function merklDistributionCreator() public view override returns (DistributionCreator) {\n return manager;\n }\n\n function setAddresses(\n address _angleDistributorAddress,\n IERC20 _angleAddress,\n DistributionCreator _manager\n ) external {\n angleDistributorAddress = _angleDistributorAddress;\n angleAddress = _angleAddress;\n manager = _manager;\n }\n}\n" + }, + "contracts/struct/DistributionParameters.sol": { + "content": "// SPDX-License-Identifier: BUSL-1.1\n\npragma solidity ^0.8.17;\n\nstruct DistributionParameters {\n // ID of the reward (populated once created)\n bytes32 rewardId;\n // Address of the UniswapV3 pool that needs to be incentivized\n address uniV3Pool;\n // Address of the reward token for the incentives\n address rewardToken;\n // Amount of `rewardToken` to distribute across all the epochs\n // Amount distributed per epoch is `amount/numEpoch`\n uint256 amount;\n // List of all position wrappers to consider or not for this contract. Some wrappers like Gamma or Arrakis\n // are automatically detected and so there is no need to specify them here. Check out the docs to find out\n // which need to be specified and which are not automatically detected.\n address[] positionWrappers;\n // Type (Arrakis, Gamma, Blacklist, ...) encoded as a `uint32` for each wrapper in the list above. Mapping between\n // wrapper types and their corresponding `uint32` value can be found in Angle Docs\n uint32[] wrapperTypes;\n // In the incentivization formula, how much of the fees should go to holders of token0\n // in base 10**4\n uint32 propToken0;\n // Proportion for holding token1 (in base 10**4)\n uint32 propToken1;\n // Proportion for providing a useful liquidity (in base 10**4) that generates fees\n uint32 propFees;\n // Timestamp at which the incentivization should start\n uint32 epochStart;\n // Amount of epochs for which incentivization should last\n uint32 numEpoch;\n // Whether out of range liquidity should still be incentivized or not\n // This should be equal to 1 if out of range liquidity should still be incentivized\n // and 0 otherwise\n uint32 isOutOfRangeIncentivized;\n // How much more addresses with a maximum boost can get with respect to addresses\n // which do not have a boost (in base 4). In the case of Curve where addresses get 2.5x more\n // this would be 25000\n uint32 boostedReward;\n // Address of the token which dictates who gets boosted rewards or not. This is optional\n // and if the zero address is given no boost will be taken into account\n address boostingAddress;\n // Additional data passed when distributing rewards. This parameter may be used in case\n // the reward distribution script needs to look into other parameters beyond the ones above.\n bytes additionalData;\n}\n" + }, + "contracts/struct/ExtensiveDistributionParameters.sol": { + "content": "// SPDX-License-Identifier: BUSL-1.1\n\npragma solidity ^0.8.17;\n\nimport { DistributionParameters } from \"./DistributionParameters.sol\";\n\nstruct UniswapTokenData {\n address add;\n uint8 decimals;\n string symbol;\n uint256 poolBalance;\n}\n\nstruct ExtensiveDistributionParameters {\n DistributionParameters base;\n // Uniswap pool data\n uint24 poolFee;\n UniswapTokenData token0;\n UniswapTokenData token1;\n // rewardToken data\n string rewardTokenSymbol;\n uint8 rewardTokenDecimals;\n}\n" + }, + "contracts/struct/RewardTokenAmounts.sol": { + "content": "// SPDX-License-Identifier: BUSL-1.1\n\npragma solidity ^0.8.17;\n\nstruct RewardTokenAmounts {\n address token;\n uint256 minimumAmountPerEpoch;\n}\n" + }, + "contracts/utils/Errors.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nerror InvalidDispute();\nerror InvalidLengths();\nerror InvalidParam();\nerror InvalidParams();\nerror InvalidProof();\nerror InvalidUninitializedRoot();\nerror InvalidReward();\nerror InvalidSignature();\nerror NoDispute();\nerror NotGovernor();\nerror NotGovernorOrGuardian();\nerror NotSigned();\nerror NotTrusted();\nerror NotWhitelisted();\nerror UnresolvedDispute();\nerror ZeroAddress();\n" + }, + "contracts/utils/UUPSHelper.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\n/*\n * █ \n ***** ▓▓▓ \n * ▓▓▓▓▓▓▓ \n * ///. ▓▓▓▓▓▓▓▓▓▓▓▓▓ \n ***** //////// ▓▓▓▓▓▓▓ \n * ///////////// ▓▓▓ \n ▓▓ ////////////////// █ ▓▓ \n ▓▓ ▓▓ /////////////////////// ▓▓ ▓▓ \n ▓▓ ▓▓ //////////////////////////// ▓▓ ▓▓ \n ▓▓ ▓▓ /////////▓▓▓///////▓▓▓///////// ▓▓ ▓▓ \n ▓▓ ,////////////////////////////////////// ▓▓ ▓▓ \n ▓▓ ////////////////////////////////////////// ▓▓ \n ▓▓ //////////////////////▓▓▓▓///////////////////// \n ,//////////////////////////////////////////////////// \n .////////////////////////////////////////////////////////// \n .//////////////////////////██.,//////////////////////////█ \n .//////////////////////████..,./////////////////////██ \n ...////////////////███████.....,.////////////////███ \n ,.,////////////████████ ........,///////////████ \n .,.,//////█████████ ,.......///////████ \n ,..//████████ ........./████ \n ..,██████ .....,███ \n .██ ,.,█ \n \n \n \n ▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓ ▓▓▓▓▓▓▓▓▓▓ \n ▓▓▓▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓ ▓▓ ▓▓▓▓ \n ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓ ▓▓▓▓▓ \n ▓▓▓ ▓▓ ▓▓▓ ▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ \n*/\n\npragma solidity ^0.8.17;\n\nimport { UUPSUpgradeable } from \"@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol\";\n\nimport { ICore } from \"../interfaces/ICore.sol\";\nimport \"../utils/Errors.sol\";\n\n/// @title UUPSHelper\n/// @notice Helper contract for UUPSUpgradeable contracts where the upgradeability is controlled by a specific address\n/// @author Angle Labs., Inc\n/// @dev The 0 address check in the modifier allows the use of these modifiers during initialization\nabstract contract UUPSHelper is UUPSUpgradeable {\n modifier onlyGuardianUpgrader(ICore _core) {\n if (address(_core) != address(0) && !_core.isGovernorOrGuardian(msg.sender)) revert NotGovernorOrGuardian();\n _;\n }\n\n modifier onlyGovernorUpgrader(ICore _core) {\n if (address(_core) != address(0) && !_core.isGovernor(msg.sender)) revert NotGovernor();\n _;\n }\n\n constructor() initializer {}\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 100000 + }, + "viaIR": false, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + } + } +} \ No newline at end of file diff --git a/deployments/coredao/solcInputs/69984a2380fa2fad0c3afbbb08b5652b.json b/deployments/coredao/solcInputs/69984a2380fa2fad0c3afbbb08b5652b.json new file mode 100644 index 0000000..a42b1be --- /dev/null +++ b/deployments/coredao/solcInputs/69984a2380fa2fad0c3afbbb08b5652b.json @@ -0,0 +1,98 @@ +{ + "language": "Solidity", + "sources": { + "@openzeppelin/contracts-upgradeable/interfaces/draft-IERC1822Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\n * proxy whose upgrades are fully controlled by the current implementation.\n */\ninterface IERC1822ProxiableUpgradeable {\n /**\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\n * address.\n *\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\n * function revert if invoked through a proxy.\n */\n function proxiableUUID() external view returns (bytes32);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/proxy/beacon/IBeaconUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\n */\ninterface IBeaconUpgradeable {\n /**\n * @dev Must return an address that can be used as a delegate call target.\n *\n * {BeaconProxy} will check that this address is a contract.\n */\n function implementation() external view returns (address);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/proxy/ERC1967/ERC1967UpgradeUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (proxy/ERC1967/ERC1967Upgrade.sol)\n\npragma solidity ^0.8.2;\n\nimport \"../beacon/IBeaconUpgradeable.sol\";\nimport \"../../interfaces/draft-IERC1822Upgradeable.sol\";\nimport \"../../utils/AddressUpgradeable.sol\";\nimport \"../../utils/StorageSlotUpgradeable.sol\";\nimport \"../utils/Initializable.sol\";\n\n/**\n * @dev This abstract contract provides getters and event emitting update functions for\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\n *\n * _Available since v4.1._\n *\n * @custom:oz-upgrades-unsafe-allow delegatecall\n */\nabstract contract ERC1967UpgradeUpgradeable is Initializable {\n function __ERC1967Upgrade_init() internal onlyInitializing {\n }\n\n function __ERC1967Upgrade_init_unchained() internal onlyInitializing {\n }\n // This is the keccak-256 hash of \"eip1967.proxy.rollback\" subtracted by 1\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\n\n /**\n * @dev Storage slot with the address of the current implementation.\n * This is the keccak-256 hash of \"eip1967.proxy.implementation\" subtracted by 1, and is\n * validated in the constructor.\n */\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n\n /**\n * @dev Emitted when the implementation is upgraded.\n */\n event Upgraded(address indexed implementation);\n\n /**\n * @dev Returns the current implementation address.\n */\n function _getImplementation() internal view returns (address) {\n return StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value;\n }\n\n /**\n * @dev Stores a new address in the EIP1967 implementation slot.\n */\n function _setImplementation(address newImplementation) private {\n require(AddressUpgradeable.isContract(newImplementation), \"ERC1967: new implementation is not a contract\");\n StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\n }\n\n /**\n * @dev Perform implementation upgrade\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeTo(address newImplementation) internal {\n _setImplementation(newImplementation);\n emit Upgraded(newImplementation);\n }\n\n /**\n * @dev Perform implementation upgrade with additional setup call.\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeToAndCall(\n address newImplementation,\n bytes memory data,\n bool forceCall\n ) internal {\n _upgradeTo(newImplementation);\n if (data.length > 0 || forceCall) {\n _functionDelegateCall(newImplementation, data);\n }\n }\n\n /**\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeToAndCallUUPS(\n address newImplementation,\n bytes memory data,\n bool forceCall\n ) internal {\n // Upgrades from old implementations will perform a rollback test. This test requires the new\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\n // this special case will break upgrade paths from old UUPS implementation to new ones.\n if (StorageSlotUpgradeable.getBooleanSlot(_ROLLBACK_SLOT).value) {\n _setImplementation(newImplementation);\n } else {\n try IERC1822ProxiableUpgradeable(newImplementation).proxiableUUID() returns (bytes32 slot) {\n require(slot == _IMPLEMENTATION_SLOT, \"ERC1967Upgrade: unsupported proxiableUUID\");\n } catch {\n revert(\"ERC1967Upgrade: new implementation is not UUPS\");\n }\n _upgradeToAndCall(newImplementation, data, forceCall);\n }\n }\n\n /**\n * @dev Storage slot with the admin of the contract.\n * This is the keccak-256 hash of \"eip1967.proxy.admin\" subtracted by 1, and is\n * validated in the constructor.\n */\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\n\n /**\n * @dev Emitted when the admin account has changed.\n */\n event AdminChanged(address previousAdmin, address newAdmin);\n\n /**\n * @dev Returns the current admin.\n */\n function _getAdmin() internal view returns (address) {\n return StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value;\n }\n\n /**\n * @dev Stores a new address in the EIP1967 admin slot.\n */\n function _setAdmin(address newAdmin) private {\n require(newAdmin != address(0), \"ERC1967: new admin is the zero address\");\n StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\n }\n\n /**\n * @dev Changes the admin of the proxy.\n *\n * Emits an {AdminChanged} event.\n */\n function _changeAdmin(address newAdmin) internal {\n emit AdminChanged(_getAdmin(), newAdmin);\n _setAdmin(newAdmin);\n }\n\n /**\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\n */\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\n\n /**\n * @dev Emitted when the beacon is upgraded.\n */\n event BeaconUpgraded(address indexed beacon);\n\n /**\n * @dev Returns the current beacon.\n */\n function _getBeacon() internal view returns (address) {\n return StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value;\n }\n\n /**\n * @dev Stores a new beacon in the EIP1967 beacon slot.\n */\n function _setBeacon(address newBeacon) private {\n require(AddressUpgradeable.isContract(newBeacon), \"ERC1967: new beacon is not a contract\");\n require(\n AddressUpgradeable.isContract(IBeaconUpgradeable(newBeacon).implementation()),\n \"ERC1967: beacon implementation is not a contract\"\n );\n StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value = newBeacon;\n }\n\n /**\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\n *\n * Emits a {BeaconUpgraded} event.\n */\n function _upgradeBeaconToAndCall(\n address newBeacon,\n bytes memory data,\n bool forceCall\n ) internal {\n _setBeacon(newBeacon);\n emit BeaconUpgraded(newBeacon);\n if (data.length > 0 || forceCall) {\n _functionDelegateCall(IBeaconUpgradeable(newBeacon).implementation(), data);\n }\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function _functionDelegateCall(address target, bytes memory data) private returns (bytes memory) {\n require(AddressUpgradeable.isContract(target), \"Address: delegate call to non-contract\");\n\n // solhint-disable-next-line avoid-low-level-calls\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return AddressUpgradeable.verifyCallResult(success, returndata, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.1) (proxy/utils/Initializable.sol)\n\npragma solidity ^0.8.2;\n\nimport \"../../utils/AddressUpgradeable.sol\";\n\n/**\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\n *\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\n * reused. This mechanism prevents re-execution of each \"step\" but allows the creation of new initialization steps in\n * case an upgrade adds a module that needs to be initialized.\n *\n * For example:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * contract MyToken is ERC20Upgradeable {\n * function initialize() initializer public {\n * __ERC20_init(\"MyToken\", \"MTK\");\n * }\n * }\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\n * function initializeV2() reinitializer(2) public {\n * __ERC20Permit_init(\"MyToken\");\n * }\n * }\n * ```\n *\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\n *\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\n *\n * [CAUTION]\n * ====\n * Avoid leaving a contract uninitialized.\n *\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * /// @custom:oz-upgrades-unsafe-allow constructor\n * constructor() {\n * _disableInitializers();\n * }\n * ```\n * ====\n */\nabstract contract Initializable {\n /**\n * @dev Indicates that the contract has been initialized.\n * @custom:oz-retyped-from bool\n */\n uint8 private _initialized;\n\n /**\n * @dev Indicates that the contract is in the process of being initialized.\n */\n bool private _initializing;\n\n /**\n * @dev Triggered when the contract has been initialized or reinitialized.\n */\n event Initialized(uint8 version);\n\n /**\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\n * `onlyInitializing` functions can be used to initialize parent contracts.\n *\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\n * constructor.\n *\n * Emits an {Initialized} event.\n */\n modifier initializer() {\n bool isTopLevelCall = !_initializing;\n require(\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\n \"Initializable: contract is already initialized\"\n );\n _initialized = 1;\n if (isTopLevelCall) {\n _initializing = true;\n }\n _;\n if (isTopLevelCall) {\n _initializing = false;\n emit Initialized(1);\n }\n }\n\n /**\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\n * used to initialize parent contracts.\n *\n * A reinitializer may be used after the original initialization step. This is essential to configure modules that\n * are added through upgrades and that require initialization.\n *\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\n * cannot be nested. If one is invoked in the context of another, execution will revert.\n *\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\n * a contract, executing them in the right order is up to the developer or operator.\n *\n * WARNING: setting the version to 255 will prevent any future reinitialization.\n *\n * Emits an {Initialized} event.\n */\n modifier reinitializer(uint8 version) {\n require(!_initializing && _initialized < version, \"Initializable: contract is already initialized\");\n _initialized = version;\n _initializing = true;\n _;\n _initializing = false;\n emit Initialized(version);\n }\n\n /**\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\n */\n modifier onlyInitializing() {\n require(_initializing, \"Initializable: contract is not initializing\");\n _;\n }\n\n /**\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\n * through proxies.\n *\n * Emits an {Initialized} event the first time it is successfully executed.\n */\n function _disableInitializers() internal virtual {\n require(!_initializing, \"Initializable: contract is initializing\");\n if (_initialized < type(uint8).max) {\n _initialized = type(uint8).max;\n emit Initialized(type(uint8).max);\n }\n }\n\n /**\n * @dev Returns the highest version that has been initialized. See {reinitializer}.\n */\n function _getInitializedVersion() internal view returns (uint8) {\n return _initialized;\n }\n\n /**\n * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.\n */\n function _isInitializing() internal view returns (bool) {\n return _initializing;\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (proxy/utils/UUPSUpgradeable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../interfaces/draft-IERC1822Upgradeable.sol\";\nimport \"../ERC1967/ERC1967UpgradeUpgradeable.sol\";\nimport \"./Initializable.sol\";\n\n/**\n * @dev An upgradeability mechanism designed for UUPS proxies. The functions included here can perform an upgrade of an\n * {ERC1967Proxy}, when this contract is set as the implementation behind such a proxy.\n *\n * A security mechanism ensures that an upgrade does not turn off upgradeability accidentally, although this risk is\n * reinstated if the upgrade retains upgradeability but removes the security mechanism, e.g. by replacing\n * `UUPSUpgradeable` with a custom implementation of upgrades.\n *\n * The {_authorizeUpgrade} function must be overridden to include access restriction to the upgrade mechanism.\n *\n * _Available since v4.1._\n */\nabstract contract UUPSUpgradeable is Initializable, IERC1822ProxiableUpgradeable, ERC1967UpgradeUpgradeable {\n function __UUPSUpgradeable_init() internal onlyInitializing {\n }\n\n function __UUPSUpgradeable_init_unchained() internal onlyInitializing {\n }\n /// @custom:oz-upgrades-unsafe-allow state-variable-immutable state-variable-assignment\n address private immutable __self = address(this);\n\n /**\n * @dev Check that the execution is being performed through a delegatecall call and that the execution context is\n * a proxy contract with an implementation (as defined in ERC1967) pointing to self. This should only be the case\n * for UUPS and transparent proxies that are using the current contract as their implementation. Execution of a\n * function through ERC1167 minimal proxies (clones) would not normally pass this test, but is not guaranteed to\n * fail.\n */\n modifier onlyProxy() {\n require(address(this) != __self, \"Function must be called through delegatecall\");\n require(_getImplementation() == __self, \"Function must be called through active proxy\");\n _;\n }\n\n /**\n * @dev Check that the execution is not being performed through a delegate call. This allows a function to be\n * callable on the implementing contract but not through proxies.\n */\n modifier notDelegated() {\n require(address(this) == __self, \"UUPSUpgradeable: must not be called through delegatecall\");\n _;\n }\n\n /**\n * @dev Implementation of the ERC1822 {proxiableUUID} function. This returns the storage slot used by the\n * implementation. It is used to validate the implementation's compatibility when performing an upgrade.\n *\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\n * function revert if invoked through a proxy. This is guaranteed by the `notDelegated` modifier.\n */\n function proxiableUUID() external view virtual override notDelegated returns (bytes32) {\n return _IMPLEMENTATION_SLOT;\n }\n\n /**\n * @dev Upgrade the implementation of the proxy to `newImplementation`.\n *\n * Calls {_authorizeUpgrade}.\n *\n * Emits an {Upgraded} event.\n */\n function upgradeTo(address newImplementation) external virtual onlyProxy {\n _authorizeUpgrade(newImplementation);\n _upgradeToAndCallUUPS(newImplementation, new bytes(0), false);\n }\n\n /**\n * @dev Upgrade the implementation of the proxy to `newImplementation`, and subsequently execute the function call\n * encoded in `data`.\n *\n * Calls {_authorizeUpgrade}.\n *\n * Emits an {Upgraded} event.\n */\n function upgradeToAndCall(address newImplementation, bytes memory data) external payable virtual onlyProxy {\n _authorizeUpgrade(newImplementation);\n _upgradeToAndCallUUPS(newImplementation, data, true);\n }\n\n /**\n * @dev Function that should revert when `msg.sender` is not authorized to upgrade the contract. Called by\n * {upgradeTo} and {upgradeToAndCall}.\n *\n * Normally, this function will use an xref:access.adoc[access control] modifier such as {Ownable-onlyOwner}.\n *\n * ```solidity\n * function _authorizeUpgrade(address) internal override onlyOwner {}\n * ```\n */\n function _authorizeUpgrade(address newImplementation) internal virtual;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (security/ReentrancyGuard.sol)\n\npragma solidity ^0.8.0;\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Contract module that helps prevent reentrant calls to a function.\n *\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\n * available, which can be applied to functions to make sure there are no nested\n * (reentrant) calls to them.\n *\n * Note that because there is a single `nonReentrant` guard, functions marked as\n * `nonReentrant` may not call one another. This can be worked around by making\n * those functions `private`, and then adding `external` `nonReentrant` entry\n * points to them.\n *\n * TIP: If you would like to learn more about reentrancy and alternative ways\n * to protect against it, check out our blog post\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\n */\nabstract contract ReentrancyGuardUpgradeable is Initializable {\n // Booleans are more expensive than uint256 or any type that takes up a full\n // word because each write operation emits an extra SLOAD to first read the\n // slot's contents, replace the bits taken up by the boolean, and then write\n // back. This is the compiler's defense against contract upgrades and\n // pointer aliasing, and it cannot be disabled.\n\n // The values being non-zero value makes deployment a bit more expensive,\n // but in exchange the refund on every call to nonReentrant will be lower in\n // amount. Since refunds are capped to a percentage of the total\n // transaction's gas, it is best to keep them low in cases like this one, to\n // increase the likelihood of the full refund coming into effect.\n uint256 private constant _NOT_ENTERED = 1;\n uint256 private constant _ENTERED = 2;\n\n uint256 private _status;\n\n function __ReentrancyGuard_init() internal onlyInitializing {\n __ReentrancyGuard_init_unchained();\n }\n\n function __ReentrancyGuard_init_unchained() internal onlyInitializing {\n _status = _NOT_ENTERED;\n }\n\n /**\n * @dev Prevents a contract from calling itself, directly or indirectly.\n * Calling a `nonReentrant` function from another `nonReentrant`\n * function is not supported. It is possible to prevent this from happening\n * by making the `nonReentrant` function external, and making it call a\n * `private` function that does the actual work.\n */\n modifier nonReentrant() {\n _nonReentrantBefore();\n _;\n _nonReentrantAfter();\n }\n\n function _nonReentrantBefore() private {\n // On the first call to nonReentrant, _status will be _NOT_ENTERED\n require(_status != _ENTERED, \"ReentrancyGuard: reentrant call\");\n\n // Any calls to nonReentrant after this point will fail\n _status = _ENTERED;\n }\n\n function _nonReentrantAfter() private {\n // By storing the original value once again, a refund is triggered (see\n // https://eips.ethereum.org/EIPS/eip-2200)\n _status = _NOT_ENTERED;\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[49] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary AddressUpgradeable {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/StorageSlotUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/StorageSlot.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Library for reading and writing primitive types to specific storage slots.\n *\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\n * This library helps with reading and writing to such slots without the need for inline assembly.\n *\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\n *\n * Example usage to set ERC1967 implementation slot:\n * ```\n * contract ERC1967 {\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n *\n * function _getImplementation() internal view returns (address) {\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\n * }\n *\n * function _setImplementation(address newImplementation) internal {\n * require(Address.isContract(newImplementation), \"ERC1967: new implementation is not a contract\");\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\n * }\n * }\n * ```\n *\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\n */\nlibrary StorageSlotUpgradeable {\n struct AddressSlot {\n address value;\n }\n\n struct BooleanSlot {\n bool value;\n }\n\n struct Bytes32Slot {\n bytes32 value;\n }\n\n struct Uint256Slot {\n uint256 value;\n }\n\n /**\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\n */\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\n */\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\n */\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\n */\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n */\ninterface IERC20Permit {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also apply here.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `deadline` must be a timestamp in the future.\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\n * over the EIP712-formatted function arguments.\n * - the signature must use ``owner``'s current nonce (see {nonces}).\n *\n * For more information on the signature format, see the\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\n * section].\n */\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n\n /**\n * @dev Returns the current nonce for `owner`. This value must be\n * included whenever a signature is generated for {permit}.\n *\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\n * prevents a signature from being used multiple times.\n */\n function nonces(address owner) external view returns (uint256);\n\n /**\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\n */\n // solhint-disable-next-line func-name-mixedcase\n function DOMAIN_SEPARATOR() external view returns (bytes32);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20Metadata is IERC20 {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/IERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\nimport \"../extensions/draft-IERC20Permit.sol\";\nimport \"../../../utils/Address.sol\";\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n using Address for address;\n\n function safeTransfer(\n IERC20 token,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n function safeTransferFrom(\n IERC20 token,\n address from,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\n }\n\n /**\n * @dev Deprecated. This function has issues similar to the ones found in\n * {IERC20-approve}, and its usage is discouraged.\n *\n * Whenever possible, use {safeIncreaseAllowance} and\n * {safeDecreaseAllowance} instead.\n */\n function safeApprove(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n // safeApprove should only be called when setting an initial allowance,\n // or when resetting it to zero. To increase and decrease it, use\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\n require(\n (value == 0) || (token.allowance(address(this), spender) == 0),\n \"SafeERC20: approve from non-zero to non-zero allowance\"\n );\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\n }\n\n function safeIncreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n uint256 newAllowance = token.allowance(address(this), spender) + value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n\n function safeDecreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n unchecked {\n uint256 oldAllowance = token.allowance(address(this), spender);\n require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\n uint256 newAllowance = oldAllowance - value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n }\n\n function safePermit(\n IERC20Permit token,\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal {\n uint256 nonceBefore = token.nonces(owner);\n token.permit(owner, spender, value, deadline, v, r, s);\n uint256 nonceAfter = token.nonces(owner);\n require(nonceAfter == nonceBefore + 1, \"SafeERC20: permit did not succeed\");\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data, \"SafeERC20: low-level call failed\");\n if (returndata.length > 0) {\n // Return data is optional\n require(abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Address.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/cryptography/ECDSA.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/ECDSA.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../Strings.sol\";\n\n/**\n * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.\n *\n * These functions can be used to verify that a message was signed by the holder\n * of the private keys of a given address.\n */\nlibrary ECDSA {\n enum RecoverError {\n NoError,\n InvalidSignature,\n InvalidSignatureLength,\n InvalidSignatureS,\n InvalidSignatureV // Deprecated in v4.8\n }\n\n function _throwError(RecoverError error) private pure {\n if (error == RecoverError.NoError) {\n return; // no error: do nothing\n } else if (error == RecoverError.InvalidSignature) {\n revert(\"ECDSA: invalid signature\");\n } else if (error == RecoverError.InvalidSignatureLength) {\n revert(\"ECDSA: invalid signature length\");\n } else if (error == RecoverError.InvalidSignatureS) {\n revert(\"ECDSA: invalid signature 's' value\");\n }\n }\n\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with\n * `signature` or error string. This address can then be used for verification purposes.\n *\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {toEthSignedMessageHash} on it.\n *\n * Documentation for signature generation:\n * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]\n * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]\n *\n * _Available since v4.3._\n */\n function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {\n if (signature.length == 65) {\n bytes32 r;\n bytes32 s;\n uint8 v;\n // ecrecover takes the signature parameters, and the only way to get them\n // currently is to use assembly.\n /// @solidity memory-safe-assembly\n assembly {\n r := mload(add(signature, 0x20))\n s := mload(add(signature, 0x40))\n v := byte(0, mload(add(signature, 0x60)))\n }\n return tryRecover(hash, v, r, s);\n } else {\n return (address(0), RecoverError.InvalidSignatureLength);\n }\n }\n\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with\n * `signature`. This address can then be used for verification purposes.\n *\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {toEthSignedMessageHash} on it.\n */\n function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, signature);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.\n *\n * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]\n *\n * _Available since v4.3._\n */\n function tryRecover(\n bytes32 hash,\n bytes32 r,\n bytes32 vs\n ) internal pure returns (address, RecoverError) {\n bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);\n uint8 v = uint8((uint256(vs) >> 255) + 27);\n return tryRecover(hash, v, r, s);\n }\n\n /**\n * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.\n *\n * _Available since v4.2._\n */\n function recover(\n bytes32 hash,\n bytes32 r,\n bytes32 vs\n ) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, r, vs);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Overload of {ECDSA-tryRecover} that receives the `v`,\n * `r` and `s` signature fields separately.\n *\n * _Available since v4.3._\n */\n function tryRecover(\n bytes32 hash,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal pure returns (address, RecoverError) {\n // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature\n // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines\n // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most\n // signatures from current libraries generate a unique signature with an s-value in the lower half order.\n //\n // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value\n // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or\n // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept\n // these malleable signatures as well.\n if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {\n return (address(0), RecoverError.InvalidSignatureS);\n }\n\n // If the signature is valid (and not malleable), return the signer address\n address signer = ecrecover(hash, v, r, s);\n if (signer == address(0)) {\n return (address(0), RecoverError.InvalidSignature);\n }\n\n return (signer, RecoverError.NoError);\n }\n\n /**\n * @dev Overload of {ECDSA-recover} that receives the `v`,\n * `r` and `s` signature fields separately.\n */\n function recover(\n bytes32 hash,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, v, r, s);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Returns an Ethereum Signed Message, created from a `hash`. This\n * produces hash corresponding to the one signed with the\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n * JSON-RPC method as part of EIP-191.\n *\n * See {recover}.\n */\n function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {\n // 32 is the length in bytes of hash,\n // enforced by the type signature above\n return keccak256(abi.encodePacked(\"\\x19Ethereum Signed Message:\\n32\", hash));\n }\n\n /**\n * @dev Returns an Ethereum Signed Message, created from `s`. This\n * produces hash corresponding to the one signed with the\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n * JSON-RPC method as part of EIP-191.\n *\n * See {recover}.\n */\n function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(\"\\x19Ethereum Signed Message:\\n\", Strings.toString(s.length), s));\n }\n\n /**\n * @dev Returns an Ethereum Signed Typed Data, created from a\n * `domainSeparator` and a `structHash`. This produces hash corresponding\n * to the one signed with the\n * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]\n * JSON-RPC method as part of EIP-712.\n *\n * See {recover}.\n */\n function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(\"\\x19\\x01\", domainSeparator, structHash));\n }\n}\n" + }, + "@openzeppelin/contracts/utils/math/Math.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary Math {\n enum Rounding {\n Down, // Toward negative infinity\n Up, // Toward infinity\n Zero // Toward zero\n }\n\n /**\n * @dev Returns the largest of two numbers.\n */\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two numbers.\n */\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two numbers. The result is rounded towards\n * zero.\n */\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b) / 2 can overflow.\n return (a & b) + (a ^ b) / 2;\n }\n\n /**\n * @dev Returns the ceiling of the division of two numbers.\n *\n * This differs from standard division with `/` in that it rounds up instead\n * of rounding down.\n */\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b - 1) / b can overflow on addition, so we distribute.\n return a == 0 ? 0 : (a - 1) / b + 1;\n }\n\n /**\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\n * with further edits by Uniswap Labs also under MIT license.\n */\n function mulDiv(\n uint256 x,\n uint256 y,\n uint256 denominator\n ) internal pure returns (uint256 result) {\n unchecked {\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\n // variables such that product = prod1 * 2^256 + prod0.\n uint256 prod0; // Least significant 256 bits of the product\n uint256 prod1; // Most significant 256 bits of the product\n assembly {\n let mm := mulmod(x, y, not(0))\n prod0 := mul(x, y)\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n }\n\n // Handle non-overflow cases, 256 by 256 division.\n if (prod1 == 0) {\n return prod0 / denominator;\n }\n\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\n require(denominator > prod1);\n\n ///////////////////////////////////////////////\n // 512 by 256 division.\n ///////////////////////////////////////////////\n\n // Make division exact by subtracting the remainder from [prod1 prod0].\n uint256 remainder;\n assembly {\n // Compute remainder using mulmod.\n remainder := mulmod(x, y, denominator)\n\n // Subtract 256 bit number from 512 bit number.\n prod1 := sub(prod1, gt(remainder, prod0))\n prod0 := sub(prod0, remainder)\n }\n\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\n // See https://cs.stackexchange.com/q/138556/92363.\n\n // Does not overflow because the denominator cannot be zero at this stage in the function.\n uint256 twos = denominator & (~denominator + 1);\n assembly {\n // Divide denominator by twos.\n denominator := div(denominator, twos)\n\n // Divide [prod1 prod0] by twos.\n prod0 := div(prod0, twos)\n\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\n twos := add(div(sub(0, twos), twos), 1)\n }\n\n // Shift in bits from prod1 into prod0.\n prod0 |= prod1 * twos;\n\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\n // four bits. That is, denominator * inv = 1 mod 2^4.\n uint256 inverse = (3 * denominator) ^ 2;\n\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\n // in modular arithmetic, doubling the correct bits in each step.\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\n\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\n // is no longer required.\n result = prod0 * inverse;\n return result;\n }\n }\n\n /**\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\n */\n function mulDiv(\n uint256 x,\n uint256 y,\n uint256 denominator,\n Rounding rounding\n ) internal pure returns (uint256) {\n uint256 result = mulDiv(x, y, denominator);\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\n result += 1;\n }\n return result;\n }\n\n /**\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\n *\n * Inspired by Henry S. Warren, Jr.'s \"Hacker's Delight\" (Chapter 11).\n */\n function sqrt(uint256 a) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\n //\n // We know that the \"msb\" (most significant bit) of our target number `a` is a power of 2 such that we have\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\n //\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\n // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\n // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\n //\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\n uint256 result = 1 << (log2(a) >> 1);\n\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\n // into the expected uint128 result.\n unchecked {\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n return min(result, a / result);\n }\n }\n\n /**\n * @notice Calculates sqrt(a), following the selected rounding direction.\n */\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = sqrt(a);\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 2, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 128;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 64;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 32;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 16;\n }\n if (value >> 8 > 0) {\n value >>= 8;\n result += 8;\n }\n if (value >> 4 > 0) {\n value >>= 4;\n result += 4;\n }\n if (value >> 2 > 0) {\n value >>= 2;\n result += 2;\n }\n if (value >> 1 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log2(value);\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 10, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >= 10**64) {\n value /= 10**64;\n result += 64;\n }\n if (value >= 10**32) {\n value /= 10**32;\n result += 32;\n }\n if (value >= 10**16) {\n value /= 10**16;\n result += 16;\n }\n if (value >= 10**8) {\n value /= 10**8;\n result += 8;\n }\n if (value >= 10**4) {\n value /= 10**4;\n result += 4;\n }\n if (value >= 10**2) {\n value /= 10**2;\n result += 2;\n }\n if (value >= 10**1) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log10(value);\n return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 256, rounded down, of a positive value.\n * Returns 0 if given 0.\n *\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\n */\n function log256(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 16;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 8;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 4;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 2;\n }\n if (value >> 8 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log256(value);\n return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Strings.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./math/Math.sol\";\n\n/**\n * @dev String operations.\n */\nlibrary Strings {\n bytes16 private constant _SYMBOLS = \"0123456789abcdef\";\n uint8 private constant _ADDRESS_LENGTH = 20;\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n */\n function toString(uint256 value) internal pure returns (string memory) {\n unchecked {\n uint256 length = Math.log10(value) + 1;\n string memory buffer = new string(length);\n uint256 ptr;\n /// @solidity memory-safe-assembly\n assembly {\n ptr := add(buffer, add(32, length))\n }\n while (true) {\n ptr--;\n /// @solidity memory-safe-assembly\n assembly {\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\n }\n value /= 10;\n if (value == 0) break;\n }\n return buffer;\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n */\n function toHexString(uint256 value) internal pure returns (string memory) {\n unchecked {\n return toHexString(value, Math.log256(value) + 1);\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n */\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n bytes memory buffer = new bytes(2 * length + 2);\n buffer[0] = \"0\";\n buffer[1] = \"x\";\n for (uint256 i = 2 * length + 1; i > 1; --i) {\n buffer[i] = _SYMBOLS[value & 0xf];\n value >>= 4;\n }\n require(value == 0, \"Strings: hex length insufficient\");\n return string(buffer);\n }\n\n /**\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\n */\n function toHexString(address addr) internal pure returns (string memory) {\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\n }\n}\n" + }, + "contracts/DistributionCreator.sol": { + "content": "// SPDX-License-Identifier: BUSL-1.1\n\n/*\n * █ \n ***** ▓▓▓ \n * ▓▓▓▓▓▓▓ \n * ///. ▓▓▓▓▓▓▓▓▓▓▓▓▓ \n ***** //////// ▓▓▓▓▓▓▓ \n * ///////////// ▓▓▓ \n ▓▓ ////////////////// █ ▓▓ \n ▓▓ ▓▓ /////////////////////// ▓▓ ▓▓ \n ▓▓ ▓▓ //////////////////////////// ▓▓ ▓▓ \n ▓▓ ▓▓ /////////▓▓▓///////▓▓▓///////// ▓▓ ▓▓ \n ▓▓ ,////////////////////////////////////// ▓▓ ▓▓ \n ▓▓ ////////////////////////////////////////// ▓▓ \n ▓▓ //////////////////////▓▓▓▓///////////////////// \n ,//////////////////////////////////////////////////// \n .////////////////////////////////////////////////////////// \n .//////////////////////////██.,//////////////////////////█ \n .//////////////////////████..,./////////////////////██ \n ...////////////////███████.....,.////////////////███ \n ,.,////////////████████ ........,///////////████ \n .,.,//////█████████ ,.......///////████ \n ,..//████████ ........./████ \n ..,██████ .....,███ \n .██ ,.,█ \n \n \n \n ▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓ ▓▓▓▓▓▓▓▓▓▓ \n ▓▓▓▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓ ▓▓ ▓▓▓▓ \n ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓ ▓▓▓▓▓ \n ▓▓▓ ▓▓ ▓▓▓ ▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ \n*/\n\npragma solidity ^0.8.17;\n\nimport { ReentrancyGuardUpgradeable } from \"@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol\";\nimport { IERC20, IERC20Metadata } from \"@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol\";\nimport { SafeERC20 } from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport { ECDSA } from \"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\";\n\nimport { IUniswapV3Pool } from \"./interfaces/external/uniswap/IUniswapV3Pool.sol\";\n\nimport \"./utils/UUPSHelper.sol\";\nimport { DistributionParameters } from \"./struct/DistributionParameters.sol\";\nimport { UniswapTokenData, ExtensiveDistributionParameters } from \"./struct/ExtensiveDistributionParameters.sol\";\nimport { RewardTokenAmounts } from \"./struct/RewardTokenAmounts.sol\";\n\ninterface IDistributionCreator {\n function tryGetExtensiveDistributionParameters(\n DistributionParameters memory distribution\n ) external view returns (bool success, ExtensiveDistributionParameters memory extensiveParams);\n}\n\n/// @title DistributionCreator\n/// @author Angle Labs, Inc.\n/// @notice Manages the distribution of rewards across different pools with concentrated liquidity (like on Uniswap V3)\n/// @dev This contract is mostly a helper for APIs built on top of Merkl\n/// @dev People depositing rewards must have signed a `message` with the conditions for using the\n/// product\n//solhint-disable\ncontract DistributionCreator is UUPSHelper, ReentrancyGuardUpgradeable {\n using SafeERC20 for IERC20;\n\n // =========================== CONSTANTS / VARIABLES ===========================\n\n /// @notice Epoch duration\n uint32 public constant EPOCH_DURATION = 3600;\n\n /// @notice Base for fee computation\n uint256 public constant BASE_9 = 1e9;\n\n /// @notice `Core` contract handling access control\n ICore public core;\n\n /// @notice User contract for distributing rewards\n address public distributor;\n\n /// @notice Address to which fees are forwarded\n address public feeRecipient;\n\n /// @notice Value (in base 10**9) of the fees taken when creating a distribution for a pool which do not\n /// have a whitelisted token in it\n uint256 public fees;\n\n /// @notice Message that needs to be acknowledged by users creating a distribution\n string public message;\n\n /// @notice Hash of the message that needs to be signed\n bytes32 public messageHash;\n\n /// @notice List of all rewards ever distributed or to be distributed in the contract\n /// @dev An attacker could try to populate this list. It shouldn't be an issue as only view functions\n /// iterate on it\n DistributionParameters[] public distributionList;\n\n /// @notice Maps an address to its fee rebate\n mapping(address => uint256) public feeRebate;\n\n /// @notice Maps a token to whether it is whitelisted or not. No fees are to be paid for incentives given\n /// on pools with whitelisted tokens\n mapping(address => uint256) public isWhitelistedToken;\n\n /// @notice Maps an address to its nonce for creating a distribution\n mapping(address => uint256) public nonces;\n\n /// @notice Maps an address to the last valid hash signed\n mapping(address => bytes32) public userSignatures;\n\n /// @notice Maps a user to whether it is whitelisted for not signing\n mapping(address => uint256) public userSignatureWhitelist;\n\n /// @notice Maps a token to the minimum amount that must be sent per epoch for a distribution to be valid\n /// @dev If `rewardTokenMinAmounts[token] == 0`, then `token` cannot be used as a reward\n mapping(address => uint256) public rewardTokenMinAmounts;\n\n /// @notice List of all reward tokens that have at some point been accepted\n address[] public rewardTokens;\n\n uint256[36] private __gap;\n\n // =================================== EVENTS ==================================\n\n event DistributorUpdated(address indexed _distributor);\n event FeeRebateUpdated(address indexed user, uint256 userFeeRebate);\n event FeeRecipientUpdated(address indexed _feeRecipient);\n event FeesSet(uint256 _fees);\n event MessageUpdated(bytes32 _messageHash);\n event NewDistribution(DistributionParameters distribution, address indexed sender);\n event RewardTokenMinimumAmountUpdated(address indexed token, uint256 amount);\n event TokenWhitelistToggled(address indexed token, uint256 toggleStatus);\n event UserSigned(bytes32 messageHash, address indexed user);\n event UserSigningWhitelistToggled(address indexed user, uint256 toggleStatus);\n\n // ================================= MODIFIERS =================================\n\n /// @notice Checks whether the `msg.sender` has the governor role or the guardian role\n modifier onlyGovernorOrGuardian() {\n if (!core.isGovernorOrGuardian(msg.sender)) revert NotGovernorOrGuardian();\n _;\n }\n\n /// @notice Checks whether an address has signed the message or not\n modifier hasSigned() {\n if (\n userSignatureWhitelist[msg.sender] == 0 &&\n userSignatures[msg.sender] != messageHash &&\n userSignatureWhitelist[tx.origin] == 0 &&\n userSignatures[tx.origin] != messageHash\n ) revert NotSigned();\n _;\n }\n\n // ================================ CONSTRUCTOR ================================\n\n function initialize(ICore _core, address _distributor, uint256 _fees) external initializer {\n if (address(_core) == address(0) || _distributor == address(0)) revert ZeroAddress();\n if (_fees >= BASE_9) revert InvalidParam();\n distributor = _distributor;\n core = _core;\n fees = _fees;\n }\n\n constructor() initializer {}\n\n /// @inheritdoc UUPSUpgradeable\n function _authorizeUpgrade(address) internal view override onlyGuardianUpgrader(core) {}\n\n // ============================== DEPOSIT FUNCTION =============================\n\n /// @notice Creates a `distribution` to incentivize a given pool for a specific period of time\n /// @return distributionAmount How many reward tokens are actually taken into consideration in the contract\n /// @dev If the address specified as a UniV3 pool is not effectively a pool, it will not be handled by the\n /// distribution script and rewards may be lost\n /// @dev Reward tokens sent as part of distributions must have been whitelisted before and amounts\n /// sent should be bigger than a minimum amount specific to each token\n /// @dev The `positionWrappers` specified in the `distribution` struct need to be supported by the script\n /// List of supported `positionWrappers` can be found in the docs.\n /// @dev If the pool incentivized contains one whitelisted token, then no fees are taken on the rewards\n /// @dev This function reverts if the sender has not signed the message `messageHash` once through one of\n /// the functions enabling to sign\n function createDistribution(\n DistributionParameters memory distribution\n ) external hasSigned returns (uint256 distributionAmount) {\n return _createDistribution(distribution);\n }\n\n /// @notice Same as the function above but for multiple distributions at once\n /// @return List of all the distribution amounts actually deposited for each `distribution` in the `distributions` list\n function createDistributions(\n DistributionParameters[] memory distributions\n ) external hasSigned returns (uint256[] memory) {\n uint256 distributionsLength = distributions.length;\n uint256[] memory distributionAmounts = new uint256[](distributionsLength);\n for (uint256 i; i < distributionsLength; ) {\n distributionAmounts[i] = _createDistribution(distributions[i]);\n unchecked {\n ++i;\n }\n }\n return distributionAmounts;\n }\n\n /// @notice Checks whether the `msg.sender`'s `signature` is compatible with the message\n /// to sign and stores the signature\n /// @dev If you signed the message once, and the message has not been modified, then you do not\n /// need to sign again\n function sign(bytes calldata signature) external {\n _sign(signature);\n }\n\n /// @notice Combines signing the message and creating a distribution\n function signAndCreateDistribution(\n DistributionParameters memory distribution,\n bytes calldata signature\n ) external returns (uint256 distributionAmount) {\n _sign(signature);\n return _createDistribution(distribution);\n }\n\n /// @notice Internal version of `createDistribution`\n function _createDistribution(\n DistributionParameters memory distribution\n ) internal nonReentrant returns (uint256 distributionAmount) {\n uint32 epochStart = _getRoundedEpoch(distribution.epochStart);\n uint256 minDistributionAmount = rewardTokenMinAmounts[distribution.rewardToken];\n distribution.epochStart = epochStart;\n // Reward are not accepted in the following conditions:\n if (\n // if epoch parameters lead to a past distribution\n epochStart + EPOCH_DURATION < block.timestamp ||\n // if the amount of epochs for which this distribution should last is zero\n distribution.numEpoch == 0 ||\n // if the distribution parameters are not correctly specified\n distribution.propFees + distribution.propToken0 + distribution.propToken1 != 1e4 ||\n // if boosted addresses get less than non-boosted addresses in case of\n (distribution.boostingAddress != address(0) && distribution.boostedReward < 1e4) ||\n // if the type of the position wrappers is not well specified\n distribution.positionWrappers.length != distribution.wrapperTypes.length ||\n // if the reward token is not whitelisted as an incentive token\n minDistributionAmount == 0 ||\n // if the amount distributed is too small with respect to what is allowed\n distribution.amount / distribution.numEpoch < minDistributionAmount\n ) revert InvalidReward();\n distributionAmount = distribution.amount;\n // Computing fees: these are waived for whitelisted addresses and if there is a whitelisted token in a pool\n uint256 userFeeRebate = feeRebate[msg.sender];\n if (\n userFeeRebate < BASE_9 &&\n // Algebra pools also have these `token0` and `token1` parameters\n isWhitelistedToken[IUniswapV3Pool(distribution.uniV3Pool).token0()] == 0 &&\n isWhitelistedToken[IUniswapV3Pool(distribution.uniV3Pool).token1()] == 0\n ) {\n uint256 _fees = (fees * (BASE_9 - userFeeRebate)) / BASE_9;\n uint256 distributionAmountMinusFees = (distributionAmount * (BASE_9 - _fees)) / BASE_9;\n address _feeRecipient = feeRecipient;\n _feeRecipient = _feeRecipient == address(0) ? address(this) : _feeRecipient;\n IERC20(distribution.rewardToken).safeTransferFrom(\n msg.sender,\n _feeRecipient,\n distributionAmount - distributionAmountMinusFees\n );\n distributionAmount = distributionAmountMinusFees;\n distribution.amount = distributionAmount;\n }\n\n IERC20(distribution.rewardToken).safeTransferFrom(msg.sender, distributor, distributionAmount);\n uint256 senderNonce = nonces[msg.sender];\n nonces[msg.sender] = senderNonce + 1;\n distribution.rewardId = bytes32(keccak256(abi.encodePacked(msg.sender, senderNonce)));\n distributionList.push(distribution);\n emit NewDistribution(distribution, msg.sender);\n }\n\n /// @notice Internal version of the `sign` function\n function _sign(bytes calldata signature) internal {\n bytes32 _messageHash = messageHash;\n if (ECDSA.recover(_messageHash, signature) != msg.sender) revert InvalidSignature();\n userSignatures[msg.sender] = _messageHash;\n emit UserSigned(_messageHash, msg.sender);\n }\n\n // ================================= UI HELPERS ================================\n // These functions are not to be queried on-chain and hence are not optimized for gas consumption\n\n /// @notice Returns the list of all distributions ever made or to be done in the future\n function getAllDistributions() external view returns (DistributionParameters[] memory) {\n return distributionList;\n }\n\n /// @notice Returns the list of all currently active distributions on pools of supported AMMs (like Uniswap V3)\n function getActiveDistributions()\n external\n view\n returns (ExtensiveDistributionParameters[] memory searchDistributions)\n {\n uint32 roundedEpoch = _getRoundedEpoch(uint32(block.timestamp));\n (searchDistributions, ) = _getPoolDistributionsBetweenEpochs(\n address(0),\n roundedEpoch,\n roundedEpoch + EPOCH_DURATION,\n 0,\n type(uint32).max\n );\n }\n\n /// @notice Similar to `getActiveDistributions()` with additional parameters to prevent out of gas error\n /// @param skip Disregard distibutions with a global index lower than `skip`\n /// @param first Limit the length of the returned array to `first`\n /// @return searchDistributions Eligible distributions\n /// @return lastIndexDistribution Index of the last distribution assessed in the list of all distributions\n /// For pagniation purpose, in case of out of gas, you can call back the same function but with `skip` set to `lastIndexDistribution`\n function getActiveDistributions(\n uint32 skip,\n uint32 first\n )\n external\n view\n returns (ExtensiveDistributionParameters[] memory searchDistributions, uint256 lastIndexDistribution)\n {\n uint32 roundedEpoch = _getRoundedEpoch(uint32(block.timestamp));\n return _getPoolDistributionsBetweenEpochs(address(0), roundedEpoch, roundedEpoch + EPOCH_DURATION, skip, first);\n }\n\n /// @notice Returns the list of all the reward tokens supported as well as their minimum amounts\n function getValidRewardTokens() external view returns (RewardTokenAmounts[] memory) {\n uint256 length;\n uint256 rewardTokenListLength = rewardTokens.length;\n RewardTokenAmounts[] memory validRewardTokens = new RewardTokenAmounts[](rewardTokenListLength);\n for (uint32 i; i < rewardTokenListLength; ) {\n address token = rewardTokens[i];\n uint256 minAmount = rewardTokenMinAmounts[token];\n if (minAmount > 0) {\n validRewardTokens[length] = RewardTokenAmounts(token, minAmount);\n length += 1;\n }\n unchecked {\n ++i;\n }\n }\n assembly {\n mstore(validRewardTokens, length)\n }\n return validRewardTokens;\n }\n\n /// @notice Returns the list of all the distributions that were or that are going to be live at\n /// a specific epoch\n function getDistributionsForEpoch(\n uint32 epoch\n ) external view returns (ExtensiveDistributionParameters[] memory searchDistributions) {\n uint32 roundedEpoch = _getRoundedEpoch(epoch);\n (searchDistributions, ) = _getPoolDistributionsBetweenEpochs(\n address(0),\n roundedEpoch,\n roundedEpoch + EPOCH_DURATION,\n 0,\n type(uint32).max\n );\n }\n\n /// @notice Similar to `getDistributionsForEpoch(uint256 epoch)` with additional parameters to prevent out of gas error\n /// @param skip Disregard distibutions with a global index lower than `skip`\n /// @param first Limit the length of the returned array to `first`\n /// @return searchDistributions Eligible distributions\n /// @return lastIndexDistribution Index of the last distribution assessed in the list of all distributions\n /// For pagniation purpose, in case of out of gas, you can call back the same function but with `skip` set to `lastIndexDistribution`\n function getDistributionsForEpoch(\n uint32 epoch,\n uint32 skip,\n uint32 first\n ) external view returns (ExtensiveDistributionParameters[] memory, uint256 lastIndexDistribution) {\n uint32 roundedEpoch = _getRoundedEpoch(epoch);\n return _getPoolDistributionsBetweenEpochs(address(0), roundedEpoch, roundedEpoch + EPOCH_DURATION, skip, first);\n }\n\n /// @notice Gets the distributions that were or will be live at some point between `epochStart` (included) and `epochEnd` (excluded)\n /// @dev If a distribution starts during `epochEnd`, it is not be returned by this function\n /// @dev Conversely, if a distribution starts after `epochStart` and ends before `epochEnd`, it is returned by this function\n function getDistributionsBetweenEpochs(\n uint32 epochStart,\n uint32 epochEnd\n ) external view returns (ExtensiveDistributionParameters[] memory searchDistributions) {\n (searchDistributions, ) = _getPoolDistributionsBetweenEpochs(\n address(0),\n _getRoundedEpoch(epochStart),\n _getRoundedEpoch(epochEnd),\n 0,\n type(uint32).max\n );\n }\n\n /// @notice Similar to `getDistributionsBetweenEpochs(uint256 epochStart, uint256 epochEnd)` with additional parameters to prevent out of gas error\n /// @param skip Disregard distibutions with a global index lower than `skip`\n /// @param first Limit the length of the returned array to `first`\n /// @return searchDistributions Eligible distributions\n /// @return lastIndexDistribution Index of the last distribution assessed in the list of all distributions\n /// For pagniation purpose, in case of out of gas, you can call back the same function but with `skip` set to `lastIndexDistribution`\n function getDistributionsBetweenEpochs(\n uint32 epochStart,\n uint32 epochEnd,\n uint32 skip,\n uint32 first\n ) external view returns (ExtensiveDistributionParameters[] memory, uint256 lastIndexDistribution) {\n return\n _getPoolDistributionsBetweenEpochs(\n address(0),\n _getRoundedEpoch(epochStart),\n _getRoundedEpoch(epochEnd),\n skip,\n first\n );\n }\n\n /// @notice Returns the list of all distributions that were or will be live after `epochStart` (included)\n function getDistributionsAfterEpoch(\n uint32 epochStart\n ) external view returns (ExtensiveDistributionParameters[] memory searchDistributions) {\n (searchDistributions, ) = _getPoolDistributionsBetweenEpochs(\n address(0),\n _getRoundedEpoch(epochStart),\n type(uint32).max,\n 0,\n type(uint32).max\n );\n }\n\n /// @notice Similar to `getDistributionsAfterEpoch(uint256 epochStart)` with additional parameters to prevent out of gas error\n /// @param skip Disregard distibutions with a global index lower than `skip`\n /// @param first Limit the length of the returned array to `first`\n /// @return searchDistributions Eligible distributions\n /// @return lastIndexDistribution Index of the last distribution assessed in the list of all distributions\n /// For pagniation purpose, in case of out of gas, you can call back the same function but with `skip` set to `lastIndexDistribution`\n function getDistributionsAfterEpoch(\n uint32 epochStart,\n uint32 skip,\n uint32 first\n ) external view returns (ExtensiveDistributionParameters[] memory, uint256 lastIndexDistribution) {\n return\n _getPoolDistributionsBetweenEpochs(address(0), _getRoundedEpoch(epochStart), type(uint32).max, skip, first);\n }\n\n /// @notice Returns the list of all currently active distributions for a specific UniswapV3 pool\n function getActivePoolDistributions(\n address uniV3Pool\n ) external view returns (ExtensiveDistributionParameters[] memory searchDistributions) {\n uint32 roundedEpoch = _getRoundedEpoch(uint32(block.timestamp));\n (searchDistributions, ) = _getPoolDistributionsBetweenEpochs(\n uniV3Pool,\n roundedEpoch,\n roundedEpoch + EPOCH_DURATION,\n 0,\n type(uint32).max\n );\n }\n\n /// @notice Similar to `getActivePoolDistributions(address uniV3Pool)` with additional parameters to prevent out of gas error\n /// @param skip Disregard distibutions with a global index lower than `skip`\n /// @param first Limit the length of the returned array to `first`\n /// @return searchDistributions Eligible distributions\n /// @return lastIndexDistribution Index of the last distribution assessed in the list of all distributions\n /// For pagniation purpose, in case of out of gas, you can call back the same function but with `skip` set to `lastIndexDistribution`\n function getActivePoolDistributions(\n address uniV3Pool,\n uint32 skip,\n uint32 first\n ) external view returns (ExtensiveDistributionParameters[] memory, uint256 lastIndexDistribution) {\n uint32 roundedEpoch = _getRoundedEpoch(uint32(block.timestamp));\n return _getPoolDistributionsBetweenEpochs(uniV3Pool, roundedEpoch, roundedEpoch + EPOCH_DURATION, skip, first);\n }\n\n /// @notice Returns the list of all the distributions that were or that are going to be live at a\n /// specific epoch and for a specific pool\n function getPoolDistributionsForEpoch(\n address uniV3Pool,\n uint32 epoch\n ) external view returns (ExtensiveDistributionParameters[] memory searchDistributions) {\n uint32 roundedEpoch = _getRoundedEpoch(epoch);\n (searchDistributions, ) = _getPoolDistributionsBetweenEpochs(\n uniV3Pool,\n roundedEpoch,\n roundedEpoch + EPOCH_DURATION,\n 0,\n type(uint32).max\n );\n }\n\n /// @notice Similar to `getPoolDistributionsForEpoch(address uniV3Pool,uint32 epoch)` with additional parameters to prevent out of gas error\n /// @param skip Disregard distibutions with a global index lower than `skip`\n /// @param first Limit the length of the returned array to `first`\n /// @return searchDistributions Eligible distributions\n /// @return lastIndexDistribution Index of the last distribution assessed in the list of all distributions\n /// For pagniation purpose, in case of out of gas, you can call back the same function but with `skip` set to `lastIndexDistribution`\n function getPoolDistributionsForEpoch(\n address uniV3Pool,\n uint32 epoch,\n uint32 skip,\n uint32 first\n ) external view returns (ExtensiveDistributionParameters[] memory, uint256 lastIndexDistribution) {\n uint32 roundedEpoch = _getRoundedEpoch(epoch);\n return _getPoolDistributionsBetweenEpochs(uniV3Pool, roundedEpoch, roundedEpoch + EPOCH_DURATION, skip, first);\n }\n\n /// @notice Returns the list of all distributions that were or will be live at some point between\n /// `epochStart` (included) and `epochEnd` (excluded) for a specific pool\n function getPoolDistributionsBetweenEpochs(\n address uniV3Pool,\n uint32 epochStart,\n uint32 epochEnd\n ) external view returns (ExtensiveDistributionParameters[] memory searchDistributions) {\n (searchDistributions, ) = _getPoolDistributionsBetweenEpochs(\n uniV3Pool,\n _getRoundedEpoch(epochStart),\n _getRoundedEpoch(epochEnd),\n 0,\n type(uint32).max\n );\n }\n\n /// @notice Similar to `getPoolDistributionsBetweenEpochs(address uniV3Pool,uint32 epochStart, uint32 epochEnd)` with additional parameters to prevent out of gas error\n /// @param skip Disregard distibutions with a global index lower than `skip`\n /// @param first Limit the length of the returned array to `first`\n /// @return searchDistributions Eligible distributions\n /// @return lastIndexDistribution Index of the last distribution assessed in the list of all distributions\n /// For pagniation purpose, in case of out of gas, you can call back the same function but with `skip` set to `lastIndexDistribution`\n function getPoolDistributionsBetweenEpochs(\n address uniV3Pool,\n uint32 epochStart,\n uint32 epochEnd,\n uint32 skip,\n uint32 first\n ) external view returns (ExtensiveDistributionParameters[] memory, uint256 lastIndexDistribution) {\n return\n _getPoolDistributionsBetweenEpochs(\n uniV3Pool,\n _getRoundedEpoch(epochStart),\n _getRoundedEpoch(epochEnd),\n skip,\n first\n );\n }\n\n /// @notice Returns the list of all distributions that were or will be live after `epochStart` (included)\n /// for a specific pool\n function getPoolDistributionsAfterEpoch(\n address uniV3Pool,\n uint32 epochStart\n ) external view returns (ExtensiveDistributionParameters[] memory searchDistributions) {\n (searchDistributions, ) = _getPoolDistributionsBetweenEpochs(\n uniV3Pool,\n _getRoundedEpoch(epochStart),\n type(uint32).max,\n 0,\n type(uint32).max\n );\n }\n\n /// @notice Similar to `getPoolDistributionsAfterEpoch(address uniV3Pool,uint32 epochStart)` with additional parameters to prevent out of gas error\n /// @param skip Disregard distibutions with a global index lower than `skip`\n /// @param first Limit the length of the returned array to `first`\n /// @return searchDistributions Eligible distributions\n /// @return lastIndexDistribution Index of the last distribution assessed in the list of all distributions\n /// For pagniation purpose, in case of out of gas, you can call back the same function but with `skip` set to `lastIndexDistribution`\n function getPoolDistributionsAfterEpoch(\n address uniV3Pool,\n uint32 epochStart,\n uint32 skip,\n uint32 first\n ) external view returns (ExtensiveDistributionParameters[] memory, uint256 lastIndexDistribution) {\n return\n _getPoolDistributionsBetweenEpochs(uniV3Pool, _getRoundedEpoch(epochStart), type(uint32).max, skip, first);\n }\n\n // ============================ GOVERNANCE FUNCTIONS ===========================\n\n /// @notice Sets a new `distributor` to which rewards should be distributed\n function setNewDistributor(address _distributor) external onlyGovernorOrGuardian {\n if (_distributor == address(0)) revert InvalidParam();\n distributor = _distributor;\n emit DistributorUpdated(_distributor);\n }\n\n /// @notice Sets the fees on deposit\n function setFees(uint256 _fees) external onlyGovernorOrGuardian {\n if (_fees >= BASE_9) revert InvalidParam();\n fees = _fees;\n emit FeesSet(_fees);\n }\n\n /// @notice Sets fee rebates for a given user\n function setUserFeeRebate(address user, uint256 userFeeRebate) external onlyGovernorOrGuardian {\n feeRebate[user] = userFeeRebate;\n emit FeeRebateUpdated(user, userFeeRebate);\n }\n\n /// @notice Toggles the fee whitelist for `token`\n function toggleTokenWhitelist(address token) external onlyGovernorOrGuardian {\n uint256 toggleStatus = 1 - isWhitelistedToken[token];\n isWhitelistedToken[token] = toggleStatus;\n emit TokenWhitelistToggled(token, toggleStatus);\n }\n\n /// @notice Recovers fees accrued on the contract for a list of `tokens`\n function recoverFees(IERC20[] calldata tokens, address to) external onlyGovernorOrGuardian {\n uint256 tokensLength = tokens.length;\n for (uint256 i; i < tokensLength; ) {\n tokens[i].safeTransfer(to, tokens[i].balanceOf(address(this)));\n unchecked {\n ++i;\n }\n }\n }\n\n /// @notice Sets the minimum amounts per distribution epoch for different reward tokens\n function setRewardTokenMinAmounts(\n address[] calldata tokens,\n uint256[] calldata amounts\n ) external onlyGovernorOrGuardian {\n uint256 tokensLength = tokens.length;\n if (tokensLength != amounts.length) revert InvalidLengths();\n for (uint256 i; i < tokensLength; ++i) {\n uint256 amount = amounts[i];\n // Basic logic check to make sure there are no duplicates in the `rewardTokens` table. If a token is\n // removed then re-added, it will appear as a duplicate in the list\n if (amount > 0 && rewardTokenMinAmounts[tokens[i]] == 0) rewardTokens.push(tokens[i]);\n rewardTokenMinAmounts[tokens[i]] = amount;\n emit RewardTokenMinimumAmountUpdated(tokens[i], amount);\n }\n }\n\n /// @notice Sets a new address to receive fees\n function setFeeRecipient(address _feeRecipient) external onlyGovernorOrGuardian {\n feeRecipient = _feeRecipient;\n emit FeeRecipientUpdated(_feeRecipient);\n }\n\n /// @notice Sets the message that needs to be signed by users before posting rewards\n function setMessage(string memory _message) external onlyGovernorOrGuardian {\n message = _message;\n bytes32 _messageHash = ECDSA.toEthSignedMessageHash(bytes(_message));\n messageHash = _messageHash;\n emit MessageUpdated(_messageHash);\n }\n\n /// @notice Toggles the whitelist status for `user` when it comes to signing messages before depositing rewards.\n function toggleSigningWhitelist(address user) external onlyGovernorOrGuardian {\n uint256 whitelistStatus = 1 - userSignatureWhitelist[user];\n userSignatureWhitelist[user] = whitelistStatus;\n emit UserSigningWhitelistToggled(user, whitelistStatus);\n }\n\n // ============================== INTERNAL HELPERS =============================\n\n /// @notice Rounds an `epoch` timestamp to the start of the corresponding period\n function _getRoundedEpoch(uint32 epoch) internal pure returns (uint32) {\n return (epoch / EPOCH_DURATION) * EPOCH_DURATION;\n }\n\n /// @notice Checks whether `distribution` was live between `roundedEpochStart` and `roundedEpochEnd`\n function _isDistributionLiveBetweenEpochs(\n DistributionParameters memory distribution,\n uint32 roundedEpochStart,\n uint32 roundedEpochEnd\n ) internal pure returns (bool) {\n uint256 distributionEpochStart = distribution.epochStart;\n return (distributionEpochStart + distribution.numEpoch * EPOCH_DURATION > roundedEpochStart &&\n distributionEpochStart < roundedEpochEnd);\n }\n\n /// @notice Fetches data for `token` on the Uniswap `pool`\n function _getUniswapTokenData(\n IERC20Metadata token,\n address pool\n ) internal view returns (UniswapTokenData memory data) {\n data.add = address(token);\n data.decimals = token.decimals();\n data.symbol = token.symbol();\n data.poolBalance = token.balanceOf(pool);\n }\n\n /// @notice Fetches extra data about the parameters in a distribution\n function getExtensiveDistributionParameters(\n DistributionParameters memory distribution\n ) external view returns (ExtensiveDistributionParameters memory extensiveParams) {\n extensiveParams.base = distribution;\n try IUniswapV3Pool(distribution.uniV3Pool).fee() returns (uint24 fee) {\n extensiveParams.poolFee = fee;\n } catch {\n extensiveParams.poolFee = 0;\n }\n extensiveParams.token0 = _getUniswapTokenData(\n IERC20Metadata(IUniswapV3Pool(distribution.uniV3Pool).token0()),\n distribution.uniV3Pool\n );\n extensiveParams.token1 = _getUniswapTokenData(\n IERC20Metadata(IUniswapV3Pool(distribution.uniV3Pool).token1()),\n distribution.uniV3Pool\n );\n extensiveParams.rewardTokenSymbol = IERC20Metadata(distribution.rewardToken).symbol();\n extensiveParams.rewardTokenDecimals = IERC20Metadata(distribution.rewardToken).decimals();\n }\n\n /// @notice Tries to fetch extra data about the parameters in a distribution\n function tryGetExtensiveDistributionParameters(\n DistributionParameters memory distribution\n ) external returns (bool success, ExtensiveDistributionParameters memory extensiveParams) {\n (bool callSuccess, bytes memory returndata) = address(this).delegatecall(\n abi.encodeWithSelector(DistributionCreator.getExtensiveDistributionParameters.selector, distribution)\n );\n success = callSuccess;\n if (success) {\n extensiveParams = abi.decode(returndata, (ExtensiveDistributionParameters));\n }\n return (success, extensiveParams);\n }\n\n /// @notice Gets the list of all the distributions for `uniV3Pool` that have been active between `epochStart` and `epochEnd` (excluded)\n /// @dev If the `uniV3Pool` parameter is equal to 0, then this function will return the distributions for all pools\n function _getPoolDistributionsBetweenEpochs(\n address uniV3Pool,\n uint32 epochStart,\n uint32 epochEnd,\n uint32 skip,\n uint32 first\n ) internal view returns (ExtensiveDistributionParameters[] memory, uint256) {\n uint256 length;\n uint256 distributionListLength = distributionList.length;\n uint256 returnSize = first > distributionListLength ? distributionListLength : first;\n ExtensiveDistributionParameters[] memory activeRewards = new ExtensiveDistributionParameters[](returnSize);\n uint32 i = skip;\n while (i < distributionListLength) {\n DistributionParameters memory distribution = distributionList[i];\n if (\n _isDistributionLiveBetweenEpochs(distribution, epochStart, epochEnd) &&\n (uniV3Pool == address(0) || distribution.uniV3Pool == uniV3Pool)\n ) {\n (bool success, ExtensiveDistributionParameters memory extensiveParams) = IDistributionCreator(\n address(this)\n ).tryGetExtensiveDistributionParameters(distribution);\n if (success) {\n activeRewards[length] = extensiveParams;\n length += 1;\n }\n }\n unchecked {\n ++i;\n }\n if (length == returnSize) break;\n }\n assembly {\n mstore(activeRewards, length)\n }\n return (activeRewards, i);\n }\n}\n" + }, + "contracts/interfaces/external/uniswap/IUniswapV3Pool.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity >=0.5.0;\n\n/// @title Pool state that never changes\n/// @notice These parameters are fixed for a pool forever, i.e., the methods will always return the same values\ninterface IUniswapV3Pool {\n /// @notice The first of the two tokens of the pool, sorted by address\n /// @return The token contract address\n function token0() external view returns (address);\n\n /// @notice The second of the two tokens of the pool, sorted by address\n /// @return The token contract address\n function token1() external view returns (address);\n\n /// @notice The pool's fee in hundredths of a bip, i.e. 1e-6\n /// @return The fee\n function fee() external view returns (uint24);\n}\n" + }, + "contracts/interfaces/ICore.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\n/// @title ICore\n/// @author Angle Labs, Inc.\n/// @notice Interface for the `Core` contracts of smart contract modules used in Angle Labs contracts\ninterface ICore {\n /// @notice Checks whether an address is governor\n /// @param admin Address to check\n /// @return Whether the address has the `GOVERNOR_ROLE` or not\n function isGovernor(address admin) external view returns (bool);\n\n /// @notice Checks whether an address is a governor or a guardian of a module\n /// @param admin Address to check\n /// @return Whether the address has the `GUARDIAN_ROLE` or not\n /// @dev Governance should make sure when adding a governor to also give this governor the guardian\n /// role by calling the `addGovernor` function\n function isGovernorOrGuardian(address admin) external view returns (bool);\n}\n" + }, + "contracts/struct/DistributionParameters.sol": { + "content": "// SPDX-License-Identifier: BUSL-1.1\n\npragma solidity ^0.8.17;\n\nstruct DistributionParameters {\n // ID of the reward (populated once created)\n bytes32 rewardId;\n // Address of the UniswapV3 pool that needs to be incentivized\n address uniV3Pool;\n // Address of the reward token for the incentives\n address rewardToken;\n // Amount of `rewardToken` to distribute across all the epochs\n // Amount distributed per epoch is `amount/numEpoch`\n uint256 amount;\n // List of all position wrappers to consider or not for this contract. Some wrappers like Gamma or Arrakis\n // are automatically detected and so there is no need to specify them here. Check out the docs to find out\n // which need to be specified and which are not automatically detected.\n address[] positionWrappers;\n // Type (Arrakis, Gamma, Blacklist, ...) encoded as a `uint32` for each wrapper in the list above. Mapping between\n // wrapper types and their corresponding `uint32` value can be found in Angle Docs\n uint32[] wrapperTypes;\n // In the incentivization formula, how much of the fees should go to holders of token0\n // in base 10**4\n uint32 propToken0;\n // Proportion for holding token1 (in base 10**4)\n uint32 propToken1;\n // Proportion for providing a useful liquidity (in base 10**4) that generates fees\n uint32 propFees;\n // Timestamp at which the incentivization should start\n uint32 epochStart;\n // Amount of epochs for which incentivization should last\n uint32 numEpoch;\n // Whether out of range liquidity should still be incentivized or not\n // This should be equal to 1 if out of range liquidity should still be incentivized\n // and 0 otherwise\n uint32 isOutOfRangeIncentivized;\n // How much more addresses with a maximum boost can get with respect to addresses\n // which do not have a boost (in base 4). In the case of Curve where addresses get 2.5x more\n // this would be 25000\n uint32 boostedReward;\n // Address of the token which dictates who gets boosted rewards or not. This is optional\n // and if the zero address is given no boost will be taken into account\n address boostingAddress;\n // Additional data passed when distributing rewards. This parameter may be used in case\n // the reward distribution script needs to look into other parameters beyond the ones above.\n bytes additionalData;\n}\n" + }, + "contracts/struct/ExtensiveDistributionParameters.sol": { + "content": "// SPDX-License-Identifier: BUSL-1.1\n\npragma solidity ^0.8.17;\n\nimport { DistributionParameters } from \"./DistributionParameters.sol\";\n\nstruct UniswapTokenData {\n address add;\n uint8 decimals;\n string symbol;\n uint256 poolBalance;\n}\n\nstruct ExtensiveDistributionParameters {\n DistributionParameters base;\n // Uniswap pool data\n uint24 poolFee;\n UniswapTokenData token0;\n UniswapTokenData token1;\n // rewardToken data\n string rewardTokenSymbol;\n uint8 rewardTokenDecimals;\n}\n" + }, + "contracts/struct/RewardTokenAmounts.sol": { + "content": "// SPDX-License-Identifier: BUSL-1.1\n\npragma solidity ^0.8.17;\n\nstruct RewardTokenAmounts {\n address token;\n uint256 minimumAmountPerEpoch;\n}\n" + }, + "contracts/utils/Errors.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nerror InvalidDispute();\nerror InvalidLengths();\nerror InvalidParam();\nerror InvalidParams();\nerror InvalidProof();\nerror InvalidUninitializedRoot();\nerror InvalidReward();\nerror InvalidSignature();\nerror NoDispute();\nerror NotGovernor();\nerror NotGovernorOrGuardian();\nerror NotSigned();\nerror NotTrusted();\nerror NotWhitelisted();\nerror UnresolvedDispute();\nerror ZeroAddress();\n" + }, + "contracts/utils/UUPSHelper.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\n/*\n * █ \n ***** ▓▓▓ \n * ▓▓▓▓▓▓▓ \n * ///. ▓▓▓▓▓▓▓▓▓▓▓▓▓ \n ***** //////// ▓▓▓▓▓▓▓ \n * ///////////// ▓▓▓ \n ▓▓ ////////////////// █ ▓▓ \n ▓▓ ▓▓ /////////////////////// ▓▓ ▓▓ \n ▓▓ ▓▓ //////////////////////////// ▓▓ ▓▓ \n ▓▓ ▓▓ /////////▓▓▓///////▓▓▓///////// ▓▓ ▓▓ \n ▓▓ ,////////////////////////////////////// ▓▓ ▓▓ \n ▓▓ ////////////////////////////////////////// ▓▓ \n ▓▓ //////////////////////▓▓▓▓///////////////////// \n ,//////////////////////////////////////////////////// \n .////////////////////////////////////////////////////////// \n .//////////////////////////██.,//////////////////////////█ \n .//////////////////////████..,./////////////////////██ \n ...////////////////███████.....,.////////////////███ \n ,.,////////////████████ ........,///////////████ \n .,.,//////█████████ ,.......///////████ \n ,..//████████ ........./████ \n ..,██████ .....,███ \n .██ ,.,█ \n \n \n \n ▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓ ▓▓▓▓▓▓▓▓▓▓ \n ▓▓▓▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓ ▓▓ ▓▓▓▓ \n ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓ ▓▓▓▓▓ \n ▓▓▓ ▓▓ ▓▓▓ ▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ \n*/\n\npragma solidity ^0.8.17;\n\nimport { UUPSUpgradeable } from \"@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol\";\n\nimport { ICore } from \"../interfaces/ICore.sol\";\nimport \"../utils/Errors.sol\";\n\n/// @title UUPSHelper\n/// @notice Helper contract for UUPSUpgradeable contracts where the upgradeability is controlled by a specific address\n/// @author Angle Labs., Inc\n/// @dev The 0 address check in the modifier allows the use of these modifiers during initialization\nabstract contract UUPSHelper is UUPSUpgradeable {\n modifier onlyGuardianUpgrader(ICore _core) {\n if (address(_core) != address(0) && !_core.isGovernorOrGuardian(msg.sender)) revert NotGovernorOrGuardian();\n _;\n }\n\n modifier onlyGovernorUpgrader(ICore _core) {\n if (address(_core) != address(0) && !_core.isGovernor(msg.sender)) revert NotGovernor();\n _;\n }\n\n constructor() initializer {}\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 100 + }, + "viaIR": false, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata" + ], + "": [ + "ast" + ] + } + } + } +} \ No newline at end of file diff --git a/deployments/coredao/solcInputs/e77f17fbb4334e4df730b35bdfde2517.json b/deployments/coredao/solcInputs/e77f17fbb4334e4df730b35bdfde2517.json new file mode 100644 index 0000000..00dbd19 --- /dev/null +++ b/deployments/coredao/solcInputs/e77f17fbb4334e4df730b35bdfde2517.json @@ -0,0 +1,213 @@ +{ + "language": "Solidity", + "sources": { + "@openzeppelin/contracts-upgradeable/interfaces/draft-IERC1822Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\n * proxy whose upgrades are fully controlled by the current implementation.\n */\ninterface IERC1822ProxiableUpgradeable {\n /**\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\n * address.\n *\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\n * function revert if invoked through a proxy.\n */\n function proxiableUUID() external view returns (bytes32);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/proxy/beacon/IBeaconUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\n */\ninterface IBeaconUpgradeable {\n /**\n * @dev Must return an address that can be used as a delegate call target.\n *\n * {BeaconProxy} will check that this address is a contract.\n */\n function implementation() external view returns (address);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/proxy/ERC1967/ERC1967UpgradeUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (proxy/ERC1967/ERC1967Upgrade.sol)\n\npragma solidity ^0.8.2;\n\nimport \"../beacon/IBeaconUpgradeable.sol\";\nimport \"../../interfaces/draft-IERC1822Upgradeable.sol\";\nimport \"../../utils/AddressUpgradeable.sol\";\nimport \"../../utils/StorageSlotUpgradeable.sol\";\nimport \"../utils/Initializable.sol\";\n\n/**\n * @dev This abstract contract provides getters and event emitting update functions for\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\n *\n * _Available since v4.1._\n *\n * @custom:oz-upgrades-unsafe-allow delegatecall\n */\nabstract contract ERC1967UpgradeUpgradeable is Initializable {\n function __ERC1967Upgrade_init() internal onlyInitializing {\n }\n\n function __ERC1967Upgrade_init_unchained() internal onlyInitializing {\n }\n // This is the keccak-256 hash of \"eip1967.proxy.rollback\" subtracted by 1\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\n\n /**\n * @dev Storage slot with the address of the current implementation.\n * This is the keccak-256 hash of \"eip1967.proxy.implementation\" subtracted by 1, and is\n * validated in the constructor.\n */\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n\n /**\n * @dev Emitted when the implementation is upgraded.\n */\n event Upgraded(address indexed implementation);\n\n /**\n * @dev Returns the current implementation address.\n */\n function _getImplementation() internal view returns (address) {\n return StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value;\n }\n\n /**\n * @dev Stores a new address in the EIP1967 implementation slot.\n */\n function _setImplementation(address newImplementation) private {\n require(AddressUpgradeable.isContract(newImplementation), \"ERC1967: new implementation is not a contract\");\n StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\n }\n\n /**\n * @dev Perform implementation upgrade\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeTo(address newImplementation) internal {\n _setImplementation(newImplementation);\n emit Upgraded(newImplementation);\n }\n\n /**\n * @dev Perform implementation upgrade with additional setup call.\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeToAndCall(\n address newImplementation,\n bytes memory data,\n bool forceCall\n ) internal {\n _upgradeTo(newImplementation);\n if (data.length > 0 || forceCall) {\n _functionDelegateCall(newImplementation, data);\n }\n }\n\n /**\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeToAndCallUUPS(\n address newImplementation,\n bytes memory data,\n bool forceCall\n ) internal {\n // Upgrades from old implementations will perform a rollback test. This test requires the new\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\n // this special case will break upgrade paths from old UUPS implementation to new ones.\n if (StorageSlotUpgradeable.getBooleanSlot(_ROLLBACK_SLOT).value) {\n _setImplementation(newImplementation);\n } else {\n try IERC1822ProxiableUpgradeable(newImplementation).proxiableUUID() returns (bytes32 slot) {\n require(slot == _IMPLEMENTATION_SLOT, \"ERC1967Upgrade: unsupported proxiableUUID\");\n } catch {\n revert(\"ERC1967Upgrade: new implementation is not UUPS\");\n }\n _upgradeToAndCall(newImplementation, data, forceCall);\n }\n }\n\n /**\n * @dev Storage slot with the admin of the contract.\n * This is the keccak-256 hash of \"eip1967.proxy.admin\" subtracted by 1, and is\n * validated in the constructor.\n */\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\n\n /**\n * @dev Emitted when the admin account has changed.\n */\n event AdminChanged(address previousAdmin, address newAdmin);\n\n /**\n * @dev Returns the current admin.\n */\n function _getAdmin() internal view returns (address) {\n return StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value;\n }\n\n /**\n * @dev Stores a new address in the EIP1967 admin slot.\n */\n function _setAdmin(address newAdmin) private {\n require(newAdmin != address(0), \"ERC1967: new admin is the zero address\");\n StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\n }\n\n /**\n * @dev Changes the admin of the proxy.\n *\n * Emits an {AdminChanged} event.\n */\n function _changeAdmin(address newAdmin) internal {\n emit AdminChanged(_getAdmin(), newAdmin);\n _setAdmin(newAdmin);\n }\n\n /**\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\n */\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\n\n /**\n * @dev Emitted when the beacon is upgraded.\n */\n event BeaconUpgraded(address indexed beacon);\n\n /**\n * @dev Returns the current beacon.\n */\n function _getBeacon() internal view returns (address) {\n return StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value;\n }\n\n /**\n * @dev Stores a new beacon in the EIP1967 beacon slot.\n */\n function _setBeacon(address newBeacon) private {\n require(AddressUpgradeable.isContract(newBeacon), \"ERC1967: new beacon is not a contract\");\n require(\n AddressUpgradeable.isContract(IBeaconUpgradeable(newBeacon).implementation()),\n \"ERC1967: beacon implementation is not a contract\"\n );\n StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value = newBeacon;\n }\n\n /**\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\n *\n * Emits a {BeaconUpgraded} event.\n */\n function _upgradeBeaconToAndCall(\n address newBeacon,\n bytes memory data,\n bool forceCall\n ) internal {\n _setBeacon(newBeacon);\n emit BeaconUpgraded(newBeacon);\n if (data.length > 0 || forceCall) {\n _functionDelegateCall(IBeaconUpgradeable(newBeacon).implementation(), data);\n }\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function _functionDelegateCall(address target, bytes memory data) private returns (bytes memory) {\n require(AddressUpgradeable.isContract(target), \"Address: delegate call to non-contract\");\n\n // solhint-disable-next-line avoid-low-level-calls\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return AddressUpgradeable.verifyCallResult(success, returndata, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.1) (proxy/utils/Initializable.sol)\n\npragma solidity ^0.8.2;\n\nimport \"../../utils/AddressUpgradeable.sol\";\n\n/**\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\n *\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\n * reused. This mechanism prevents re-execution of each \"step\" but allows the creation of new initialization steps in\n * case an upgrade adds a module that needs to be initialized.\n *\n * For example:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * contract MyToken is ERC20Upgradeable {\n * function initialize() initializer public {\n * __ERC20_init(\"MyToken\", \"MTK\");\n * }\n * }\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\n * function initializeV2() reinitializer(2) public {\n * __ERC20Permit_init(\"MyToken\");\n * }\n * }\n * ```\n *\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\n *\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\n *\n * [CAUTION]\n * ====\n * Avoid leaving a contract uninitialized.\n *\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * /// @custom:oz-upgrades-unsafe-allow constructor\n * constructor() {\n * _disableInitializers();\n * }\n * ```\n * ====\n */\nabstract contract Initializable {\n /**\n * @dev Indicates that the contract has been initialized.\n * @custom:oz-retyped-from bool\n */\n uint8 private _initialized;\n\n /**\n * @dev Indicates that the contract is in the process of being initialized.\n */\n bool private _initializing;\n\n /**\n * @dev Triggered when the contract has been initialized or reinitialized.\n */\n event Initialized(uint8 version);\n\n /**\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\n * `onlyInitializing` functions can be used to initialize parent contracts.\n *\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\n * constructor.\n *\n * Emits an {Initialized} event.\n */\n modifier initializer() {\n bool isTopLevelCall = !_initializing;\n require(\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\n \"Initializable: contract is already initialized\"\n );\n _initialized = 1;\n if (isTopLevelCall) {\n _initializing = true;\n }\n _;\n if (isTopLevelCall) {\n _initializing = false;\n emit Initialized(1);\n }\n }\n\n /**\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\n * used to initialize parent contracts.\n *\n * A reinitializer may be used after the original initialization step. This is essential to configure modules that\n * are added through upgrades and that require initialization.\n *\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\n * cannot be nested. If one is invoked in the context of another, execution will revert.\n *\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\n * a contract, executing them in the right order is up to the developer or operator.\n *\n * WARNING: setting the version to 255 will prevent any future reinitialization.\n *\n * Emits an {Initialized} event.\n */\n modifier reinitializer(uint8 version) {\n require(!_initializing && _initialized < version, \"Initializable: contract is already initialized\");\n _initialized = version;\n _initializing = true;\n _;\n _initializing = false;\n emit Initialized(version);\n }\n\n /**\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\n */\n modifier onlyInitializing() {\n require(_initializing, \"Initializable: contract is not initializing\");\n _;\n }\n\n /**\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\n * through proxies.\n *\n * Emits an {Initialized} event the first time it is successfully executed.\n */\n function _disableInitializers() internal virtual {\n require(!_initializing, \"Initializable: contract is initializing\");\n if (_initialized < type(uint8).max) {\n _initialized = type(uint8).max;\n emit Initialized(type(uint8).max);\n }\n }\n\n /**\n * @dev Returns the highest version that has been initialized. See {reinitializer}.\n */\n function _getInitializedVersion() internal view returns (uint8) {\n return _initialized;\n }\n\n /**\n * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.\n */\n function _isInitializing() internal view returns (bool) {\n return _initializing;\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (proxy/utils/UUPSUpgradeable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../interfaces/draft-IERC1822Upgradeable.sol\";\nimport \"../ERC1967/ERC1967UpgradeUpgradeable.sol\";\nimport \"./Initializable.sol\";\n\n/**\n * @dev An upgradeability mechanism designed for UUPS proxies. The functions included here can perform an upgrade of an\n * {ERC1967Proxy}, when this contract is set as the implementation behind such a proxy.\n *\n * A security mechanism ensures that an upgrade does not turn off upgradeability accidentally, although this risk is\n * reinstated if the upgrade retains upgradeability but removes the security mechanism, e.g. by replacing\n * `UUPSUpgradeable` with a custom implementation of upgrades.\n *\n * The {_authorizeUpgrade} function must be overridden to include access restriction to the upgrade mechanism.\n *\n * _Available since v4.1._\n */\nabstract contract UUPSUpgradeable is Initializable, IERC1822ProxiableUpgradeable, ERC1967UpgradeUpgradeable {\n function __UUPSUpgradeable_init() internal onlyInitializing {\n }\n\n function __UUPSUpgradeable_init_unchained() internal onlyInitializing {\n }\n /// @custom:oz-upgrades-unsafe-allow state-variable-immutable state-variable-assignment\n address private immutable __self = address(this);\n\n /**\n * @dev Check that the execution is being performed through a delegatecall call and that the execution context is\n * a proxy contract with an implementation (as defined in ERC1967) pointing to self. This should only be the case\n * for UUPS and transparent proxies that are using the current contract as their implementation. Execution of a\n * function through ERC1167 minimal proxies (clones) would not normally pass this test, but is not guaranteed to\n * fail.\n */\n modifier onlyProxy() {\n require(address(this) != __self, \"Function must be called through delegatecall\");\n require(_getImplementation() == __self, \"Function must be called through active proxy\");\n _;\n }\n\n /**\n * @dev Check that the execution is not being performed through a delegate call. This allows a function to be\n * callable on the implementing contract but not through proxies.\n */\n modifier notDelegated() {\n require(address(this) == __self, \"UUPSUpgradeable: must not be called through delegatecall\");\n _;\n }\n\n /**\n * @dev Implementation of the ERC1822 {proxiableUUID} function. This returns the storage slot used by the\n * implementation. It is used to validate the implementation's compatibility when performing an upgrade.\n *\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\n * function revert if invoked through a proxy. This is guaranteed by the `notDelegated` modifier.\n */\n function proxiableUUID() external view virtual override notDelegated returns (bytes32) {\n return _IMPLEMENTATION_SLOT;\n }\n\n /**\n * @dev Upgrade the implementation of the proxy to `newImplementation`.\n *\n * Calls {_authorizeUpgrade}.\n *\n * Emits an {Upgraded} event.\n */\n function upgradeTo(address newImplementation) external virtual onlyProxy {\n _authorizeUpgrade(newImplementation);\n _upgradeToAndCallUUPS(newImplementation, new bytes(0), false);\n }\n\n /**\n * @dev Upgrade the implementation of the proxy to `newImplementation`, and subsequently execute the function call\n * encoded in `data`.\n *\n * Calls {_authorizeUpgrade}.\n *\n * Emits an {Upgraded} event.\n */\n function upgradeToAndCall(address newImplementation, bytes memory data) external payable virtual onlyProxy {\n _authorizeUpgrade(newImplementation);\n _upgradeToAndCallUUPS(newImplementation, data, true);\n }\n\n /**\n * @dev Function that should revert when `msg.sender` is not authorized to upgrade the contract. Called by\n * {upgradeTo} and {upgradeToAndCall}.\n *\n * Normally, this function will use an xref:access.adoc[access control] modifier such as {Ownable-onlyOwner}.\n *\n * ```solidity\n * function _authorizeUpgrade(address) internal override onlyOwner {}\n * ```\n */\n function _authorizeUpgrade(address newImplementation) internal virtual;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (security/ReentrancyGuard.sol)\n\npragma solidity ^0.8.0;\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Contract module that helps prevent reentrant calls to a function.\n *\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\n * available, which can be applied to functions to make sure there are no nested\n * (reentrant) calls to them.\n *\n * Note that because there is a single `nonReentrant` guard, functions marked as\n * `nonReentrant` may not call one another. This can be worked around by making\n * those functions `private`, and then adding `external` `nonReentrant` entry\n * points to them.\n *\n * TIP: If you would like to learn more about reentrancy and alternative ways\n * to protect against it, check out our blog post\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\n */\nabstract contract ReentrancyGuardUpgradeable is Initializable {\n // Booleans are more expensive than uint256 or any type that takes up a full\n // word because each write operation emits an extra SLOAD to first read the\n // slot's contents, replace the bits taken up by the boolean, and then write\n // back. This is the compiler's defense against contract upgrades and\n // pointer aliasing, and it cannot be disabled.\n\n // The values being non-zero value makes deployment a bit more expensive,\n // but in exchange the refund on every call to nonReentrant will be lower in\n // amount. Since refunds are capped to a percentage of the total\n // transaction's gas, it is best to keep them low in cases like this one, to\n // increase the likelihood of the full refund coming into effect.\n uint256 private constant _NOT_ENTERED = 1;\n uint256 private constant _ENTERED = 2;\n\n uint256 private _status;\n\n function __ReentrancyGuard_init() internal onlyInitializing {\n __ReentrancyGuard_init_unchained();\n }\n\n function __ReentrancyGuard_init_unchained() internal onlyInitializing {\n _status = _NOT_ENTERED;\n }\n\n /**\n * @dev Prevents a contract from calling itself, directly or indirectly.\n * Calling a `nonReentrant` function from another `nonReentrant`\n * function is not supported. It is possible to prevent this from happening\n * by making the `nonReentrant` function external, and making it call a\n * `private` function that does the actual work.\n */\n modifier nonReentrant() {\n _nonReentrantBefore();\n _;\n _nonReentrantAfter();\n }\n\n function _nonReentrantBefore() private {\n // On the first call to nonReentrant, _status will be _NOT_ENTERED\n require(_status != _ENTERED, \"ReentrancyGuard: reentrant call\");\n\n // Any calls to nonReentrant after this point will fail\n _status = _ENTERED;\n }\n\n function _nonReentrantAfter() private {\n // By storing the original value once again, a refund is triggered (see\n // https://eips.ethereum.org/EIPS/eip-2200)\n _status = _NOT_ENTERED;\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[49] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20Upgradeable {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary AddressUpgradeable {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/math/MathUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary MathUpgradeable {\n enum Rounding {\n Down, // Toward negative infinity\n Up, // Toward infinity\n Zero // Toward zero\n }\n\n /**\n * @dev Returns the largest of two numbers.\n */\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two numbers.\n */\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two numbers. The result is rounded towards\n * zero.\n */\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b) / 2 can overflow.\n return (a & b) + (a ^ b) / 2;\n }\n\n /**\n * @dev Returns the ceiling of the division of two numbers.\n *\n * This differs from standard division with `/` in that it rounds up instead\n * of rounding down.\n */\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b - 1) / b can overflow on addition, so we distribute.\n return a == 0 ? 0 : (a - 1) / b + 1;\n }\n\n /**\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\n * with further edits by Uniswap Labs also under MIT license.\n */\n function mulDiv(\n uint256 x,\n uint256 y,\n uint256 denominator\n ) internal pure returns (uint256 result) {\n unchecked {\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\n // variables such that product = prod1 * 2^256 + prod0.\n uint256 prod0; // Least significant 256 bits of the product\n uint256 prod1; // Most significant 256 bits of the product\n assembly {\n let mm := mulmod(x, y, not(0))\n prod0 := mul(x, y)\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n }\n\n // Handle non-overflow cases, 256 by 256 division.\n if (prod1 == 0) {\n return prod0 / denominator;\n }\n\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\n require(denominator > prod1);\n\n ///////////////////////////////////////////////\n // 512 by 256 division.\n ///////////////////////////////////////////////\n\n // Make division exact by subtracting the remainder from [prod1 prod0].\n uint256 remainder;\n assembly {\n // Compute remainder using mulmod.\n remainder := mulmod(x, y, denominator)\n\n // Subtract 256 bit number from 512 bit number.\n prod1 := sub(prod1, gt(remainder, prod0))\n prod0 := sub(prod0, remainder)\n }\n\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\n // See https://cs.stackexchange.com/q/138556/92363.\n\n // Does not overflow because the denominator cannot be zero at this stage in the function.\n uint256 twos = denominator & (~denominator + 1);\n assembly {\n // Divide denominator by twos.\n denominator := div(denominator, twos)\n\n // Divide [prod1 prod0] by twos.\n prod0 := div(prod0, twos)\n\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\n twos := add(div(sub(0, twos), twos), 1)\n }\n\n // Shift in bits from prod1 into prod0.\n prod0 |= prod1 * twos;\n\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\n // four bits. That is, denominator * inv = 1 mod 2^4.\n uint256 inverse = (3 * denominator) ^ 2;\n\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\n // in modular arithmetic, doubling the correct bits in each step.\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\n\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\n // is no longer required.\n result = prod0 * inverse;\n return result;\n }\n }\n\n /**\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\n */\n function mulDiv(\n uint256 x,\n uint256 y,\n uint256 denominator,\n Rounding rounding\n ) internal pure returns (uint256) {\n uint256 result = mulDiv(x, y, denominator);\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\n result += 1;\n }\n return result;\n }\n\n /**\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\n *\n * Inspired by Henry S. Warren, Jr.'s \"Hacker's Delight\" (Chapter 11).\n */\n function sqrt(uint256 a) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\n //\n // We know that the \"msb\" (most significant bit) of our target number `a` is a power of 2 such that we have\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\n //\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\n // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\n // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\n //\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\n uint256 result = 1 << (log2(a) >> 1);\n\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\n // into the expected uint128 result.\n unchecked {\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n return min(result, a / result);\n }\n }\n\n /**\n * @notice Calculates sqrt(a), following the selected rounding direction.\n */\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = sqrt(a);\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 2, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 128;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 64;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 32;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 16;\n }\n if (value >> 8 > 0) {\n value >>= 8;\n result += 8;\n }\n if (value >> 4 > 0) {\n value >>= 4;\n result += 4;\n }\n if (value >> 2 > 0) {\n value >>= 2;\n result += 2;\n }\n if (value >> 1 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log2(value);\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 10, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >= 10**64) {\n value /= 10**64;\n result += 64;\n }\n if (value >= 10**32) {\n value /= 10**32;\n result += 32;\n }\n if (value >= 10**16) {\n value /= 10**16;\n result += 16;\n }\n if (value >= 10**8) {\n value /= 10**8;\n result += 8;\n }\n if (value >= 10**4) {\n value /= 10**4;\n result += 4;\n }\n if (value >= 10**2) {\n value /= 10**2;\n result += 2;\n }\n if (value >= 10**1) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log10(value);\n return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 256, rounded down, of a positive value.\n * Returns 0 if given 0.\n *\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\n */\n function log256(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 16;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 8;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 4;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 2;\n }\n if (value >> 8 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log256(value);\n return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0);\n }\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/StorageSlotUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/StorageSlot.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Library for reading and writing primitive types to specific storage slots.\n *\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\n * This library helps with reading and writing to such slots without the need for inline assembly.\n *\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\n *\n * Example usage to set ERC1967 implementation slot:\n * ```\n * contract ERC1967 {\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n *\n * function _getImplementation() internal view returns (address) {\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\n * }\n *\n * function _setImplementation(address newImplementation) internal {\n * require(Address.isContract(newImplementation), \"ERC1967: new implementation is not a contract\");\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\n * }\n * }\n * ```\n *\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\n */\nlibrary StorageSlotUpgradeable {\n struct AddressSlot {\n address value;\n }\n\n struct BooleanSlot {\n bool value;\n }\n\n struct Bytes32Slot {\n bytes32 value;\n }\n\n struct Uint256Slot {\n uint256 value;\n }\n\n /**\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\n */\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\n */\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\n */\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\n */\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./math/MathUpgradeable.sol\";\n\n/**\n * @dev String operations.\n */\nlibrary StringsUpgradeable {\n bytes16 private constant _SYMBOLS = \"0123456789abcdef\";\n uint8 private constant _ADDRESS_LENGTH = 20;\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n */\n function toString(uint256 value) internal pure returns (string memory) {\n unchecked {\n uint256 length = MathUpgradeable.log10(value) + 1;\n string memory buffer = new string(length);\n uint256 ptr;\n /// @solidity memory-safe-assembly\n assembly {\n ptr := add(buffer, add(32, length))\n }\n while (true) {\n ptr--;\n /// @solidity memory-safe-assembly\n assembly {\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\n }\n value /= 10;\n if (value == 0) break;\n }\n return buffer;\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n */\n function toHexString(uint256 value) internal pure returns (string memory) {\n unchecked {\n return toHexString(value, MathUpgradeable.log256(value) + 1);\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n */\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n bytes memory buffer = new bytes(2 * length + 2);\n buffer[0] = \"0\";\n buffer[1] = \"x\";\n for (uint256 i = 2 * length + 1; i > 1; --i) {\n buffer[i] = _SYMBOLS[value & 0xf];\n value >>= 4;\n }\n require(value == 0, \"Strings: hex length insufficient\");\n return string(buffer);\n }\n\n /**\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\n */\n function toHexString(address addr) internal pure returns (string memory) {\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\n }\n}\n" + }, + "@openzeppelin/contracts/access/Ownable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n constructor() {\n _transferOwnership(_msgSender());\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n _checkOwner();\n _;\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if the sender is not the owner.\n */\n function _checkOwner() internal view virtual {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions anymore. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby removing any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n" + }, + "@openzeppelin/contracts/interfaces/draft-IERC1822.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\n * proxy whose upgrades are fully controlled by the current implementation.\n */\ninterface IERC1822Proxiable {\n /**\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\n * address.\n *\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\n * function revert if invoked through a proxy.\n */\n function proxiableUUID() external view returns (bytes32);\n}\n" + }, + "@openzeppelin/contracts/proxy/beacon/IBeacon.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\n */\ninterface IBeacon {\n /**\n * @dev Must return an address that can be used as a delegate call target.\n *\n * {BeaconProxy} will check that this address is a contract.\n */\n function implementation() external view returns (address);\n}\n" + }, + "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/ERC1967/ERC1967Proxy.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../Proxy.sol\";\nimport \"./ERC1967Upgrade.sol\";\n\n/**\n * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an\n * implementation address that can be changed. This address is stored in storage in the location specified by\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the\n * implementation behind the proxy.\n */\ncontract ERC1967Proxy is Proxy, ERC1967Upgrade {\n /**\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.\n *\n * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded\n * function call, and allows initializing the storage of the proxy like a Solidity constructor.\n */\n constructor(address _logic, bytes memory _data) payable {\n _upgradeToAndCall(_logic, _data, false);\n }\n\n /**\n * @dev Returns the current implementation address.\n */\n function _implementation() internal view virtual override returns (address impl) {\n return ERC1967Upgrade._getImplementation();\n }\n}\n" + }, + "@openzeppelin/contracts/proxy/ERC1967/ERC1967Upgrade.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (proxy/ERC1967/ERC1967Upgrade.sol)\n\npragma solidity ^0.8.2;\n\nimport \"../beacon/IBeacon.sol\";\nimport \"../../interfaces/draft-IERC1822.sol\";\nimport \"../../utils/Address.sol\";\nimport \"../../utils/StorageSlot.sol\";\n\n/**\n * @dev This abstract contract provides getters and event emitting update functions for\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\n *\n * _Available since v4.1._\n *\n * @custom:oz-upgrades-unsafe-allow delegatecall\n */\nabstract contract ERC1967Upgrade {\n // This is the keccak-256 hash of \"eip1967.proxy.rollback\" subtracted by 1\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\n\n /**\n * @dev Storage slot with the address of the current implementation.\n * This is the keccak-256 hash of \"eip1967.proxy.implementation\" subtracted by 1, and is\n * validated in the constructor.\n */\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n\n /**\n * @dev Emitted when the implementation is upgraded.\n */\n event Upgraded(address indexed implementation);\n\n /**\n * @dev Returns the current implementation address.\n */\n function _getImplementation() internal view returns (address) {\n return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\n }\n\n /**\n * @dev Stores a new address in the EIP1967 implementation slot.\n */\n function _setImplementation(address newImplementation) private {\n require(Address.isContract(newImplementation), \"ERC1967: new implementation is not a contract\");\n StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\n }\n\n /**\n * @dev Perform implementation upgrade\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeTo(address newImplementation) internal {\n _setImplementation(newImplementation);\n emit Upgraded(newImplementation);\n }\n\n /**\n * @dev Perform implementation upgrade with additional setup call.\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeToAndCall(\n address newImplementation,\n bytes memory data,\n bool forceCall\n ) internal {\n _upgradeTo(newImplementation);\n if (data.length > 0 || forceCall) {\n Address.functionDelegateCall(newImplementation, data);\n }\n }\n\n /**\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeToAndCallUUPS(\n address newImplementation,\n bytes memory data,\n bool forceCall\n ) internal {\n // Upgrades from old implementations will perform a rollback test. This test requires the new\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\n // this special case will break upgrade paths from old UUPS implementation to new ones.\n if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) {\n _setImplementation(newImplementation);\n } else {\n try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {\n require(slot == _IMPLEMENTATION_SLOT, \"ERC1967Upgrade: unsupported proxiableUUID\");\n } catch {\n revert(\"ERC1967Upgrade: new implementation is not UUPS\");\n }\n _upgradeToAndCall(newImplementation, data, forceCall);\n }\n }\n\n /**\n * @dev Storage slot with the admin of the contract.\n * This is the keccak-256 hash of \"eip1967.proxy.admin\" subtracted by 1, and is\n * validated in the constructor.\n */\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\n\n /**\n * @dev Emitted when the admin account has changed.\n */\n event AdminChanged(address previousAdmin, address newAdmin);\n\n /**\n * @dev Returns the current admin.\n */\n function _getAdmin() internal view returns (address) {\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\n }\n\n /**\n * @dev Stores a new address in the EIP1967 admin slot.\n */\n function _setAdmin(address newAdmin) private {\n require(newAdmin != address(0), \"ERC1967: new admin is the zero address\");\n StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\n }\n\n /**\n * @dev Changes the admin of the proxy.\n *\n * Emits an {AdminChanged} event.\n */\n function _changeAdmin(address newAdmin) internal {\n emit AdminChanged(_getAdmin(), newAdmin);\n _setAdmin(newAdmin);\n }\n\n /**\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\n */\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\n\n /**\n * @dev Emitted when the beacon is upgraded.\n */\n event BeaconUpgraded(address indexed beacon);\n\n /**\n * @dev Returns the current beacon.\n */\n function _getBeacon() internal view returns (address) {\n return StorageSlot.getAddressSlot(_BEACON_SLOT).value;\n }\n\n /**\n * @dev Stores a new beacon in the EIP1967 beacon slot.\n */\n function _setBeacon(address newBeacon) private {\n require(Address.isContract(newBeacon), \"ERC1967: new beacon is not a contract\");\n require(\n Address.isContract(IBeacon(newBeacon).implementation()),\n \"ERC1967: beacon implementation is not a contract\"\n );\n StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon;\n }\n\n /**\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\n *\n * Emits a {BeaconUpgraded} event.\n */\n function _upgradeBeaconToAndCall(\n address newBeacon,\n bytes memory data,\n bool forceCall\n ) internal {\n _setBeacon(newBeacon);\n emit BeaconUpgraded(newBeacon);\n if (data.length > 0 || forceCall) {\n Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/proxy/Proxy.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (proxy/Proxy.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\n * be specified by overriding the virtual {_implementation} function.\n *\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\n * different contract through the {_delegate} function.\n *\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\n */\nabstract contract Proxy {\n /**\n * @dev Delegates the current call to `implementation`.\n *\n * This function does not return to its internal call site, it will return directly to the external caller.\n */\n function _delegate(address implementation) internal virtual {\n assembly {\n // Copy msg.data. We take full control of memory in this inline assembly\n // block because it will not return to Solidity code. We overwrite the\n // Solidity scratch pad at memory position 0.\n calldatacopy(0, 0, calldatasize())\n\n // Call the implementation.\n // out and outsize are 0 because we don't know the size yet.\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\n\n // Copy the returned data.\n returndatacopy(0, 0, returndatasize())\n\n switch result\n // delegatecall returns 0 on error.\n case 0 {\n revert(0, returndatasize())\n }\n default {\n return(0, returndatasize())\n }\n }\n }\n\n /**\n * @dev This is a virtual function that should be overridden so it returns the address to which the fallback function\n * and {_fallback} should delegate.\n */\n function _implementation() internal view virtual returns (address);\n\n /**\n * @dev Delegates the current call to the address returned by `_implementation()`.\n *\n * This function does not return to its internal call site, it will return directly to the external caller.\n */\n function _fallback() internal virtual {\n _beforeFallback();\n _delegate(_implementation());\n }\n\n /**\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\n * function in the contract matches the call data.\n */\n fallback() external payable virtual {\n _fallback();\n }\n\n /**\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data\n * is empty.\n */\n receive() external payable virtual {\n _fallback();\n }\n\n /**\n * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`\n * call, or as part of the Solidity `fallback` or `receive` functions.\n *\n * If overridden should call `super._beforeFallback()`.\n */\n function _beforeFallback() internal virtual {}\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/ERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/ERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC20.sol\";\nimport \"./extensions/IERC20Metadata.sol\";\nimport \"../../utils/Context.sol\";\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n * For a generic mechanism see {ERC20PresetMinterPauser}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\n * instead returning `false` on failure. This behavior is nonetheless\n * conventional and does not conflict with the expectations of ERC20\n * applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the EIP may not emit\n * these events, as it isn't required by the specification.\n *\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\n * functions have been added to mitigate the well-known issues around setting\n * allowances. See {IERC20-approve}.\n */\ncontract ERC20 is Context, IERC20, IERC20Metadata {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n\n /**\n * @dev Sets the values for {name} and {symbol}.\n *\n * The default value of {decimals} is 18. To select a different value for\n * {decimals} you should overload it.\n *\n * All two of these values are immutable: they can only be set once during\n * construction.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev Returns the name of the token.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev Returns the number of decimals used to get its user representation.\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\n *\n * Tokens usually opt for a value of 18, imitating the relationship between\n * Ether and Wei. This is the value {ERC20} uses, unless this function is\n * overridden;\n *\n * NOTE: This information is only used for _display_ purposes: it in\n * no way affects any of the arithmetic of the contract, including\n * {IERC20-balanceOf} and {IERC20-transfer}.\n */\n function decimals() public view virtual override returns (uint8) {\n return 18;\n }\n\n /**\n * @dev See {IERC20-totalSupply}.\n */\n function totalSupply() public view virtual override returns (uint256) {\n return _totalSupply;\n }\n\n /**\n * @dev See {IERC20-balanceOf}.\n */\n function balanceOf(address account) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n /**\n * @dev See {IERC20-transfer}.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - the caller must have a balance of at least `amount`.\n */\n function transfer(address to, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _transfer(owner, to, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-allowance}.\n */\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n /**\n * @dev See {IERC20-approve}.\n *\n * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on\n * `transferFrom`. This is semantically equivalent to an infinite approval.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-transferFrom}.\n *\n * Emits an {Approval} event indicating the updated allowance. This is not\n * required by the EIP. See the note at the beginning of {ERC20}.\n *\n * NOTE: Does not update the allowance if the current allowance\n * is the maximum `uint256`.\n *\n * Requirements:\n *\n * - `from` and `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n * - the caller must have allowance for ``from``'s tokens of at least\n * `amount`.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) public virtual override returns (bool) {\n address spender = _msgSender();\n _spendAllowance(from, spender, amount);\n _transfer(from, to, amount);\n return true;\n }\n\n /**\n * @dev Atomically increases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, allowance(owner, spender) + addedValue);\n return true;\n }\n\n /**\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `spender` must have allowance for the caller of at least\n * `subtractedValue`.\n */\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\n address owner = _msgSender();\n uint256 currentAllowance = allowance(owner, spender);\n require(currentAllowance >= subtractedValue, \"ERC20: decreased allowance below zero\");\n unchecked {\n _approve(owner, spender, currentAllowance - subtractedValue);\n }\n\n return true;\n }\n\n /**\n * @dev Moves `amount` of tokens from `from` to `to`.\n *\n * This internal function is equivalent to {transfer}, and can be used to\n * e.g. implement automatic token fees, slashing mechanisms, etc.\n *\n * Emits a {Transfer} event.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n */\n function _transfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, amount);\n\n uint256 fromBalance = _balances[from];\n require(fromBalance >= amount, \"ERC20: transfer amount exceeds balance\");\n unchecked {\n _balances[from] = fromBalance - amount;\n // Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by\n // decrementing then incrementing.\n _balances[to] += amount;\n }\n\n emit Transfer(from, to, amount);\n\n _afterTokenTransfer(from, to, amount);\n }\n\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\n * the total supply.\n *\n * Emits a {Transfer} event with `from` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _beforeTokenTransfer(address(0), account, amount);\n\n _totalSupply += amount;\n unchecked {\n // Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above.\n _balances[account] += amount;\n }\n emit Transfer(address(0), account, amount);\n\n _afterTokenTransfer(address(0), account, amount);\n }\n\n /**\n * @dev Destroys `amount` tokens from `account`, reducing the\n * total supply.\n *\n * Emits a {Transfer} event with `to` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n * - `account` must have at least `amount` tokens.\n */\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n _beforeTokenTransfer(account, address(0), amount);\n\n uint256 accountBalance = _balances[account];\n require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n unchecked {\n _balances[account] = accountBalance - amount;\n // Overflow not possible: amount <= accountBalance <= totalSupply.\n _totalSupply -= amount;\n }\n\n emit Transfer(account, address(0), amount);\n\n _afterTokenTransfer(account, address(0), amount);\n }\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\n *\n * This internal function is equivalent to `approve`, and can be used to\n * e.g. set automatic allowances for certain subsystems, etc.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `owner` cannot be the zero address.\n * - `spender` cannot be the zero address.\n */\n function _approve(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n emit Approval(owner, spender, amount);\n }\n\n /**\n * @dev Updates `owner` s allowance for `spender` based on spent `amount`.\n *\n * Does not update the allowance amount in case of infinite allowance.\n * Revert if not enough allowance is available.\n *\n * Might emit an {Approval} event.\n */\n function _spendAllowance(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n uint256 currentAllowance = allowance(owner, spender);\n if (currentAllowance != type(uint256).max) {\n require(currentAllowance >= amount, \"ERC20: insufficient allowance\");\n unchecked {\n _approve(owner, spender, currentAllowance - amount);\n }\n }\n }\n\n /**\n * @dev Hook that is called before any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * will be transferred to `to`.\n * - when `from` is zero, `amount` tokens will be minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n\n /**\n * @dev Hook that is called after any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * has been transferred to `to`.\n * - when `from` is zero, `amount` tokens have been minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens have been burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/draft-ERC20Permit.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/extensions/draft-ERC20Permit.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./draft-IERC20Permit.sol\";\nimport \"../ERC20.sol\";\nimport \"../../../utils/cryptography/ECDSA.sol\";\nimport \"../../../utils/cryptography/EIP712.sol\";\nimport \"../../../utils/Counters.sol\";\n\n/**\n * @dev Implementation of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on `{IERC20-approve}`, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n *\n * _Available since v3.4._\n */\nabstract contract ERC20Permit is ERC20, IERC20Permit, EIP712 {\n using Counters for Counters.Counter;\n\n mapping(address => Counters.Counter) private _nonces;\n\n // solhint-disable-next-line var-name-mixedcase\n bytes32 private constant _PERMIT_TYPEHASH =\n keccak256(\"Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)\");\n /**\n * @dev In previous versions `_PERMIT_TYPEHASH` was declared as `immutable`.\n * However, to ensure consistency with the upgradeable transpiler, we will continue\n * to reserve a slot.\n * @custom:oz-renamed-from _PERMIT_TYPEHASH\n */\n // solhint-disable-next-line var-name-mixedcase\n bytes32 private _PERMIT_TYPEHASH_DEPRECATED_SLOT;\n\n /**\n * @dev Initializes the {EIP712} domain separator using the `name` parameter, and setting `version` to `\"1\"`.\n *\n * It's a good idea to use the same `name` that is defined as the ERC20 token name.\n */\n constructor(string memory name) EIP712(name, \"1\") {}\n\n /**\n * @dev See {IERC20Permit-permit}.\n */\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) public virtual override {\n require(block.timestamp <= deadline, \"ERC20Permit: expired deadline\");\n\n bytes32 structHash = keccak256(abi.encode(_PERMIT_TYPEHASH, owner, spender, value, _useNonce(owner), deadline));\n\n bytes32 hash = _hashTypedDataV4(structHash);\n\n address signer = ECDSA.recover(hash, v, r, s);\n require(signer == owner, \"ERC20Permit: invalid signature\");\n\n _approve(owner, spender, value);\n }\n\n /**\n * @dev See {IERC20Permit-nonces}.\n */\n function nonces(address owner) public view virtual override returns (uint256) {\n return _nonces[owner].current();\n }\n\n /**\n * @dev See {IERC20Permit-DOMAIN_SEPARATOR}.\n */\n // solhint-disable-next-line func-name-mixedcase\n function DOMAIN_SEPARATOR() external view override returns (bytes32) {\n return _domainSeparatorV4();\n }\n\n /**\n * @dev \"Consume a nonce\": return the current value and increment.\n *\n * _Available since v4.1._\n */\n function _useNonce(address owner) internal virtual returns (uint256 current) {\n Counters.Counter storage nonce = _nonces[owner];\n current = nonce.current();\n nonce.increment();\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n */\ninterface IERC20Permit {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also apply here.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `deadline` must be a timestamp in the future.\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\n * over the EIP712-formatted function arguments.\n * - the signature must use ``owner``'s current nonce (see {nonces}).\n *\n * For more information on the signature format, see the\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\n * section].\n */\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n\n /**\n * @dev Returns the current nonce for `owner`. This value must be\n * included whenever a signature is generated for {permit}.\n *\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\n * prevents a signature from being used multiple times.\n */\n function nonces(address owner) external view returns (uint256);\n\n /**\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\n */\n // solhint-disable-next-line func-name-mixedcase\n function DOMAIN_SEPARATOR() external view returns (bytes32);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20Metadata is IERC20 {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/IERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\nimport \"../extensions/draft-IERC20Permit.sol\";\nimport \"../../../utils/Address.sol\";\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n using Address for address;\n\n function safeTransfer(\n IERC20 token,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n function safeTransferFrom(\n IERC20 token,\n address from,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\n }\n\n /**\n * @dev Deprecated. This function has issues similar to the ones found in\n * {IERC20-approve}, and its usage is discouraged.\n *\n * Whenever possible, use {safeIncreaseAllowance} and\n * {safeDecreaseAllowance} instead.\n */\n function safeApprove(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n // safeApprove should only be called when setting an initial allowance,\n // or when resetting it to zero. To increase and decrease it, use\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\n require(\n (value == 0) || (token.allowance(address(this), spender) == 0),\n \"SafeERC20: approve from non-zero to non-zero allowance\"\n );\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\n }\n\n function safeIncreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n uint256 newAllowance = token.allowance(address(this), spender) + value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n\n function safeDecreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n unchecked {\n uint256 oldAllowance = token.allowance(address(this), spender);\n require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\n uint256 newAllowance = oldAllowance - value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n }\n\n function safePermit(\n IERC20Permit token,\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal {\n uint256 nonceBefore = token.nonces(owner);\n token.permit(owner, spender, value, deadline, v, r, s);\n uint256 nonceAfter = token.nonces(owner);\n require(nonceAfter == nonceBefore + 1, \"SafeERC20: permit did not succeed\");\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data, \"SafeERC20: low-level call failed\");\n if (returndata.length > 0) {\n // Return data is optional\n require(abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Address.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Context.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Counters.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Counters.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @title Counters\n * @author Matt Condon (@shrugs)\n * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number\n * of elements in a mapping, issuing ERC721 ids, or counting request ids.\n *\n * Include with `using Counters for Counters.Counter;`\n */\nlibrary Counters {\n struct Counter {\n // This variable should never be directly accessed by users of the library: interactions must be restricted to\n // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add\n // this feature: see https://github.com/ethereum/solidity/issues/4637\n uint256 _value; // default: 0\n }\n\n function current(Counter storage counter) internal view returns (uint256) {\n return counter._value;\n }\n\n function increment(Counter storage counter) internal {\n unchecked {\n counter._value += 1;\n }\n }\n\n function decrement(Counter storage counter) internal {\n uint256 value = counter._value;\n require(value > 0, \"Counter: decrement overflow\");\n unchecked {\n counter._value = value - 1;\n }\n }\n\n function reset(Counter storage counter) internal {\n counter._value = 0;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/cryptography/ECDSA.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/ECDSA.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../Strings.sol\";\n\n/**\n * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.\n *\n * These functions can be used to verify that a message was signed by the holder\n * of the private keys of a given address.\n */\nlibrary ECDSA {\n enum RecoverError {\n NoError,\n InvalidSignature,\n InvalidSignatureLength,\n InvalidSignatureS,\n InvalidSignatureV // Deprecated in v4.8\n }\n\n function _throwError(RecoverError error) private pure {\n if (error == RecoverError.NoError) {\n return; // no error: do nothing\n } else if (error == RecoverError.InvalidSignature) {\n revert(\"ECDSA: invalid signature\");\n } else if (error == RecoverError.InvalidSignatureLength) {\n revert(\"ECDSA: invalid signature length\");\n } else if (error == RecoverError.InvalidSignatureS) {\n revert(\"ECDSA: invalid signature 's' value\");\n }\n }\n\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with\n * `signature` or error string. This address can then be used for verification purposes.\n *\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {toEthSignedMessageHash} on it.\n *\n * Documentation for signature generation:\n * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]\n * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]\n *\n * _Available since v4.3._\n */\n function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {\n if (signature.length == 65) {\n bytes32 r;\n bytes32 s;\n uint8 v;\n // ecrecover takes the signature parameters, and the only way to get them\n // currently is to use assembly.\n /// @solidity memory-safe-assembly\n assembly {\n r := mload(add(signature, 0x20))\n s := mload(add(signature, 0x40))\n v := byte(0, mload(add(signature, 0x60)))\n }\n return tryRecover(hash, v, r, s);\n } else {\n return (address(0), RecoverError.InvalidSignatureLength);\n }\n }\n\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with\n * `signature`. This address can then be used for verification purposes.\n *\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {toEthSignedMessageHash} on it.\n */\n function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, signature);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.\n *\n * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]\n *\n * _Available since v4.3._\n */\n function tryRecover(\n bytes32 hash,\n bytes32 r,\n bytes32 vs\n ) internal pure returns (address, RecoverError) {\n bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);\n uint8 v = uint8((uint256(vs) >> 255) + 27);\n return tryRecover(hash, v, r, s);\n }\n\n /**\n * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.\n *\n * _Available since v4.2._\n */\n function recover(\n bytes32 hash,\n bytes32 r,\n bytes32 vs\n ) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, r, vs);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Overload of {ECDSA-tryRecover} that receives the `v`,\n * `r` and `s` signature fields separately.\n *\n * _Available since v4.3._\n */\n function tryRecover(\n bytes32 hash,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal pure returns (address, RecoverError) {\n // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature\n // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines\n // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most\n // signatures from current libraries generate a unique signature with an s-value in the lower half order.\n //\n // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value\n // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or\n // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept\n // these malleable signatures as well.\n if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {\n return (address(0), RecoverError.InvalidSignatureS);\n }\n\n // If the signature is valid (and not malleable), return the signer address\n address signer = ecrecover(hash, v, r, s);\n if (signer == address(0)) {\n return (address(0), RecoverError.InvalidSignature);\n }\n\n return (signer, RecoverError.NoError);\n }\n\n /**\n * @dev Overload of {ECDSA-recover} that receives the `v`,\n * `r` and `s` signature fields separately.\n */\n function recover(\n bytes32 hash,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, v, r, s);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Returns an Ethereum Signed Message, created from a `hash`. This\n * produces hash corresponding to the one signed with the\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n * JSON-RPC method as part of EIP-191.\n *\n * See {recover}.\n */\n function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {\n // 32 is the length in bytes of hash,\n // enforced by the type signature above\n return keccak256(abi.encodePacked(\"\\x19Ethereum Signed Message:\\n32\", hash));\n }\n\n /**\n * @dev Returns an Ethereum Signed Message, created from `s`. This\n * produces hash corresponding to the one signed with the\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n * JSON-RPC method as part of EIP-191.\n *\n * See {recover}.\n */\n function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(\"\\x19Ethereum Signed Message:\\n\", Strings.toString(s.length), s));\n }\n\n /**\n * @dev Returns an Ethereum Signed Typed Data, created from a\n * `domainSeparator` and a `structHash`. This produces hash corresponding\n * to the one signed with the\n * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]\n * JSON-RPC method as part of EIP-712.\n *\n * See {recover}.\n */\n function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(\"\\x19\\x01\", domainSeparator, structHash));\n }\n}\n" + }, + "@openzeppelin/contracts/utils/cryptography/EIP712.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/EIP712.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./ECDSA.sol\";\n\n/**\n * @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data.\n *\n * The encoding specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible,\n * thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding\n * they need in their contracts using a combination of `abi.encode` and `keccak256`.\n *\n * This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding\n * scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA\n * ({_hashTypedDataV4}).\n *\n * The implementation of the domain separator was designed to be as efficient as possible while still properly updating\n * the chain id to protect against replay attacks on an eventual fork of the chain.\n *\n * NOTE: This contract implements the version of the encoding known as \"v4\", as implemented by the JSON RPC method\n * https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask].\n *\n * _Available since v3.4._\n */\nabstract contract EIP712 {\n /* solhint-disable var-name-mixedcase */\n // Cache the domain separator as an immutable value, but also store the chain id that it corresponds to, in order to\n // invalidate the cached domain separator if the chain id changes.\n bytes32 private immutable _CACHED_DOMAIN_SEPARATOR;\n uint256 private immutable _CACHED_CHAIN_ID;\n address private immutable _CACHED_THIS;\n\n bytes32 private immutable _HASHED_NAME;\n bytes32 private immutable _HASHED_VERSION;\n bytes32 private immutable _TYPE_HASH;\n\n /* solhint-enable var-name-mixedcase */\n\n /**\n * @dev Initializes the domain separator and parameter caches.\n *\n * The meaning of `name` and `version` is specified in\n * https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]:\n *\n * - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol.\n * - `version`: the current major version of the signing domain.\n *\n * NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart\n * contract upgrade].\n */\n constructor(string memory name, string memory version) {\n bytes32 hashedName = keccak256(bytes(name));\n bytes32 hashedVersion = keccak256(bytes(version));\n bytes32 typeHash = keccak256(\n \"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)\"\n );\n _HASHED_NAME = hashedName;\n _HASHED_VERSION = hashedVersion;\n _CACHED_CHAIN_ID = block.chainid;\n _CACHED_DOMAIN_SEPARATOR = _buildDomainSeparator(typeHash, hashedName, hashedVersion);\n _CACHED_THIS = address(this);\n _TYPE_HASH = typeHash;\n }\n\n /**\n * @dev Returns the domain separator for the current chain.\n */\n function _domainSeparatorV4() internal view returns (bytes32) {\n if (address(this) == _CACHED_THIS && block.chainid == _CACHED_CHAIN_ID) {\n return _CACHED_DOMAIN_SEPARATOR;\n } else {\n return _buildDomainSeparator(_TYPE_HASH, _HASHED_NAME, _HASHED_VERSION);\n }\n }\n\n function _buildDomainSeparator(\n bytes32 typeHash,\n bytes32 nameHash,\n bytes32 versionHash\n ) private view returns (bytes32) {\n return keccak256(abi.encode(typeHash, nameHash, versionHash, block.chainid, address(this)));\n }\n\n /**\n * @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this\n * function returns the hash of the fully encoded EIP712 message for this domain.\n *\n * This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example:\n *\n * ```solidity\n * bytes32 digest = _hashTypedDataV4(keccak256(abi.encode(\n * keccak256(\"Mail(address to,string contents)\"),\n * mailTo,\n * keccak256(bytes(mailContents))\n * )));\n * address signer = ECDSA.recover(digest, signature);\n * ```\n */\n function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) {\n return ECDSA.toTypedDataHash(_domainSeparatorV4(), structHash);\n }\n}\n" + }, + "@openzeppelin/contracts/utils/math/Math.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary Math {\n enum Rounding {\n Down, // Toward negative infinity\n Up, // Toward infinity\n Zero // Toward zero\n }\n\n /**\n * @dev Returns the largest of two numbers.\n */\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two numbers.\n */\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two numbers. The result is rounded towards\n * zero.\n */\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b) / 2 can overflow.\n return (a & b) + (a ^ b) / 2;\n }\n\n /**\n * @dev Returns the ceiling of the division of two numbers.\n *\n * This differs from standard division with `/` in that it rounds up instead\n * of rounding down.\n */\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b - 1) / b can overflow on addition, so we distribute.\n return a == 0 ? 0 : (a - 1) / b + 1;\n }\n\n /**\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\n * with further edits by Uniswap Labs also under MIT license.\n */\n function mulDiv(\n uint256 x,\n uint256 y,\n uint256 denominator\n ) internal pure returns (uint256 result) {\n unchecked {\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\n // variables such that product = prod1 * 2^256 + prod0.\n uint256 prod0; // Least significant 256 bits of the product\n uint256 prod1; // Most significant 256 bits of the product\n assembly {\n let mm := mulmod(x, y, not(0))\n prod0 := mul(x, y)\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n }\n\n // Handle non-overflow cases, 256 by 256 division.\n if (prod1 == 0) {\n return prod0 / denominator;\n }\n\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\n require(denominator > prod1);\n\n ///////////////////////////////////////////////\n // 512 by 256 division.\n ///////////////////////////////////////////////\n\n // Make division exact by subtracting the remainder from [prod1 prod0].\n uint256 remainder;\n assembly {\n // Compute remainder using mulmod.\n remainder := mulmod(x, y, denominator)\n\n // Subtract 256 bit number from 512 bit number.\n prod1 := sub(prod1, gt(remainder, prod0))\n prod0 := sub(prod0, remainder)\n }\n\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\n // See https://cs.stackexchange.com/q/138556/92363.\n\n // Does not overflow because the denominator cannot be zero at this stage in the function.\n uint256 twos = denominator & (~denominator + 1);\n assembly {\n // Divide denominator by twos.\n denominator := div(denominator, twos)\n\n // Divide [prod1 prod0] by twos.\n prod0 := div(prod0, twos)\n\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\n twos := add(div(sub(0, twos), twos), 1)\n }\n\n // Shift in bits from prod1 into prod0.\n prod0 |= prod1 * twos;\n\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\n // four bits. That is, denominator * inv = 1 mod 2^4.\n uint256 inverse = (3 * denominator) ^ 2;\n\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\n // in modular arithmetic, doubling the correct bits in each step.\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\n\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\n // is no longer required.\n result = prod0 * inverse;\n return result;\n }\n }\n\n /**\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\n */\n function mulDiv(\n uint256 x,\n uint256 y,\n uint256 denominator,\n Rounding rounding\n ) internal pure returns (uint256) {\n uint256 result = mulDiv(x, y, denominator);\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\n result += 1;\n }\n return result;\n }\n\n /**\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\n *\n * Inspired by Henry S. Warren, Jr.'s \"Hacker's Delight\" (Chapter 11).\n */\n function sqrt(uint256 a) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\n //\n // We know that the \"msb\" (most significant bit) of our target number `a` is a power of 2 such that we have\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\n //\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\n // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\n // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\n //\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\n uint256 result = 1 << (log2(a) >> 1);\n\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\n // into the expected uint128 result.\n unchecked {\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n return min(result, a / result);\n }\n }\n\n /**\n * @notice Calculates sqrt(a), following the selected rounding direction.\n */\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = sqrt(a);\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 2, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 128;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 64;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 32;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 16;\n }\n if (value >> 8 > 0) {\n value >>= 8;\n result += 8;\n }\n if (value >> 4 > 0) {\n value >>= 4;\n result += 4;\n }\n if (value >> 2 > 0) {\n value >>= 2;\n result += 2;\n }\n if (value >> 1 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log2(value);\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 10, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >= 10**64) {\n value /= 10**64;\n result += 64;\n }\n if (value >= 10**32) {\n value /= 10**32;\n result += 32;\n }\n if (value >= 10**16) {\n value /= 10**16;\n result += 16;\n }\n if (value >= 10**8) {\n value /= 10**8;\n result += 8;\n }\n if (value >= 10**4) {\n value /= 10**4;\n result += 4;\n }\n if (value >= 10**2) {\n value /= 10**2;\n result += 2;\n }\n if (value >= 10**1) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log10(value);\n return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 256, rounded down, of a positive value.\n * Returns 0 if given 0.\n *\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\n */\n function log256(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 16;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 8;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 4;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 2;\n }\n if (value >> 8 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log256(value);\n return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/math/SafeCast.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SafeCast.sol)\n// This file was procedurally generated from scripts/generate/templates/SafeCast.js.\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Wrappers over Solidity's uintXX/intXX casting operators with added overflow\n * checks.\n *\n * Downcasting from uint256/int256 in Solidity does not revert on overflow. This can\n * easily result in undesired exploitation or bugs, since developers usually\n * assume that overflows raise errors. `SafeCast` restores this intuition by\n * reverting the transaction when such an operation overflows.\n *\n * Using this library instead of the unchecked operations eliminates an entire\n * class of bugs, so it's recommended to use it always.\n *\n * Can be combined with {SafeMath} and {SignedSafeMath} to extend it to smaller types, by performing\n * all math on `uint256` and `int256` and then downcasting.\n */\nlibrary SafeCast {\n /**\n * @dev Returns the downcasted uint248 from uint256, reverting on\n * overflow (when the input is greater than largest uint248).\n *\n * Counterpart to Solidity's `uint248` operator.\n *\n * Requirements:\n *\n * - input must fit into 248 bits\n *\n * _Available since v4.7._\n */\n function toUint248(uint256 value) internal pure returns (uint248) {\n require(value <= type(uint248).max, \"SafeCast: value doesn't fit in 248 bits\");\n return uint248(value);\n }\n\n /**\n * @dev Returns the downcasted uint240 from uint256, reverting on\n * overflow (when the input is greater than largest uint240).\n *\n * Counterpart to Solidity's `uint240` operator.\n *\n * Requirements:\n *\n * - input must fit into 240 bits\n *\n * _Available since v4.7._\n */\n function toUint240(uint256 value) internal pure returns (uint240) {\n require(value <= type(uint240).max, \"SafeCast: value doesn't fit in 240 bits\");\n return uint240(value);\n }\n\n /**\n * @dev Returns the downcasted uint232 from uint256, reverting on\n * overflow (when the input is greater than largest uint232).\n *\n * Counterpart to Solidity's `uint232` operator.\n *\n * Requirements:\n *\n * - input must fit into 232 bits\n *\n * _Available since v4.7._\n */\n function toUint232(uint256 value) internal pure returns (uint232) {\n require(value <= type(uint232).max, \"SafeCast: value doesn't fit in 232 bits\");\n return uint232(value);\n }\n\n /**\n * @dev Returns the downcasted uint224 from uint256, reverting on\n * overflow (when the input is greater than largest uint224).\n *\n * Counterpart to Solidity's `uint224` operator.\n *\n * Requirements:\n *\n * - input must fit into 224 bits\n *\n * _Available since v4.2._\n */\n function toUint224(uint256 value) internal pure returns (uint224) {\n require(value <= type(uint224).max, \"SafeCast: value doesn't fit in 224 bits\");\n return uint224(value);\n }\n\n /**\n * @dev Returns the downcasted uint216 from uint256, reverting on\n * overflow (when the input is greater than largest uint216).\n *\n * Counterpart to Solidity's `uint216` operator.\n *\n * Requirements:\n *\n * - input must fit into 216 bits\n *\n * _Available since v4.7._\n */\n function toUint216(uint256 value) internal pure returns (uint216) {\n require(value <= type(uint216).max, \"SafeCast: value doesn't fit in 216 bits\");\n return uint216(value);\n }\n\n /**\n * @dev Returns the downcasted uint208 from uint256, reverting on\n * overflow (when the input is greater than largest uint208).\n *\n * Counterpart to Solidity's `uint208` operator.\n *\n * Requirements:\n *\n * - input must fit into 208 bits\n *\n * _Available since v4.7._\n */\n function toUint208(uint256 value) internal pure returns (uint208) {\n require(value <= type(uint208).max, \"SafeCast: value doesn't fit in 208 bits\");\n return uint208(value);\n }\n\n /**\n * @dev Returns the downcasted uint200 from uint256, reverting on\n * overflow (when the input is greater than largest uint200).\n *\n * Counterpart to Solidity's `uint200` operator.\n *\n * Requirements:\n *\n * - input must fit into 200 bits\n *\n * _Available since v4.7._\n */\n function toUint200(uint256 value) internal pure returns (uint200) {\n require(value <= type(uint200).max, \"SafeCast: value doesn't fit in 200 bits\");\n return uint200(value);\n }\n\n /**\n * @dev Returns the downcasted uint192 from uint256, reverting on\n * overflow (when the input is greater than largest uint192).\n *\n * Counterpart to Solidity's `uint192` operator.\n *\n * Requirements:\n *\n * - input must fit into 192 bits\n *\n * _Available since v4.7._\n */\n function toUint192(uint256 value) internal pure returns (uint192) {\n require(value <= type(uint192).max, \"SafeCast: value doesn't fit in 192 bits\");\n return uint192(value);\n }\n\n /**\n * @dev Returns the downcasted uint184 from uint256, reverting on\n * overflow (when the input is greater than largest uint184).\n *\n * Counterpart to Solidity's `uint184` operator.\n *\n * Requirements:\n *\n * - input must fit into 184 bits\n *\n * _Available since v4.7._\n */\n function toUint184(uint256 value) internal pure returns (uint184) {\n require(value <= type(uint184).max, \"SafeCast: value doesn't fit in 184 bits\");\n return uint184(value);\n }\n\n /**\n * @dev Returns the downcasted uint176 from uint256, reverting on\n * overflow (when the input is greater than largest uint176).\n *\n * Counterpart to Solidity's `uint176` operator.\n *\n * Requirements:\n *\n * - input must fit into 176 bits\n *\n * _Available since v4.7._\n */\n function toUint176(uint256 value) internal pure returns (uint176) {\n require(value <= type(uint176).max, \"SafeCast: value doesn't fit in 176 bits\");\n return uint176(value);\n }\n\n /**\n * @dev Returns the downcasted uint168 from uint256, reverting on\n * overflow (when the input is greater than largest uint168).\n *\n * Counterpart to Solidity's `uint168` operator.\n *\n * Requirements:\n *\n * - input must fit into 168 bits\n *\n * _Available since v4.7._\n */\n function toUint168(uint256 value) internal pure returns (uint168) {\n require(value <= type(uint168).max, \"SafeCast: value doesn't fit in 168 bits\");\n return uint168(value);\n }\n\n /**\n * @dev Returns the downcasted uint160 from uint256, reverting on\n * overflow (when the input is greater than largest uint160).\n *\n * Counterpart to Solidity's `uint160` operator.\n *\n * Requirements:\n *\n * - input must fit into 160 bits\n *\n * _Available since v4.7._\n */\n function toUint160(uint256 value) internal pure returns (uint160) {\n require(value <= type(uint160).max, \"SafeCast: value doesn't fit in 160 bits\");\n return uint160(value);\n }\n\n /**\n * @dev Returns the downcasted uint152 from uint256, reverting on\n * overflow (when the input is greater than largest uint152).\n *\n * Counterpart to Solidity's `uint152` operator.\n *\n * Requirements:\n *\n * - input must fit into 152 bits\n *\n * _Available since v4.7._\n */\n function toUint152(uint256 value) internal pure returns (uint152) {\n require(value <= type(uint152).max, \"SafeCast: value doesn't fit in 152 bits\");\n return uint152(value);\n }\n\n /**\n * @dev Returns the downcasted uint144 from uint256, reverting on\n * overflow (when the input is greater than largest uint144).\n *\n * Counterpart to Solidity's `uint144` operator.\n *\n * Requirements:\n *\n * - input must fit into 144 bits\n *\n * _Available since v4.7._\n */\n function toUint144(uint256 value) internal pure returns (uint144) {\n require(value <= type(uint144).max, \"SafeCast: value doesn't fit in 144 bits\");\n return uint144(value);\n }\n\n /**\n * @dev Returns the downcasted uint136 from uint256, reverting on\n * overflow (when the input is greater than largest uint136).\n *\n * Counterpart to Solidity's `uint136` operator.\n *\n * Requirements:\n *\n * - input must fit into 136 bits\n *\n * _Available since v4.7._\n */\n function toUint136(uint256 value) internal pure returns (uint136) {\n require(value <= type(uint136).max, \"SafeCast: value doesn't fit in 136 bits\");\n return uint136(value);\n }\n\n /**\n * @dev Returns the downcasted uint128 from uint256, reverting on\n * overflow (when the input is greater than largest uint128).\n *\n * Counterpart to Solidity's `uint128` operator.\n *\n * Requirements:\n *\n * - input must fit into 128 bits\n *\n * _Available since v2.5._\n */\n function toUint128(uint256 value) internal pure returns (uint128) {\n require(value <= type(uint128).max, \"SafeCast: value doesn't fit in 128 bits\");\n return uint128(value);\n }\n\n /**\n * @dev Returns the downcasted uint120 from uint256, reverting on\n * overflow (when the input is greater than largest uint120).\n *\n * Counterpart to Solidity's `uint120` operator.\n *\n * Requirements:\n *\n * - input must fit into 120 bits\n *\n * _Available since v4.7._\n */\n function toUint120(uint256 value) internal pure returns (uint120) {\n require(value <= type(uint120).max, \"SafeCast: value doesn't fit in 120 bits\");\n return uint120(value);\n }\n\n /**\n * @dev Returns the downcasted uint112 from uint256, reverting on\n * overflow (when the input is greater than largest uint112).\n *\n * Counterpart to Solidity's `uint112` operator.\n *\n * Requirements:\n *\n * - input must fit into 112 bits\n *\n * _Available since v4.7._\n */\n function toUint112(uint256 value) internal pure returns (uint112) {\n require(value <= type(uint112).max, \"SafeCast: value doesn't fit in 112 bits\");\n return uint112(value);\n }\n\n /**\n * @dev Returns the downcasted uint104 from uint256, reverting on\n * overflow (when the input is greater than largest uint104).\n *\n * Counterpart to Solidity's `uint104` operator.\n *\n * Requirements:\n *\n * - input must fit into 104 bits\n *\n * _Available since v4.7._\n */\n function toUint104(uint256 value) internal pure returns (uint104) {\n require(value <= type(uint104).max, \"SafeCast: value doesn't fit in 104 bits\");\n return uint104(value);\n }\n\n /**\n * @dev Returns the downcasted uint96 from uint256, reverting on\n * overflow (when the input is greater than largest uint96).\n *\n * Counterpart to Solidity's `uint96` operator.\n *\n * Requirements:\n *\n * - input must fit into 96 bits\n *\n * _Available since v4.2._\n */\n function toUint96(uint256 value) internal pure returns (uint96) {\n require(value <= type(uint96).max, \"SafeCast: value doesn't fit in 96 bits\");\n return uint96(value);\n }\n\n /**\n * @dev Returns the downcasted uint88 from uint256, reverting on\n * overflow (when the input is greater than largest uint88).\n *\n * Counterpart to Solidity's `uint88` operator.\n *\n * Requirements:\n *\n * - input must fit into 88 bits\n *\n * _Available since v4.7._\n */\n function toUint88(uint256 value) internal pure returns (uint88) {\n require(value <= type(uint88).max, \"SafeCast: value doesn't fit in 88 bits\");\n return uint88(value);\n }\n\n /**\n * @dev Returns the downcasted uint80 from uint256, reverting on\n * overflow (when the input is greater than largest uint80).\n *\n * Counterpart to Solidity's `uint80` operator.\n *\n * Requirements:\n *\n * - input must fit into 80 bits\n *\n * _Available since v4.7._\n */\n function toUint80(uint256 value) internal pure returns (uint80) {\n require(value <= type(uint80).max, \"SafeCast: value doesn't fit in 80 bits\");\n return uint80(value);\n }\n\n /**\n * @dev Returns the downcasted uint72 from uint256, reverting on\n * overflow (when the input is greater than largest uint72).\n *\n * Counterpart to Solidity's `uint72` operator.\n *\n * Requirements:\n *\n * - input must fit into 72 bits\n *\n * _Available since v4.7._\n */\n function toUint72(uint256 value) internal pure returns (uint72) {\n require(value <= type(uint72).max, \"SafeCast: value doesn't fit in 72 bits\");\n return uint72(value);\n }\n\n /**\n * @dev Returns the downcasted uint64 from uint256, reverting on\n * overflow (when the input is greater than largest uint64).\n *\n * Counterpart to Solidity's `uint64` operator.\n *\n * Requirements:\n *\n * - input must fit into 64 bits\n *\n * _Available since v2.5._\n */\n function toUint64(uint256 value) internal pure returns (uint64) {\n require(value <= type(uint64).max, \"SafeCast: value doesn't fit in 64 bits\");\n return uint64(value);\n }\n\n /**\n * @dev Returns the downcasted uint56 from uint256, reverting on\n * overflow (when the input is greater than largest uint56).\n *\n * Counterpart to Solidity's `uint56` operator.\n *\n * Requirements:\n *\n * - input must fit into 56 bits\n *\n * _Available since v4.7._\n */\n function toUint56(uint256 value) internal pure returns (uint56) {\n require(value <= type(uint56).max, \"SafeCast: value doesn't fit in 56 bits\");\n return uint56(value);\n }\n\n /**\n * @dev Returns the downcasted uint48 from uint256, reverting on\n * overflow (when the input is greater than largest uint48).\n *\n * Counterpart to Solidity's `uint48` operator.\n *\n * Requirements:\n *\n * - input must fit into 48 bits\n *\n * _Available since v4.7._\n */\n function toUint48(uint256 value) internal pure returns (uint48) {\n require(value <= type(uint48).max, \"SafeCast: value doesn't fit in 48 bits\");\n return uint48(value);\n }\n\n /**\n * @dev Returns the downcasted uint40 from uint256, reverting on\n * overflow (when the input is greater than largest uint40).\n *\n * Counterpart to Solidity's `uint40` operator.\n *\n * Requirements:\n *\n * - input must fit into 40 bits\n *\n * _Available since v4.7._\n */\n function toUint40(uint256 value) internal pure returns (uint40) {\n require(value <= type(uint40).max, \"SafeCast: value doesn't fit in 40 bits\");\n return uint40(value);\n }\n\n /**\n * @dev Returns the downcasted uint32 from uint256, reverting on\n * overflow (when the input is greater than largest uint32).\n *\n * Counterpart to Solidity's `uint32` operator.\n *\n * Requirements:\n *\n * - input must fit into 32 bits\n *\n * _Available since v2.5._\n */\n function toUint32(uint256 value) internal pure returns (uint32) {\n require(value <= type(uint32).max, \"SafeCast: value doesn't fit in 32 bits\");\n return uint32(value);\n }\n\n /**\n * @dev Returns the downcasted uint24 from uint256, reverting on\n * overflow (when the input is greater than largest uint24).\n *\n * Counterpart to Solidity's `uint24` operator.\n *\n * Requirements:\n *\n * - input must fit into 24 bits\n *\n * _Available since v4.7._\n */\n function toUint24(uint256 value) internal pure returns (uint24) {\n require(value <= type(uint24).max, \"SafeCast: value doesn't fit in 24 bits\");\n return uint24(value);\n }\n\n /**\n * @dev Returns the downcasted uint16 from uint256, reverting on\n * overflow (when the input is greater than largest uint16).\n *\n * Counterpart to Solidity's `uint16` operator.\n *\n * Requirements:\n *\n * - input must fit into 16 bits\n *\n * _Available since v2.5._\n */\n function toUint16(uint256 value) internal pure returns (uint16) {\n require(value <= type(uint16).max, \"SafeCast: value doesn't fit in 16 bits\");\n return uint16(value);\n }\n\n /**\n * @dev Returns the downcasted uint8 from uint256, reverting on\n * overflow (when the input is greater than largest uint8).\n *\n * Counterpart to Solidity's `uint8` operator.\n *\n * Requirements:\n *\n * - input must fit into 8 bits\n *\n * _Available since v2.5._\n */\n function toUint8(uint256 value) internal pure returns (uint8) {\n require(value <= type(uint8).max, \"SafeCast: value doesn't fit in 8 bits\");\n return uint8(value);\n }\n\n /**\n * @dev Converts a signed int256 into an unsigned uint256.\n *\n * Requirements:\n *\n * - input must be greater than or equal to 0.\n *\n * _Available since v3.0._\n */\n function toUint256(int256 value) internal pure returns (uint256) {\n require(value >= 0, \"SafeCast: value must be positive\");\n return uint256(value);\n }\n\n /**\n * @dev Returns the downcasted int248 from int256, reverting on\n * overflow (when the input is less than smallest int248 or\n * greater than largest int248).\n *\n * Counterpart to Solidity's `int248` operator.\n *\n * Requirements:\n *\n * - input must fit into 248 bits\n *\n * _Available since v4.7._\n */\n function toInt248(int256 value) internal pure returns (int248 downcasted) {\n downcasted = int248(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 248 bits\");\n }\n\n /**\n * @dev Returns the downcasted int240 from int256, reverting on\n * overflow (when the input is less than smallest int240 or\n * greater than largest int240).\n *\n * Counterpart to Solidity's `int240` operator.\n *\n * Requirements:\n *\n * - input must fit into 240 bits\n *\n * _Available since v4.7._\n */\n function toInt240(int256 value) internal pure returns (int240 downcasted) {\n downcasted = int240(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 240 bits\");\n }\n\n /**\n * @dev Returns the downcasted int232 from int256, reverting on\n * overflow (when the input is less than smallest int232 or\n * greater than largest int232).\n *\n * Counterpart to Solidity's `int232` operator.\n *\n * Requirements:\n *\n * - input must fit into 232 bits\n *\n * _Available since v4.7._\n */\n function toInt232(int256 value) internal pure returns (int232 downcasted) {\n downcasted = int232(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 232 bits\");\n }\n\n /**\n * @dev Returns the downcasted int224 from int256, reverting on\n * overflow (when the input is less than smallest int224 or\n * greater than largest int224).\n *\n * Counterpart to Solidity's `int224` operator.\n *\n * Requirements:\n *\n * - input must fit into 224 bits\n *\n * _Available since v4.7._\n */\n function toInt224(int256 value) internal pure returns (int224 downcasted) {\n downcasted = int224(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 224 bits\");\n }\n\n /**\n * @dev Returns the downcasted int216 from int256, reverting on\n * overflow (when the input is less than smallest int216 or\n * greater than largest int216).\n *\n * Counterpart to Solidity's `int216` operator.\n *\n * Requirements:\n *\n * - input must fit into 216 bits\n *\n * _Available since v4.7._\n */\n function toInt216(int256 value) internal pure returns (int216 downcasted) {\n downcasted = int216(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 216 bits\");\n }\n\n /**\n * @dev Returns the downcasted int208 from int256, reverting on\n * overflow (when the input is less than smallest int208 or\n * greater than largest int208).\n *\n * Counterpart to Solidity's `int208` operator.\n *\n * Requirements:\n *\n * - input must fit into 208 bits\n *\n * _Available since v4.7._\n */\n function toInt208(int256 value) internal pure returns (int208 downcasted) {\n downcasted = int208(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 208 bits\");\n }\n\n /**\n * @dev Returns the downcasted int200 from int256, reverting on\n * overflow (when the input is less than smallest int200 or\n * greater than largest int200).\n *\n * Counterpart to Solidity's `int200` operator.\n *\n * Requirements:\n *\n * - input must fit into 200 bits\n *\n * _Available since v4.7._\n */\n function toInt200(int256 value) internal pure returns (int200 downcasted) {\n downcasted = int200(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 200 bits\");\n }\n\n /**\n * @dev Returns the downcasted int192 from int256, reverting on\n * overflow (when the input is less than smallest int192 or\n * greater than largest int192).\n *\n * Counterpart to Solidity's `int192` operator.\n *\n * Requirements:\n *\n * - input must fit into 192 bits\n *\n * _Available since v4.7._\n */\n function toInt192(int256 value) internal pure returns (int192 downcasted) {\n downcasted = int192(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 192 bits\");\n }\n\n /**\n * @dev Returns the downcasted int184 from int256, reverting on\n * overflow (when the input is less than smallest int184 or\n * greater than largest int184).\n *\n * Counterpart to Solidity's `int184` operator.\n *\n * Requirements:\n *\n * - input must fit into 184 bits\n *\n * _Available since v4.7._\n */\n function toInt184(int256 value) internal pure returns (int184 downcasted) {\n downcasted = int184(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 184 bits\");\n }\n\n /**\n * @dev Returns the downcasted int176 from int256, reverting on\n * overflow (when the input is less than smallest int176 or\n * greater than largest int176).\n *\n * Counterpart to Solidity's `int176` operator.\n *\n * Requirements:\n *\n * - input must fit into 176 bits\n *\n * _Available since v4.7._\n */\n function toInt176(int256 value) internal pure returns (int176 downcasted) {\n downcasted = int176(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 176 bits\");\n }\n\n /**\n * @dev Returns the downcasted int168 from int256, reverting on\n * overflow (when the input is less than smallest int168 or\n * greater than largest int168).\n *\n * Counterpart to Solidity's `int168` operator.\n *\n * Requirements:\n *\n * - input must fit into 168 bits\n *\n * _Available since v4.7._\n */\n function toInt168(int256 value) internal pure returns (int168 downcasted) {\n downcasted = int168(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 168 bits\");\n }\n\n /**\n * @dev Returns the downcasted int160 from int256, reverting on\n * overflow (when the input is less than smallest int160 or\n * greater than largest int160).\n *\n * Counterpart to Solidity's `int160` operator.\n *\n * Requirements:\n *\n * - input must fit into 160 bits\n *\n * _Available since v4.7._\n */\n function toInt160(int256 value) internal pure returns (int160 downcasted) {\n downcasted = int160(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 160 bits\");\n }\n\n /**\n * @dev Returns the downcasted int152 from int256, reverting on\n * overflow (when the input is less than smallest int152 or\n * greater than largest int152).\n *\n * Counterpart to Solidity's `int152` operator.\n *\n * Requirements:\n *\n * - input must fit into 152 bits\n *\n * _Available since v4.7._\n */\n function toInt152(int256 value) internal pure returns (int152 downcasted) {\n downcasted = int152(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 152 bits\");\n }\n\n /**\n * @dev Returns the downcasted int144 from int256, reverting on\n * overflow (when the input is less than smallest int144 or\n * greater than largest int144).\n *\n * Counterpart to Solidity's `int144` operator.\n *\n * Requirements:\n *\n * - input must fit into 144 bits\n *\n * _Available since v4.7._\n */\n function toInt144(int256 value) internal pure returns (int144 downcasted) {\n downcasted = int144(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 144 bits\");\n }\n\n /**\n * @dev Returns the downcasted int136 from int256, reverting on\n * overflow (when the input is less than smallest int136 or\n * greater than largest int136).\n *\n * Counterpart to Solidity's `int136` operator.\n *\n * Requirements:\n *\n * - input must fit into 136 bits\n *\n * _Available since v4.7._\n */\n function toInt136(int256 value) internal pure returns (int136 downcasted) {\n downcasted = int136(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 136 bits\");\n }\n\n /**\n * @dev Returns the downcasted int128 from int256, reverting on\n * overflow (when the input is less than smallest int128 or\n * greater than largest int128).\n *\n * Counterpart to Solidity's `int128` operator.\n *\n * Requirements:\n *\n * - input must fit into 128 bits\n *\n * _Available since v3.1._\n */\n function toInt128(int256 value) internal pure returns (int128 downcasted) {\n downcasted = int128(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 128 bits\");\n }\n\n /**\n * @dev Returns the downcasted int120 from int256, reverting on\n * overflow (when the input is less than smallest int120 or\n * greater than largest int120).\n *\n * Counterpart to Solidity's `int120` operator.\n *\n * Requirements:\n *\n * - input must fit into 120 bits\n *\n * _Available since v4.7._\n */\n function toInt120(int256 value) internal pure returns (int120 downcasted) {\n downcasted = int120(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 120 bits\");\n }\n\n /**\n * @dev Returns the downcasted int112 from int256, reverting on\n * overflow (when the input is less than smallest int112 or\n * greater than largest int112).\n *\n * Counterpart to Solidity's `int112` operator.\n *\n * Requirements:\n *\n * - input must fit into 112 bits\n *\n * _Available since v4.7._\n */\n function toInt112(int256 value) internal pure returns (int112 downcasted) {\n downcasted = int112(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 112 bits\");\n }\n\n /**\n * @dev Returns the downcasted int104 from int256, reverting on\n * overflow (when the input is less than smallest int104 or\n * greater than largest int104).\n *\n * Counterpart to Solidity's `int104` operator.\n *\n * Requirements:\n *\n * - input must fit into 104 bits\n *\n * _Available since v4.7._\n */\n function toInt104(int256 value) internal pure returns (int104 downcasted) {\n downcasted = int104(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 104 bits\");\n }\n\n /**\n * @dev Returns the downcasted int96 from int256, reverting on\n * overflow (when the input is less than smallest int96 or\n * greater than largest int96).\n *\n * Counterpart to Solidity's `int96` operator.\n *\n * Requirements:\n *\n * - input must fit into 96 bits\n *\n * _Available since v4.7._\n */\n function toInt96(int256 value) internal pure returns (int96 downcasted) {\n downcasted = int96(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 96 bits\");\n }\n\n /**\n * @dev Returns the downcasted int88 from int256, reverting on\n * overflow (when the input is less than smallest int88 or\n * greater than largest int88).\n *\n * Counterpart to Solidity's `int88` operator.\n *\n * Requirements:\n *\n * - input must fit into 88 bits\n *\n * _Available since v4.7._\n */\n function toInt88(int256 value) internal pure returns (int88 downcasted) {\n downcasted = int88(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 88 bits\");\n }\n\n /**\n * @dev Returns the downcasted int80 from int256, reverting on\n * overflow (when the input is less than smallest int80 or\n * greater than largest int80).\n *\n * Counterpart to Solidity's `int80` operator.\n *\n * Requirements:\n *\n * - input must fit into 80 bits\n *\n * _Available since v4.7._\n */\n function toInt80(int256 value) internal pure returns (int80 downcasted) {\n downcasted = int80(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 80 bits\");\n }\n\n /**\n * @dev Returns the downcasted int72 from int256, reverting on\n * overflow (when the input is less than smallest int72 or\n * greater than largest int72).\n *\n * Counterpart to Solidity's `int72` operator.\n *\n * Requirements:\n *\n * - input must fit into 72 bits\n *\n * _Available since v4.7._\n */\n function toInt72(int256 value) internal pure returns (int72 downcasted) {\n downcasted = int72(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 72 bits\");\n }\n\n /**\n * @dev Returns the downcasted int64 from int256, reverting on\n * overflow (when the input is less than smallest int64 or\n * greater than largest int64).\n *\n * Counterpart to Solidity's `int64` operator.\n *\n * Requirements:\n *\n * - input must fit into 64 bits\n *\n * _Available since v3.1._\n */\n function toInt64(int256 value) internal pure returns (int64 downcasted) {\n downcasted = int64(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 64 bits\");\n }\n\n /**\n * @dev Returns the downcasted int56 from int256, reverting on\n * overflow (when the input is less than smallest int56 or\n * greater than largest int56).\n *\n * Counterpart to Solidity's `int56` operator.\n *\n * Requirements:\n *\n * - input must fit into 56 bits\n *\n * _Available since v4.7._\n */\n function toInt56(int256 value) internal pure returns (int56 downcasted) {\n downcasted = int56(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 56 bits\");\n }\n\n /**\n * @dev Returns the downcasted int48 from int256, reverting on\n * overflow (when the input is less than smallest int48 or\n * greater than largest int48).\n *\n * Counterpart to Solidity's `int48` operator.\n *\n * Requirements:\n *\n * - input must fit into 48 bits\n *\n * _Available since v4.7._\n */\n function toInt48(int256 value) internal pure returns (int48 downcasted) {\n downcasted = int48(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 48 bits\");\n }\n\n /**\n * @dev Returns the downcasted int40 from int256, reverting on\n * overflow (when the input is less than smallest int40 or\n * greater than largest int40).\n *\n * Counterpart to Solidity's `int40` operator.\n *\n * Requirements:\n *\n * - input must fit into 40 bits\n *\n * _Available since v4.7._\n */\n function toInt40(int256 value) internal pure returns (int40 downcasted) {\n downcasted = int40(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 40 bits\");\n }\n\n /**\n * @dev Returns the downcasted int32 from int256, reverting on\n * overflow (when the input is less than smallest int32 or\n * greater than largest int32).\n *\n * Counterpart to Solidity's `int32` operator.\n *\n * Requirements:\n *\n * - input must fit into 32 bits\n *\n * _Available since v3.1._\n */\n function toInt32(int256 value) internal pure returns (int32 downcasted) {\n downcasted = int32(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 32 bits\");\n }\n\n /**\n * @dev Returns the downcasted int24 from int256, reverting on\n * overflow (when the input is less than smallest int24 or\n * greater than largest int24).\n *\n * Counterpart to Solidity's `int24` operator.\n *\n * Requirements:\n *\n * - input must fit into 24 bits\n *\n * _Available since v4.7._\n */\n function toInt24(int256 value) internal pure returns (int24 downcasted) {\n downcasted = int24(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 24 bits\");\n }\n\n /**\n * @dev Returns the downcasted int16 from int256, reverting on\n * overflow (when the input is less than smallest int16 or\n * greater than largest int16).\n *\n * Counterpart to Solidity's `int16` operator.\n *\n * Requirements:\n *\n * - input must fit into 16 bits\n *\n * _Available since v3.1._\n */\n function toInt16(int256 value) internal pure returns (int16 downcasted) {\n downcasted = int16(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 16 bits\");\n }\n\n /**\n * @dev Returns the downcasted int8 from int256, reverting on\n * overflow (when the input is less than smallest int8 or\n * greater than largest int8).\n *\n * Counterpart to Solidity's `int8` operator.\n *\n * Requirements:\n *\n * - input must fit into 8 bits\n *\n * _Available since v3.1._\n */\n function toInt8(int256 value) internal pure returns (int8 downcasted) {\n downcasted = int8(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 8 bits\");\n }\n\n /**\n * @dev Converts an unsigned uint256 into a signed int256.\n *\n * Requirements:\n *\n * - input must be less than or equal to maxInt256.\n *\n * _Available since v3.0._\n */\n function toInt256(uint256 value) internal pure returns (int256) {\n // Note: Unsafe cast below is okay because `type(int256).max` is guaranteed to be positive\n require(value <= uint256(type(int256).max), \"SafeCast: value doesn't fit in an int256\");\n return int256(value);\n }\n}\n" + }, + "@openzeppelin/contracts/utils/StorageSlot.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/StorageSlot.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Library for reading and writing primitive types to specific storage slots.\n *\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\n * This library helps with reading and writing to such slots without the need for inline assembly.\n *\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\n *\n * Example usage to set ERC1967 implementation slot:\n * ```\n * contract ERC1967 {\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n *\n * function _getImplementation() internal view returns (address) {\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\n * }\n *\n * function _setImplementation(address newImplementation) internal {\n * require(Address.isContract(newImplementation), \"ERC1967: new implementation is not a contract\");\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\n * }\n * }\n * ```\n *\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\n */\nlibrary StorageSlot {\n struct AddressSlot {\n address value;\n }\n\n struct BooleanSlot {\n bool value;\n }\n\n struct Bytes32Slot {\n bytes32 value;\n }\n\n struct Uint256Slot {\n uint256 value;\n }\n\n /**\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\n */\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\n */\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\n */\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\n */\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Strings.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./math/Math.sol\";\n\n/**\n * @dev String operations.\n */\nlibrary Strings {\n bytes16 private constant _SYMBOLS = \"0123456789abcdef\";\n uint8 private constant _ADDRESS_LENGTH = 20;\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n */\n function toString(uint256 value) internal pure returns (string memory) {\n unchecked {\n uint256 length = Math.log10(value) + 1;\n string memory buffer = new string(length);\n uint256 ptr;\n /// @solidity memory-safe-assembly\n assembly {\n ptr := add(buffer, add(32, length))\n }\n while (true) {\n ptr--;\n /// @solidity memory-safe-assembly\n assembly {\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\n }\n value /= 10;\n if (value == 0) break;\n }\n return buffer;\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n */\n function toHexString(uint256 value) internal pure returns (string memory) {\n unchecked {\n return toHexString(value, Math.log256(value) + 1);\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n */\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n bytes memory buffer = new bytes(2 * length + 2);\n buffer[0] = \"0\";\n buffer[1] = \"x\";\n for (uint256 i = 2 * length + 1; i > 1; --i) {\n buffer[i] = _SYMBOLS[value & 0xf];\n value >>= 4;\n }\n require(value == 0, \"Strings: hex length insufficient\");\n return string(buffer);\n }\n\n /**\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\n */\n function toHexString(address addr) internal pure returns (string memory) {\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\n }\n}\n" + }, + "contracts/deprecated/OldDistributor.sol": { + "content": "// SPDX-License-Identifier: BUSL-1.1\n\n/*\n * █ \n ***** ▓▓▓ \n * ▓▓▓▓▓▓▓ \n * ///. ▓▓▓▓▓▓▓▓▓▓▓▓▓ \n ***** //////// ▓▓▓▓▓▓▓ \n * ///////////// ▓▓▓ \n ▓▓ ////////////////// █ ▓▓ \n ▓▓ ▓▓ /////////////////////// ▓▓ ▓▓ \n ▓▓ ▓▓ //////////////////////////// ▓▓ ▓▓ \n ▓▓ ▓▓ /////////▓▓▓///////▓▓▓///////// ▓▓ ▓▓ \n ▓▓ ,////////////////////////////////////// ▓▓ ▓▓ \n ▓▓ ////////////////////////////////////////// ▓▓ \n ▓▓ //////////////////////▓▓▓▓///////////////////// \n ,//////////////////////////////////////////////////// \n .////////////////////////////////////////////////////////// \n .//////////////////////////██.,//////////////////////////█ \n .//////////////////////████..,./////////////////////██ \n ...////////////////███████.....,.////////////////███ \n ,.,////////////████████ ........,///////////████ \n .,.,//////█████████ ,.......///////████ \n ,..//████████ ........./████ \n ..,██████ .....,███ \n .██ ,.,█ \n \n \n \n ▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓ ▓▓▓▓▓▓▓▓▓▓ \n ▓▓▓▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓ ▓▓ ▓▓▓▓ \n ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓ ▓▓▓▓▓ \n ▓▓▓ ▓▓ ▓▓▓ ▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ \n*/\n\npragma solidity ^0.8.17;\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport \"@openzeppelin/contracts/utils/math/SafeCast.sol\";\n\nimport \"../utils/UUPSHelper.sol\";\n\nstruct MerkleTree {\n // Root of a Merkle tree which leaves are `(address user, address token, uint amount)`\n // representing an amount of tokens accumulated by `user`.\n // The Merkle tree is assumed to have only increasing amounts: that is to say if a user can claim 1,\n // then after the amount associated in the Merkle tree for this token should be x > 1\n bytes32 merkleRoot;\n // Ipfs hash of the tree data\n bytes32 ipfsHash;\n}\n\nstruct Claim {\n uint208 amount;\n uint48 timestamp;\n}\n\n/// @title OldDistributor\n/// @notice Allows LPs on AMMs with concentrated liquidity to claim the rewards that were distributed to them\n/// @author Angle Labs. Inc\ncontract OldDistributor is UUPSHelper {\n using SafeERC20 for IERC20;\n\n // ================================= VARIABLES =================================\n\n /// @notice Tree of claimable tokens through this contract\n MerkleTree public tree;\n\n /// @notice Tree that was in place in the contract before the last `tree` update\n MerkleTree public lastTree;\n\n /// @notice Token to deposit to freeze the roots update\n IERC20 public disputeToken;\n\n /// @notice `Core` contract handling access control\n ICore public core;\n\n /// @notice Address which created the dispute\n /// @dev Used to store if there is an ongoing dispute\n address public disputer;\n\n /// @notice Last time the `tree` was updated\n uint48 public lastTreeUpdate;\n\n /// @notice Time before which a change in a tree becomes effective\n uint48 public disputePeriod;\n\n /// @notice Amount to deposit to freeze the roots update\n uint256 public disputeAmount;\n\n /// @notice Mapping user -> token -> amount to track claimed amounts\n mapping(address => mapping(address => Claim)) public claimed;\n\n /// @notice Trusted EOAs to update the Merkle root\n mapping(address => uint256) public canUpdateMerkleRoot;\n\n /// @notice Whether or not to disable permissionless claiming\n mapping(address => uint256) public onlyOperatorCanClaim;\n\n /// @notice user -> operator -> authorisation to claim\n mapping(address => mapping(address => uint256)) public operators;\n\n uint256[38] private __gap;\n\n // =================================== EVENTS ==================================\n\n event Claimed(address user, address token, uint256 amount);\n event Disputed(string reason);\n event DisputePeriodUpdated(uint48 _disputePeriod);\n event DisputeTokenUpdated(address indexed _disputeToken);\n event DisputeAmountUpdated(uint256 _disputeAmount);\n event DisputeResolved(bool valid);\n event OperatorClaimingToggled(address user, bool isEnabled);\n event OperatorToggled(address user, address operator, bool isWhitelisted);\n event Recovered(address indexed token, address indexed to, uint256 amount);\n event TreeUpdated(bytes32 merkleRoot, bytes32 ipfsHash);\n event TrustedToggled(address indexed eoa, bool trust);\n\n // ================================= MODIFIERS =================================\n\n /// @notice Checks whether the `msg.sender` has the governor role or the guardian role\n modifier onlyGovernorOrGuardian() {\n if (!core.isGovernorOrGuardian(msg.sender)) revert NotGovernorOrGuardian();\n _;\n }\n\n /// @notice Checks whether the `msg.sender` is the `user` address or is a trusted address\n modifier onlyTrustedOrUser(address user) {\n if (user != msg.sender && canUpdateMerkleRoot[msg.sender] != 1 && !core.isGovernorOrGuardian(msg.sender))\n revert NotTrusted();\n _;\n }\n\n // ================================ CONSTRUCTOR ================================\n\n constructor() initializer {}\n\n function initialize(ICore _core) external initializer {\n if (address(_core) == address(0)) revert ZeroAddress();\n core = _core;\n }\n\n /// @inheritdoc UUPSUpgradeable\n function _authorizeUpgrade(address) internal view override onlyGuardianUpgrader(core) {}\n\n // =============================== MAIN FUNCTION ===============================\n\n /// @notice Claims rewards for a given set of users\n /// @dev Anyone may call this function for anyone else, funds go to destination regardless, it's just a question of\n /// who provides the proof and pays the gas: `msg.sender` is used only for addresses that require a trusted operator\n /// @param users Recipient of tokens\n /// @param tokens ERC20 claimed\n /// @param amounts Amount of tokens that will be sent to the corresponding users\n /// @param proofs Array of hashes bridging from a leaf `(hash of user | token | amount)` to the Merkle root\n function claim(\n address[] calldata users,\n address[] calldata tokens,\n uint256[] calldata amounts,\n bytes32[][] calldata proofs\n ) external {\n uint256 usersLength = users.length;\n if (\n usersLength == 0 ||\n usersLength != tokens.length ||\n usersLength != amounts.length ||\n usersLength != proofs.length\n ) revert InvalidLengths();\n\n for (uint256 i; i < usersLength; ) {\n address user = users[i];\n address token = tokens[i];\n uint256 amount = amounts[i];\n\n // Checking if only an approved operator can claim for `user`\n if (onlyOperatorCanClaim[user] == 1 && operators[user][msg.sender] == 0) revert NotWhitelisted();\n\n // Verifying proof\n bytes32 leaf = keccak256(abi.encode(user, token, amount));\n if (!_verifyProof(leaf, proofs[i])) revert InvalidProof();\n\n // Closing reentrancy gate here\n uint256 toSend = amount - claimed[user][token].amount;\n claimed[user][token] = Claim(SafeCast.toUint208(amount), uint48(block.timestamp));\n\n IERC20(token).safeTransfer(user, toSend);\n emit Claimed(user, token, toSend);\n unchecked {\n ++i;\n }\n }\n }\n\n /// @notice Returns the MerkleRoot that is currently live for the contract\n function getMerkleRoot() public view returns (bytes32) {\n if (block.timestamp - lastTreeUpdate >= disputePeriod) return tree.merkleRoot;\n else return lastTree.merkleRoot;\n }\n\n // ============================ GOVERNANCE FUNCTIONS ===========================\n\n /// @notice Adds or removes EOAs which are trusted to update the Merkle root\n function toggleTrusted(address eoa) external onlyGovernorOrGuardian {\n uint256 trustedStatus = 1 - canUpdateMerkleRoot[eoa];\n canUpdateMerkleRoot[eoa] = trustedStatus;\n emit TrustedToggled(eoa, trustedStatus == 1);\n }\n\n /// @notice Updates Merkle Tree\n function updateTree(MerkleTree calldata _tree) external {\n if (\n disputer != address(0) ||\n // A trusted address cannot update a tree right after a precedent tree update otherwise it can de facto\n // validate a tree which has not passed the dispute period\n ((canUpdateMerkleRoot[msg.sender] != 1 || block.timestamp - lastTreeUpdate < disputePeriod) &&\n !core.isGovernorOrGuardian(msg.sender))\n ) revert NotTrusted();\n MerkleTree memory _lastTree = tree;\n tree = _tree;\n lastTree = _lastTree;\n lastTreeUpdate = uint48(block.timestamp);\n emit TreeUpdated(_tree.merkleRoot, _tree.ipfsHash);\n }\n\n /// @notice Freezes the Merkle tree update until the dispute is resolved\n /// @dev Requires a deposit of `disputeToken` that'll be slashed if the dispute is not accepted\n /// @dev It is only possible to create a dispute for `disputePeriod` after each tree update\n function disputeTree(string memory reason) external {\n if (block.timestamp - lastTreeUpdate >= disputePeriod) revert InvalidDispute();\n IERC20(disputeToken).safeTransferFrom(msg.sender, address(this), disputeAmount);\n disputer = msg.sender;\n emit Disputed(reason);\n }\n\n /// @notice Resolve the ongoing dispute, if any\n /// @param valid Whether the dispute was valid\n function resolveDispute(bool valid) external onlyGovernorOrGuardian {\n if (disputer == address(0)) revert NoDispute();\n if (valid) {\n IERC20(disputeToken).safeTransfer(disputer, disputeAmount);\n // If a dispute is valid, the contract falls back to the last tree that was updated\n _revokeTree();\n } else {\n IERC20(disputeToken).safeTransfer(msg.sender, disputeAmount);\n lastTreeUpdate = uint48(block.timestamp);\n }\n disputer = address(0);\n emit DisputeResolved(valid);\n }\n\n /// @notice Allows the governor or the guardian of this contract to fallback to the last version of the tree\n /// immediately\n function revokeTree() external onlyGovernorOrGuardian {\n if (disputer != address(0)) revert UnresolvedDispute();\n _revokeTree();\n }\n\n /// @notice Toggles permissioned claiming for a given user\n function toggleOnlyOperatorCanClaim(address user) external onlyTrustedOrUser(user) {\n uint256 oldValue = onlyOperatorCanClaim[user];\n onlyOperatorCanClaim[user] = 1 - oldValue;\n emit OperatorClaimingToggled(user, oldValue == 0);\n }\n\n /// @notice Toggles whitelisting for a given user and a given operator\n function toggleOperator(address user, address operator) external onlyTrustedOrUser(user) {\n uint256 oldValue = operators[user][operator];\n operators[user][operator] = 1 - oldValue;\n emit OperatorToggled(user, operator, oldValue == 0);\n }\n\n /// @notice Recovers any ERC20 token\n function recoverERC20(address tokenAddress, address to, uint256 amountToRecover) external onlyGovernorOrGuardian {\n IERC20(tokenAddress).safeTransfer(to, amountToRecover);\n emit Recovered(tokenAddress, to, amountToRecover);\n }\n\n /// @notice Sets the dispute period before which a tree update becomes effective\n function setDisputePeriod(uint48 _disputePeriod) external onlyGovernorOrGuardian {\n if (_disputePeriod > block.timestamp) revert InvalidParam();\n disputePeriod = uint48(_disputePeriod);\n emit DisputePeriodUpdated(_disputePeriod);\n }\n\n /// @notice Sets the token used as a caution during disputes\n function setDisputeToken(IERC20 _disputeToken) external onlyGovernorOrGuardian {\n if (disputer != address(0)) revert UnresolvedDispute();\n disputeToken = _disputeToken;\n emit DisputeTokenUpdated(address(_disputeToken));\n }\n\n /// @notice Sets the amount of `disputeToken` used as a caution during disputes\n function setDisputeAmount(uint256 _disputeAmount) external onlyGovernorOrGuardian {\n if (disputer != address(0)) revert UnresolvedDispute();\n disputeAmount = _disputeAmount;\n emit DisputeAmountUpdated(_disputeAmount);\n }\n\n // ============================= INTERNAL FUNCTIONS ============================\n\n /// @notice Fallback to the last version of the tree\n function _revokeTree() internal {\n MerkleTree memory _tree = lastTree;\n lastTreeUpdate = 0;\n tree = _tree;\n emit TreeUpdated(_tree.merkleRoot, _tree.ipfsHash);\n }\n\n /// @notice Checks the validity of a proof\n /// @param leaf Hashed leaf data, the starting point of the proof\n /// @param proof Array of hashes forming a hash chain from leaf to root\n /// @return true If proof is correct, else false\n function _verifyProof(bytes32 leaf, bytes32[] memory proof) internal view returns (bool) {\n bytes32 currentHash = leaf;\n uint256 proofLength = proof.length;\n for (uint256 i; i < proofLength; ) {\n if (currentHash < proof[i]) {\n currentHash = keccak256(abi.encode(currentHash, proof[i]));\n } else {\n currentHash = keccak256(abi.encode(proof[i], currentHash));\n }\n unchecked {\n ++i;\n }\n }\n bytes32 root = getMerkleRoot();\n if (root == bytes32(0)) revert InvalidUninitializedRoot();\n return currentHash == root;\n }\n}\n" + }, + "contracts/DistributionCreator.sol": { + "content": "// SPDX-License-Identifier: BUSL-1.1\n\n/*\n * █ \n ***** ▓▓▓ \n * ▓▓▓▓▓▓▓ \n * ///. ▓▓▓▓▓▓▓▓▓▓▓▓▓ \n ***** //////// ▓▓▓▓▓▓▓ \n * ///////////// ▓▓▓ \n ▓▓ ////////////////// █ ▓▓ \n ▓▓ ▓▓ /////////////////////// ▓▓ ▓▓ \n ▓▓ ▓▓ //////////////////////////// ▓▓ ▓▓ \n ▓▓ ▓▓ /////////▓▓▓///////▓▓▓///////// ▓▓ ▓▓ \n ▓▓ ,////////////////////////////////////// ▓▓ ▓▓ \n ▓▓ ////////////////////////////////////////// ▓▓ \n ▓▓ //////////////////////▓▓▓▓///////////////////// \n ,//////////////////////////////////////////////////// \n .////////////////////////////////////////////////////////// \n .//////////////////////////██.,//////////////////////////█ \n .//////////////////////████..,./////////////////////██ \n ...////////////////███████.....,.////////////////███ \n ,.,////////////████████ ........,///////////████ \n .,.,//////█████████ ,.......///////████ \n ,..//████████ ........./████ \n ..,██████ .....,███ \n .██ ,.,█ \n \n \n \n ▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓ ▓▓▓▓▓▓▓▓▓▓ \n ▓▓▓▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓ ▓▓ ▓▓▓▓ \n ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓ ▓▓▓▓▓ \n ▓▓▓ ▓▓ ▓▓▓ ▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ \n*/\n\npragma solidity ^0.8.17;\n\nimport { ReentrancyGuardUpgradeable } from \"@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol\";\nimport { IERC20, IERC20Metadata } from \"@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol\";\nimport { SafeERC20 } from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport { ECDSA } from \"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\";\n\nimport { IUniswapV3Pool } from \"./interfaces/external/uniswap/IUniswapV3Pool.sol\";\nimport { IAlgebraPool } from \"./interfaces/external/algebra/IAlgebraPool.sol\";\n\nimport \"./utils/UUPSHelper.sol\";\nimport { DistributionParameters } from \"./struct/DistributionParameters.sol\";\nimport { UniswapTokenData, ExtensiveDistributionParameters } from \"./struct/ExtensiveDistributionParameters.sol\";\nimport { RewardTokenAmounts } from \"./struct/RewardTokenAmounts.sol\";\n\ninterface IDistributionCreator {\n function tryGetExtensiveDistributionParameters(\n DistributionParameters memory distribution\n ) external view returns (bool success, ExtensiveDistributionParameters memory extensiveParams);\n}\n\n/// @title DistributionCreator\n/// @author Angle Labs, Inc.\n/// @notice Manages the distribution of rewards across different pools with concentrated liquidity (like on Uniswap V3)\n/// @dev This contract is mostly a helper for APIs built on top of Merkl\n/// @dev People depositing rewards must have signed a `message` with the conditions for using the\n/// product\n//solhint-disable\ncontract DistributionCreator is UUPSHelper, ReentrancyGuardUpgradeable {\n using SafeERC20 for IERC20;\n\n // =========================== CONSTANTS / VARIABLES ===========================\n\n /// @notice Epoch duration\n uint32 public constant EPOCH_DURATION = 3600;\n\n /// @notice Base for fee computation\n uint256 public constant BASE_9 = 1e9;\n\n /// @notice `Core` contract handling access control\n ICore public core;\n\n /// @notice User contract for distributing rewards\n address public distributor;\n\n /// @notice Address to which fees are forwarded\n address public feeRecipient;\n\n /// @notice Value (in base 10**9) of the fees taken when creating a distribution for a pool which do not\n /// have a whitelisted token in it\n uint256 public fees;\n\n /// @notice Message that needs to be acknowledged by users creating a distribution\n string public message;\n\n /// @notice Hash of the message that needs to be signed\n bytes32 public messageHash;\n\n /// @notice List of all rewards ever distributed or to be distributed in the contract\n /// @dev An attacker could try to populate this list. It shouldn't be an issue as only view functions\n /// iterate on it\n DistributionParameters[] public distributionList;\n\n /// @notice Maps an address to its fee rebate\n mapping(address => uint256) public feeRebate;\n\n /// @notice Maps a token to whether it is whitelisted or not. No fees are to be paid for incentives given\n /// on pools with whitelisted tokens\n mapping(address => uint256) public isWhitelistedToken;\n\n /// @notice Maps an address to its nonce for creating a distribution\n mapping(address => uint256) public nonces;\n\n /// @notice Maps an address to the last valid hash signed\n mapping(address => bytes32) public userSignatures;\n\n /// @notice Maps a user to whether it is whitelisted for not signing\n mapping(address => uint256) public userSignatureWhitelist;\n\n /// @notice Maps a token to the minimum amount that must be sent per epoch for a distribution to be valid\n /// @dev If `rewardTokenMinAmounts[token] == 0`, then `token` cannot be used as a reward\n mapping(address => uint256) public rewardTokenMinAmounts;\n\n /// @notice List of all reward tokens that have at some point been accepted\n address[] public rewardTokens;\n\n uint256[36] private __gap;\n\n // =================================== EVENTS ==================================\n\n event DistributorUpdated(address indexed _distributor);\n event FeeRebateUpdated(address indexed user, uint256 userFeeRebate);\n event FeeRecipientUpdated(address indexed _feeRecipient);\n event FeesSet(uint256 _fees);\n event MessageUpdated(bytes32 _messageHash);\n event NewDistribution(DistributionParameters distribution, address indexed sender);\n event RewardTokenMinimumAmountUpdated(address indexed token, uint256 amount);\n event TokenWhitelistToggled(address indexed token, uint256 toggleStatus);\n event UserSigned(bytes32 messageHash, address indexed user);\n event UserSigningWhitelistToggled(address indexed user, uint256 toggleStatus);\n\n // ================================= MODIFIERS =================================\n\n /// @notice Checks whether the `msg.sender` has the governor role or the guardian role\n modifier onlyGovernorOrGuardian() {\n if (!core.isGovernorOrGuardian(msg.sender)) revert NotGovernorOrGuardian();\n _;\n }\n\n /// @notice Checks whether an address has signed the message or not\n modifier hasSigned() {\n if (\n userSignatureWhitelist[msg.sender] == 0 &&\n userSignatures[msg.sender] != messageHash &&\n userSignatureWhitelist[tx.origin] == 0 &&\n userSignatures[tx.origin] != messageHash\n ) revert NotSigned();\n _;\n }\n\n // ================================ CONSTRUCTOR ================================\n\n function initialize(ICore _core, address _distributor, uint256 _fees) external initializer {\n if (address(_core) == address(0) || _distributor == address(0)) revert ZeroAddress();\n if (_fees >= BASE_9) revert InvalidParam();\n distributor = _distributor;\n core = _core;\n fees = _fees;\n }\n\n constructor() initializer {}\n\n /// @inheritdoc UUPSUpgradeable\n function _authorizeUpgrade(address) internal view override onlyGuardianUpgrader(core) {}\n\n // ============================== DEPOSIT FUNCTION =============================\n\n /// @notice Creates a `distribution` to incentivize a given pool for a specific period of time\n /// @return distributionAmount How many reward tokens are actually taken into consideration in the contract\n /// @dev If the address specified as a UniV3 pool is not effectively a pool, it will not be handled by the\n /// distribution script and rewards may be lost\n /// @dev Reward tokens sent as part of distributions must have been whitelisted before and amounts\n /// sent should be bigger than a minimum amount specific to each token\n /// @dev The `positionWrappers` specified in the `distribution` struct need to be supported by the script\n /// List of supported `positionWrappers` can be found in the docs.\n /// @dev If the pool incentivized contains one whitelisted token, then no fees are taken on the rewards\n /// @dev This function reverts if the sender has not signed the message `messageHash` once through one of\n /// the functions enabling to sign\n function createDistribution(\n DistributionParameters memory distribution\n ) external hasSigned returns (uint256 distributionAmount) {\n return _createDistribution(distribution);\n }\n\n /// @notice Same as the function above but for multiple distributions at once\n /// @return List of all the distribution amounts actually deposited for each `distribution` in the `distributions` list\n function createDistributions(\n DistributionParameters[] memory distributions\n ) external hasSigned returns (uint256[] memory) {\n uint256 distributionsLength = distributions.length;\n uint256[] memory distributionAmounts = new uint256[](distributionsLength);\n for (uint256 i; i < distributionsLength; ) {\n distributionAmounts[i] = _createDistribution(distributions[i]);\n unchecked {\n ++i;\n }\n }\n return distributionAmounts;\n }\n\n /// @notice Checks whether the `msg.sender`'s `signature` is compatible with the message\n /// to sign and stores the signature\n /// @dev If you signed the message once, and the message has not been modified, then you do not\n /// need to sign again\n function sign(bytes calldata signature) external {\n _sign(signature);\n }\n\n /// @notice Combines signing the message and creating a distribution\n function signAndCreateDistribution(\n DistributionParameters memory distribution,\n bytes calldata signature\n ) external returns (uint256 distributionAmount) {\n _sign(signature);\n return _createDistribution(distribution);\n }\n\n /// @notice Internal version of `createDistribution`\n function _createDistribution(\n DistributionParameters memory distribution\n ) internal nonReentrant returns (uint256 distributionAmount) {\n uint32 epochStart = _getRoundedEpoch(distribution.epochStart);\n uint256 minDistributionAmount = rewardTokenMinAmounts[distribution.rewardToken];\n distribution.epochStart = epochStart;\n // Reward are not accepted in the following conditions:\n if (\n // if epoch parameters lead to a past distribution\n epochStart + EPOCH_DURATION < block.timestamp ||\n // if the amount of epochs for which this distribution should last is zero\n distribution.numEpoch == 0 ||\n // if the distribution parameters are not correctly specified\n distribution.propFees + distribution.propToken0 + distribution.propToken1 != 1e4 ||\n // if boosted addresses get less than non-boosted addresses in case of\n (distribution.boostingAddress != address(0) && distribution.boostedReward < 1e4) ||\n // if the type of the position wrappers is not well specified\n distribution.positionWrappers.length != distribution.wrapperTypes.length ||\n // if the reward token is not whitelisted as an incentive token\n minDistributionAmount == 0 ||\n // if the amount distributed is too small with respect to what is allowed\n distribution.amount / distribution.numEpoch < minDistributionAmount\n ) revert InvalidReward();\n distributionAmount = distribution.amount;\n // Computing fees: these are waived for whitelisted addresses and if there is a whitelisted token in a pool\n uint256 userFeeRebate = feeRebate[msg.sender];\n if (\n userFeeRebate < BASE_9 &&\n // Algebra pools also have these `token0` and `token1` parameters\n isWhitelistedToken[IUniswapV3Pool(distribution.uniV3Pool).token0()] == 0 &&\n isWhitelistedToken[IUniswapV3Pool(distribution.uniV3Pool).token1()] == 0\n ) {\n uint256 _fees = (fees * (BASE_9 - userFeeRebate)) / BASE_9;\n uint256 distributionAmountMinusFees = (distributionAmount * (BASE_9 - _fees)) / BASE_9;\n address _feeRecipient = feeRecipient;\n _feeRecipient = _feeRecipient == address(0) ? address(this) : _feeRecipient;\n IERC20(distribution.rewardToken).safeTransferFrom(\n msg.sender,\n _feeRecipient,\n distributionAmount - distributionAmountMinusFees\n );\n distributionAmount = distributionAmountMinusFees;\n distribution.amount = distributionAmount;\n }\n\n IERC20(distribution.rewardToken).safeTransferFrom(msg.sender, distributor, distributionAmount);\n uint256 senderNonce = nonces[msg.sender];\n nonces[msg.sender] = senderNonce + 1;\n distribution.rewardId = bytes32(keccak256(abi.encodePacked(msg.sender, senderNonce)));\n distributionList.push(distribution);\n emit NewDistribution(distribution, msg.sender);\n }\n\n /// @notice Internal version of the `sign` function\n function _sign(bytes calldata signature) internal {\n bytes32 _messageHash = messageHash;\n if (ECDSA.recover(_messageHash, signature) != msg.sender) revert InvalidSignature();\n userSignatures[msg.sender] = _messageHash;\n emit UserSigned(_messageHash, msg.sender);\n }\n\n // ================================= UI HELPERS ================================\n // These functions are not to be queried on-chain and hence are not optimized for gas consumption\n\n /// @notice Returns the list of all distributions ever made or to be done in the future\n function getAllDistributions() external view returns (DistributionParameters[] memory) {\n return distributionList;\n }\n\n /// @notice Returns the list of all currently active distributions on pools of supported AMMs (like Uniswap V3)\n function getActiveDistributions()\n external\n view\n returns (ExtensiveDistributionParameters[] memory searchDistributions)\n {\n uint32 roundedEpoch = _getRoundedEpoch(uint32(block.timestamp));\n (searchDistributions, ) = _getPoolDistributionsBetweenEpochs(\n address(0),\n roundedEpoch,\n roundedEpoch + EPOCH_DURATION,\n 0,\n type(uint32).max\n );\n }\n\n /// @notice Similar to `getActiveDistributions()` with additional parameters to prevent out of gas error\n /// @param skip Disregard distibutions with a global index lower than `skip`\n /// @param first Limit the length of the returned array to `first`\n /// @return searchDistributions Eligible distributions\n /// @return lastIndexDistribution Index of the last distribution assessed in the list of all distributions\n /// For pagniation purpose, in case of out of gas, you can call back the same function but with `skip` set to `lastIndexDistribution`\n function getActiveDistributions(\n uint32 skip,\n uint32 first\n )\n external\n view\n returns (ExtensiveDistributionParameters[] memory searchDistributions, uint256 lastIndexDistribution)\n {\n uint32 roundedEpoch = _getRoundedEpoch(uint32(block.timestamp));\n return _getPoolDistributionsBetweenEpochs(address(0), roundedEpoch, roundedEpoch + EPOCH_DURATION, skip, first);\n }\n\n /// @notice Returns the list of all the reward tokens supported as well as their minimum amounts\n function getValidRewardTokens() external view returns (RewardTokenAmounts[] memory) {\n uint256 length;\n uint256 rewardTokenListLength = rewardTokens.length;\n RewardTokenAmounts[] memory validRewardTokens = new RewardTokenAmounts[](rewardTokenListLength);\n for (uint32 i; i < rewardTokenListLength; ) {\n address token = rewardTokens[i];\n uint256 minAmount = rewardTokenMinAmounts[token];\n if (minAmount > 0) {\n validRewardTokens[length] = RewardTokenAmounts(token, minAmount);\n length += 1;\n }\n unchecked {\n ++i;\n }\n }\n assembly {\n mstore(validRewardTokens, length)\n }\n return validRewardTokens;\n }\n\n /// @notice Returns the list of all the distributions that were or that are going to be live at\n /// a specific epoch\n function getDistributionsForEpoch(\n uint32 epoch\n ) external view returns (ExtensiveDistributionParameters[] memory searchDistributions) {\n uint32 roundedEpoch = _getRoundedEpoch(epoch);\n (searchDistributions, ) = _getPoolDistributionsBetweenEpochs(\n address(0),\n roundedEpoch,\n roundedEpoch + EPOCH_DURATION,\n 0,\n type(uint32).max\n );\n }\n\n /// @notice Similar to `getDistributionsForEpoch(uint256 epoch)` with additional parameters to prevent out of gas error\n /// @param skip Disregard distibutions with a global index lower than `skip`\n /// @param first Limit the length of the returned array to `first`\n /// @return searchDistributions Eligible distributions\n /// @return lastIndexDistribution Index of the last distribution assessed in the list of all distributions\n /// For pagniation purpose, in case of out of gas, you can call back the same function but with `skip` set to `lastIndexDistribution`\n function getDistributionsForEpoch(\n uint32 epoch,\n uint32 skip,\n uint32 first\n ) external view returns (ExtensiveDistributionParameters[] memory, uint256 lastIndexDistribution) {\n uint32 roundedEpoch = _getRoundedEpoch(epoch);\n return _getPoolDistributionsBetweenEpochs(address(0), roundedEpoch, roundedEpoch + EPOCH_DURATION, skip, first);\n }\n\n /// @notice Gets the distributions that were or will be live at some point between `epochStart` (included) and `epochEnd` (excluded)\n /// @dev If a distribution starts during `epochEnd`, it is not be returned by this function\n /// @dev Conversely, if a distribution starts after `epochStart` and ends before `epochEnd`, it is returned by this function\n function getDistributionsBetweenEpochs(\n uint32 epochStart,\n uint32 epochEnd\n ) external view returns (ExtensiveDistributionParameters[] memory searchDistributions) {\n (searchDistributions, ) = _getPoolDistributionsBetweenEpochs(\n address(0),\n _getRoundedEpoch(epochStart),\n _getRoundedEpoch(epochEnd),\n 0,\n type(uint32).max\n );\n }\n\n /// @notice Similar to `getDistributionsBetweenEpochs(uint256 epochStart, uint256 epochEnd)` with additional parameters to prevent out of gas error\n /// @param skip Disregard distibutions with a global index lower than `skip`\n /// @param first Limit the length of the returned array to `first`\n /// @return searchDistributions Eligible distributions\n /// @return lastIndexDistribution Index of the last distribution assessed in the list of all distributions\n /// For pagniation purpose, in case of out of gas, you can call back the same function but with `skip` set to `lastIndexDistribution`\n function getDistributionsBetweenEpochs(\n uint32 epochStart,\n uint32 epochEnd,\n uint32 skip,\n uint32 first\n ) external view returns (ExtensiveDistributionParameters[] memory, uint256 lastIndexDistribution) {\n return\n _getPoolDistributionsBetweenEpochs(\n address(0),\n _getRoundedEpoch(epochStart),\n _getRoundedEpoch(epochEnd),\n skip,\n first\n );\n }\n\n /// @notice Returns the list of all distributions that were or will be live after `epochStart` (included)\n function getDistributionsAfterEpoch(\n uint32 epochStart\n ) external view returns (ExtensiveDistributionParameters[] memory searchDistributions) {\n (searchDistributions, ) = _getPoolDistributionsBetweenEpochs(\n address(0),\n _getRoundedEpoch(epochStart),\n type(uint32).max,\n 0,\n type(uint32).max\n );\n }\n\n /// @notice Similar to `getDistributionsAfterEpoch(uint256 epochStart)` with additional parameters to prevent out of gas error\n /// @param skip Disregard distibutions with a global index lower than `skip`\n /// @param first Limit the length of the returned array to `first`\n /// @return searchDistributions Eligible distributions\n /// @return lastIndexDistribution Index of the last distribution assessed in the list of all distributions\n /// For pagniation purpose, in case of out of gas, you can call back the same function but with `skip` set to `lastIndexDistribution`\n function getDistributionsAfterEpoch(\n uint32 epochStart,\n uint32 skip,\n uint32 first\n ) external view returns (ExtensiveDistributionParameters[] memory, uint256 lastIndexDistribution) {\n return\n _getPoolDistributionsBetweenEpochs(address(0), _getRoundedEpoch(epochStart), type(uint32).max, skip, first);\n }\n\n /// @notice Returns the list of all currently active distributions for a specific UniswapV3 pool\n function getActivePoolDistributions(\n address uniV3Pool\n ) external view returns (ExtensiveDistributionParameters[] memory searchDistributions) {\n uint32 roundedEpoch = _getRoundedEpoch(uint32(block.timestamp));\n (searchDistributions, ) = _getPoolDistributionsBetweenEpochs(\n uniV3Pool,\n roundedEpoch,\n roundedEpoch + EPOCH_DURATION,\n 0,\n type(uint32).max\n );\n }\n\n /// @notice Similar to `getActivePoolDistributions(address uniV3Pool)` with additional parameters to prevent out of gas error\n /// @param skip Disregard distibutions with a global index lower than `skip`\n /// @param first Limit the length of the returned array to `first`\n /// @return searchDistributions Eligible distributions\n /// @return lastIndexDistribution Index of the last distribution assessed in the list of all distributions\n /// For pagniation purpose, in case of out of gas, you can call back the same function but with `skip` set to `lastIndexDistribution`\n function getActivePoolDistributions(\n address uniV3Pool,\n uint32 skip,\n uint32 first\n ) external view returns (ExtensiveDistributionParameters[] memory, uint256 lastIndexDistribution) {\n uint32 roundedEpoch = _getRoundedEpoch(uint32(block.timestamp));\n return _getPoolDistributionsBetweenEpochs(uniV3Pool, roundedEpoch, roundedEpoch + EPOCH_DURATION, skip, first);\n }\n\n /// @notice Returns the list of all the distributions that were or that are going to be live at a\n /// specific epoch and for a specific pool\n function getPoolDistributionsForEpoch(\n address uniV3Pool,\n uint32 epoch\n ) external view returns (ExtensiveDistributionParameters[] memory searchDistributions) {\n uint32 roundedEpoch = _getRoundedEpoch(epoch);\n (searchDistributions, ) = _getPoolDistributionsBetweenEpochs(\n uniV3Pool,\n roundedEpoch,\n roundedEpoch + EPOCH_DURATION,\n 0,\n type(uint32).max\n );\n }\n\n /// @notice Similar to `getPoolDistributionsForEpoch(address uniV3Pool,uint32 epoch)` with additional parameters to prevent out of gas error\n /// @param skip Disregard distibutions with a global index lower than `skip`\n /// @param first Limit the length of the returned array to `first`\n /// @return searchDistributions Eligible distributions\n /// @return lastIndexDistribution Index of the last distribution assessed in the list of all distributions\n /// For pagniation purpose, in case of out of gas, you can call back the same function but with `skip` set to `lastIndexDistribution`\n function getPoolDistributionsForEpoch(\n address uniV3Pool,\n uint32 epoch,\n uint32 skip,\n uint32 first\n ) external view returns (ExtensiveDistributionParameters[] memory, uint256 lastIndexDistribution) {\n uint32 roundedEpoch = _getRoundedEpoch(epoch);\n return _getPoolDistributionsBetweenEpochs(uniV3Pool, roundedEpoch, roundedEpoch + EPOCH_DURATION, skip, first);\n }\n\n /// @notice Returns the list of all distributions that were or will be live at some point between\n /// `epochStart` (included) and `epochEnd` (excluded) for a specific pool\n function getPoolDistributionsBetweenEpochs(\n address uniV3Pool,\n uint32 epochStart,\n uint32 epochEnd\n ) external view returns (ExtensiveDistributionParameters[] memory searchDistributions) {\n (searchDistributions, ) = _getPoolDistributionsBetweenEpochs(\n uniV3Pool,\n _getRoundedEpoch(epochStart),\n _getRoundedEpoch(epochEnd),\n 0,\n type(uint32).max\n );\n }\n\n /// @notice Similar to `getPoolDistributionsBetweenEpochs(address uniV3Pool,uint32 epochStart, uint32 epochEnd)` with additional parameters to prevent out of gas error\n /// @param skip Disregard distibutions with a global index lower than `skip`\n /// @param first Limit the length of the returned array to `first`\n /// @return searchDistributions Eligible distributions\n /// @return lastIndexDistribution Index of the last distribution assessed in the list of all distributions\n /// For pagniation purpose, in case of out of gas, you can call back the same function but with `skip` set to `lastIndexDistribution`\n function getPoolDistributionsBetweenEpochs(\n address uniV3Pool,\n uint32 epochStart,\n uint32 epochEnd,\n uint32 skip,\n uint32 first\n ) external view returns (ExtensiveDistributionParameters[] memory, uint256 lastIndexDistribution) {\n return\n _getPoolDistributionsBetweenEpochs(\n uniV3Pool,\n _getRoundedEpoch(epochStart),\n _getRoundedEpoch(epochEnd),\n skip,\n first\n );\n }\n\n /// @notice Returns the list of all distributions that were or will be live after `epochStart` (included)\n /// for a specific pool\n function getPoolDistributionsAfterEpoch(\n address uniV3Pool,\n uint32 epochStart\n ) external view returns (ExtensiveDistributionParameters[] memory searchDistributions) {\n (searchDistributions, ) = _getPoolDistributionsBetweenEpochs(\n uniV3Pool,\n _getRoundedEpoch(epochStart),\n type(uint32).max,\n 0,\n type(uint32).max\n );\n }\n\n /// @notice Similar to `getPoolDistributionsAfterEpoch(address uniV3Pool,uint32 epochStart)` with additional parameters to prevent out of gas error\n /// @param skip Disregard distibutions with a global index lower than `skip`\n /// @param first Limit the length of the returned array to `first`\n /// @return searchDistributions Eligible distributions\n /// @return lastIndexDistribution Index of the last distribution assessed in the list of all distributions\n /// For pagniation purpose, in case of out of gas, you can call back the same function but with `skip` set to `lastIndexDistribution`\n function getPoolDistributionsAfterEpoch(\n address uniV3Pool,\n uint32 epochStart,\n uint32 skip,\n uint32 first\n ) external view returns (ExtensiveDistributionParameters[] memory, uint256 lastIndexDistribution) {\n return\n _getPoolDistributionsBetweenEpochs(uniV3Pool, _getRoundedEpoch(epochStart), type(uint32).max, skip, first);\n }\n\n // ============================ GOVERNANCE FUNCTIONS ===========================\n\n /// @notice Sets a new `distributor` to which rewards should be distributed\n function setNewDistributor(address _distributor) external onlyGovernorOrGuardian {\n if (_distributor == address(0)) revert InvalidParam();\n distributor = _distributor;\n emit DistributorUpdated(_distributor);\n }\n\n /// @notice Sets the fees on deposit\n function setFees(uint256 _fees) external onlyGovernorOrGuardian {\n if (_fees >= BASE_9) revert InvalidParam();\n fees = _fees;\n emit FeesSet(_fees);\n }\n\n /// @notice Sets fee rebates for a given user\n function setUserFeeRebate(address user, uint256 userFeeRebate) external onlyGovernorOrGuardian {\n feeRebate[user] = userFeeRebate;\n emit FeeRebateUpdated(user, userFeeRebate);\n }\n\n /// @notice Toggles the fee whitelist for `token`\n function toggleTokenWhitelist(address token) external onlyGovernorOrGuardian {\n uint256 toggleStatus = 1 - isWhitelistedToken[token];\n isWhitelistedToken[token] = toggleStatus;\n emit TokenWhitelistToggled(token, toggleStatus);\n }\n\n /// @notice Recovers fees accrued on the contract for a list of `tokens`\n function recoverFees(IERC20[] calldata tokens, address to) external onlyGovernorOrGuardian {\n uint256 tokensLength = tokens.length;\n for (uint256 i; i < tokensLength; ) {\n tokens[i].safeTransfer(to, tokens[i].balanceOf(address(this)));\n unchecked {\n ++i;\n }\n }\n }\n\n /// @notice Sets the minimum amounts per distribution epoch for different reward tokens\n function setRewardTokenMinAmounts(\n address[] calldata tokens,\n uint256[] calldata amounts\n ) external onlyGovernorOrGuardian {\n uint256 tokensLength = tokens.length;\n if (tokensLength != amounts.length) revert InvalidLengths();\n for (uint256 i; i < tokensLength; ++i) {\n uint256 amount = amounts[i];\n // Basic logic check to make sure there are no duplicates in the `rewardTokens` table. If a token is\n // removed then re-added, it will appear as a duplicate in the list\n if (amount > 0 && rewardTokenMinAmounts[tokens[i]] == 0) rewardTokens.push(tokens[i]);\n rewardTokenMinAmounts[tokens[i]] = amount;\n emit RewardTokenMinimumAmountUpdated(tokens[i], amount);\n }\n }\n\n /// @notice Sets a new address to receive fees\n function setFeeRecipient(address _feeRecipient) external onlyGovernorOrGuardian {\n feeRecipient = _feeRecipient;\n emit FeeRecipientUpdated(_feeRecipient);\n }\n\n /// @notice Sets the message that needs to be signed by users before posting rewards\n function setMessage(string memory _message) external onlyGovernorOrGuardian {\n message = _message;\n bytes32 _messageHash = ECDSA.toEthSignedMessageHash(bytes(_message));\n messageHash = _messageHash;\n emit MessageUpdated(_messageHash);\n }\n\n /// @notice Toggles the whitelist status for `user` when it comes to signing messages before depositing rewards.\n function toggleSigningWhitelist(address user) external onlyGovernorOrGuardian {\n uint256 whitelistStatus = 1 - userSignatureWhitelist[user];\n userSignatureWhitelist[user] = whitelistStatus;\n emit UserSigningWhitelistToggled(user, whitelistStatus);\n }\n\n // ============================== INTERNAL HELPERS =============================\n\n /// @notice Rounds an `epoch` timestamp to the start of the corresponding period\n function _getRoundedEpoch(uint32 epoch) internal pure returns (uint32) {\n return (epoch / EPOCH_DURATION) * EPOCH_DURATION;\n }\n\n /// @notice Checks whether `distribution` was live between `roundedEpochStart` and `roundedEpochEnd`\n function _isDistributionLiveBetweenEpochs(\n DistributionParameters memory distribution,\n uint32 roundedEpochStart,\n uint32 roundedEpochEnd\n ) internal pure returns (bool) {\n uint256 distributionEpochStart = distribution.epochStart;\n return (distributionEpochStart + distribution.numEpoch * EPOCH_DURATION > roundedEpochStart &&\n distributionEpochStart < roundedEpochEnd);\n }\n\n /// @notice Fetches data for `token` on the Uniswap `pool`\n function _getUniswapTokenData(\n IERC20Metadata token,\n address pool\n ) internal view returns (UniswapTokenData memory data) {\n data.add = address(token);\n data.decimals = token.decimals();\n data.symbol = token.symbol();\n data.poolBalance = token.balanceOf(pool);\n }\n\n /// @notice Fetches extra data about the parameters in a distribution\n function getExtensiveDistributionParameters(\n DistributionParameters memory distribution\n ) external view returns (ExtensiveDistributionParameters memory extensiveParams) {\n extensiveParams.base = distribution;\n try IUniswapV3Pool(distribution.uniV3Pool).fee() returns (uint24 fee) {\n extensiveParams.poolFee = fee;\n } catch {\n extensiveParams.poolFee = 0;\n }\n extensiveParams.token0 = _getUniswapTokenData(\n IERC20Metadata(IUniswapV3Pool(distribution.uniV3Pool).token0()),\n distribution.uniV3Pool\n );\n extensiveParams.token1 = _getUniswapTokenData(\n IERC20Metadata(IUniswapV3Pool(distribution.uniV3Pool).token1()),\n distribution.uniV3Pool\n );\n extensiveParams.rewardTokenSymbol = IERC20Metadata(distribution.rewardToken).symbol();\n extensiveParams.rewardTokenDecimals = IERC20Metadata(distribution.rewardToken).decimals();\n }\n\n /// @notice Tries to fetch extra data about the parameters in a distribution\n function tryGetExtensiveDistributionParameters(\n DistributionParameters memory distribution\n ) external returns (bool success, ExtensiveDistributionParameters memory extensiveParams) {\n (bool callSuccess, bytes memory returndata) = address(this).delegatecall(\n abi.encodeWithSelector(DistributionCreator.getExtensiveDistributionParameters.selector, distribution)\n );\n success = callSuccess;\n if (success) {\n extensiveParams = abi.decode(returndata, (ExtensiveDistributionParameters));\n }\n return (success, extensiveParams);\n }\n\n /// @notice Gets the list of all the distributions for `uniV3Pool` that have been active between `epochStart` and `epochEnd` (excluded)\n /// @dev If the `uniV3Pool` parameter is equal to 0, then this function will return the distributions for all pools\n function _getPoolDistributionsBetweenEpochs(\n address uniV3Pool,\n uint32 epochStart,\n uint32 epochEnd,\n uint32 skip,\n uint32 first\n ) internal view returns (ExtensiveDistributionParameters[] memory, uint256) {\n uint256 length;\n uint256 distributionListLength = distributionList.length;\n uint256 returnSize = first > distributionListLength ? distributionListLength : first;\n ExtensiveDistributionParameters[] memory activeRewards = new ExtensiveDistributionParameters[](returnSize);\n uint32 i = skip;\n while (i < distributionListLength) {\n DistributionParameters memory distribution = distributionList[i];\n if (\n _isDistributionLiveBetweenEpochs(distribution, epochStart, epochEnd) &&\n (uniV3Pool == address(0) || distribution.uniV3Pool == uniV3Pool)\n ) {\n (bool success, ExtensiveDistributionParameters memory extensiveParams) = IDistributionCreator(\n address(this)\n ).tryGetExtensiveDistributionParameters(distribution);\n if (success) {\n activeRewards[length] = extensiveParams;\n length += 1;\n }\n }\n unchecked {\n ++i;\n }\n if (length == returnSize) break;\n }\n assembly {\n mstore(activeRewards, length)\n }\n return (activeRewards, i);\n }\n}\n" + }, + "contracts/Distributor.sol": { + "content": "// SPDX-License-Identifier: BUSL-1.1\n\n/*\n * █ \n ***** ▓▓▓ \n * ▓▓▓▓▓▓▓ \n * ///. ▓▓▓▓▓▓▓▓▓▓▓▓▓ \n ***** //////// ▓▓▓▓▓▓▓ \n * ///////////// ▓▓▓ \n ▓▓ ////////////////// █ ▓▓ \n ▓▓ ▓▓ /////////////////////// ▓▓ ▓▓ \n ▓▓ ▓▓ //////////////////////////// ▓▓ ▓▓ \n ▓▓ ▓▓ /////////▓▓▓///////▓▓▓///////// ▓▓ ▓▓ \n ▓▓ ,////////////////////////////////////// ▓▓ ▓▓ \n ▓▓ ////////////////////////////////////////// ▓▓ \n ▓▓ //////////////////////▓▓▓▓///////////////////// \n ,//////////////////////////////////////////////////// \n .////////////////////////////////////////////////////////// \n .//////////////////////////██.,//////////////////////////█ \n .//////////////////////████..,./////////////////////██ \n ...////////////////███████.....,.////////////////███ \n ,.,////////////████████ ........,///////////████ \n .,.,//////█████████ ,.......///////████ \n ,..//████████ ........./████ \n ..,██████ .....,███ \n .██ ,.,█ \n \n \n \n ▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓ ▓▓▓▓▓▓▓▓▓▓ \n ▓▓▓▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓ ▓▓ ▓▓▓▓ \n ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓ ▓▓▓▓▓ \n ▓▓▓ ▓▓ ▓▓▓ ▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ \n*/\n\npragma solidity ^0.8.17;\n\nimport { IERC20 } from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport { SafeERC20 } from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport { SafeCast } from \"@openzeppelin/contracts/utils/math/SafeCast.sol\";\n\nimport \"./utils/UUPSHelper.sol\";\n\nstruct MerkleTree {\n // Root of a Merkle tree which leaves are `(address user, address token, uint amount)`\n // representing an amount of tokens accumulated by `user`.\n // The Merkle tree is assumed to have only increasing amounts: that is to say if a user can claim 1,\n // then after the amount associated in the Merkle tree for this token should be x > 1\n bytes32 merkleRoot;\n // Ipfs hash of the tree data\n bytes32 ipfsHash;\n}\n\nstruct Claim {\n uint208 amount;\n uint48 timestamp;\n bytes32 merkleRoot;\n}\n\n/// @title Distributor\n/// @notice Allows LPs on AMMs with concentrated liquidity to claim the rewards that were distributed to them\n/// @author Angle Labs. Inc\ncontract Distributor is UUPSHelper {\n using SafeERC20 for IERC20;\n\n /// @notice Epoch duration\n uint32 internal constant _EPOCH_DURATION = 3600;\n\n // ================================= VARIABLES =================================\n\n /// @notice Tree of claimable tokens through this contract\n MerkleTree public tree;\n\n /// @notice Tree that was in place in the contract before the last `tree` update\n MerkleTree public lastTree;\n\n /// @notice Token to deposit to freeze the roots update\n IERC20 public disputeToken;\n\n /// @notice `Core` contract handling access control\n ICore public core;\n\n /// @notice Address which created the dispute\n /// @dev Used to store if there is an ongoing dispute\n address public disputer;\n\n /// @notice When the current tree will become valid\n uint48 public endOfDisputePeriod;\n\n /// @notice Time after which a change in a tree becomes effective, in EPOCH_DURATION\n uint48 public disputePeriod;\n\n /// @notice Amount to deposit to freeze the roots update\n uint256 public disputeAmount;\n\n /// @notice Mapping user -> token -> amount to track claimed amounts\n mapping(address => mapping(address => Claim)) public claimed;\n\n /// @notice Trusted EOAs to update the Merkle root\n mapping(address => uint256) public canUpdateMerkleRoot;\n\n /// @notice Whether or not to disable permissionless claiming\n mapping(address => uint256) public onlyOperatorCanClaim;\n\n /// @notice user -> operator -> authorisation to claim\n mapping(address => mapping(address => uint256)) public operators;\n\n uint256[38] private __gap;\n\n // =================================== EVENTS ==================================\n\n event Claimed(address indexed user, address indexed token, uint256 amount);\n event DisputeAmountUpdated(uint256 _disputeAmount);\n event Disputed(string reason);\n event DisputePeriodUpdated(uint48 _disputePeriod);\n event DisputeResolved(bool valid);\n event DisputeTokenUpdated(address indexed _disputeToken);\n event OperatorClaimingToggled(address indexed user, bool isEnabled);\n event OperatorToggled(address indexed user, address indexed operator, bool isWhitelisted);\n event Recovered(address indexed token, address indexed to, uint256 amount);\n event Revoked(); // With this event an indexer could maintain a table (timestamp, merkleRootUpdate)\n event TreeUpdated(bytes32 merkleRoot, bytes32 ipfsHash, uint48 endOfDisputePeriod);\n event TrustedToggled(address indexed eoa, bool trust);\n\n // ================================= MODIFIERS =================================\n\n /// @notice Checks whether the `msg.sender` has the governor role or the guardian role\n modifier onlyGovernorOrGuardian() {\n if (!core.isGovernorOrGuardian(msg.sender)) revert NotGovernorOrGuardian();\n _;\n }\n\n /// @notice Checks whether the `msg.sender` is the `user` address or is a trusted address\n modifier onlyTrustedOrUser(address user) {\n if (user != msg.sender && canUpdateMerkleRoot[msg.sender] != 1 && !core.isGovernorOrGuardian(msg.sender))\n revert NotTrusted();\n _;\n }\n\n // ================================ CONSTRUCTOR ================================\n\n constructor() initializer {}\n\n function initialize(ICore _core) external initializer {\n if (address(_core) == address(0)) revert ZeroAddress();\n core = _core;\n }\n\n /// @inheritdoc UUPSUpgradeable\n function _authorizeUpgrade(address) internal view override onlyGuardianUpgrader(core) {}\n\n // =============================== MAIN FUNCTION ===============================\n\n /// @notice Claims rewards for a given set of users\n /// @dev Anyone may call this function for anyone else, funds go to destination regardless, it's just a question of\n /// who provides the proof and pays the gas: `msg.sender` is used only for addresses that require a trusted operator\n /// @param users Recipient of tokens\n /// @param tokens ERC20 claimed\n /// @param amounts Amount of tokens that will be sent to the corresponding users\n /// @param proofs Array of hashes bridging from a leaf `(hash of user | token | amount)` to the Merkle root\n function claim(\n address[] calldata users,\n address[] calldata tokens,\n uint256[] calldata amounts,\n bytes32[][] calldata proofs\n ) external {\n uint256 usersLength = users.length;\n if (\n usersLength == 0 ||\n usersLength != tokens.length ||\n usersLength != amounts.length ||\n usersLength != proofs.length\n ) revert InvalidLengths();\n\n for (uint256 i; i < usersLength; ) {\n address user = users[i];\n address token = tokens[i];\n uint256 amount = amounts[i];\n\n // Checking if only an approved operator can claim for `user`\n if (onlyOperatorCanClaim[user] == 1 && operators[user][msg.sender] == 0) revert NotWhitelisted();\n\n // Verifying proof\n bytes32 leaf = keccak256(abi.encode(user, token, amount));\n if (!_verifyProof(leaf, proofs[i])) revert InvalidProof();\n\n // Closing reentrancy gate here\n uint256 toSend = amount - claimed[user][token].amount;\n claimed[user][token] = Claim(SafeCast.toUint208(amount), uint48(block.timestamp), getMerkleRoot());\n\n IERC20(token).safeTransfer(user, toSend);\n emit Claimed(user, token, toSend);\n unchecked {\n ++i;\n }\n }\n }\n\n /// @notice Returns the MerkleRoot that is currently live for the contract\n function getMerkleRoot() public view returns (bytes32) {\n if (block.timestamp >= endOfDisputePeriod && disputer == address(0)) return tree.merkleRoot;\n else return lastTree.merkleRoot;\n }\n\n // ============================ GOVERNANCE FUNCTIONS ===========================\n\n /// @notice Adds or removes EOAs which are trusted to update the Merkle root\n function toggleTrusted(address eoa) external onlyGovernorOrGuardian {\n uint256 trustedStatus = 1 - canUpdateMerkleRoot[eoa];\n canUpdateMerkleRoot[eoa] = trustedStatus;\n emit TrustedToggled(eoa, trustedStatus == 1);\n }\n\n /// @notice Updates Merkle Tree\n function updateTree(MerkleTree calldata _tree) external {\n if (\n disputer != address(0) ||\n // A trusted address cannot update a tree right after a precedent tree update otherwise it can de facto\n // validate a tree which has not passed the dispute period\n ((canUpdateMerkleRoot[msg.sender] != 1 || block.timestamp < endOfDisputePeriod) &&\n !core.isGovernorOrGuardian(msg.sender))\n ) revert NotTrusted();\n MerkleTree memory _lastTree = tree;\n tree = _tree;\n lastTree = _lastTree;\n\n uint48 _endOfPeriod = _endOfDisputePeriod(uint48(block.timestamp));\n endOfDisputePeriod = _endOfPeriod;\n emit TreeUpdated(_tree.merkleRoot, _tree.ipfsHash, _endOfPeriod);\n }\n\n /// @notice Freezes the Merkle tree update until the dispute is resolved\n /// @dev Requires a deposit of `disputeToken` that'll be slashed if the dispute is not accepted\n /// @dev It is only possible to create a dispute within `disputePeriod` after each tree update\n function disputeTree(string memory reason) external {\n if (disputer != address(0)) revert UnresolvedDispute();\n if (block.timestamp >= endOfDisputePeriod) revert InvalidDispute();\n IERC20(disputeToken).safeTransferFrom(msg.sender, address(this), disputeAmount);\n disputer = msg.sender;\n emit Disputed(reason);\n }\n\n /// @notice Resolve the ongoing dispute, if any\n /// @param valid Whether the dispute was valid\n function resolveDispute(bool valid) external onlyGovernorOrGuardian {\n if (disputer == address(0)) revert NoDispute();\n if (valid) {\n IERC20(disputeToken).safeTransfer(disputer, disputeAmount);\n // If a dispute is valid, the contract falls back to the last tree that was updated\n _revokeTree();\n } else {\n IERC20(disputeToken).safeTransfer(msg.sender, disputeAmount);\n endOfDisputePeriod = _endOfDisputePeriod(uint48(block.timestamp));\n }\n disputer = address(0);\n emit DisputeResolved(valid);\n }\n\n /// @notice Allows the governor or the guardian of this contract to fallback to the last version of the tree\n /// immediately\n function revokeTree() external onlyGovernorOrGuardian {\n if (disputer != address(0)) revert UnresolvedDispute();\n _revokeTree();\n }\n\n /// @notice Toggles permissioned claiming for a given user\n function toggleOnlyOperatorCanClaim(address user) external onlyTrustedOrUser(user) {\n uint256 oldValue = onlyOperatorCanClaim[user];\n onlyOperatorCanClaim[user] = 1 - oldValue;\n emit OperatorClaimingToggled(user, oldValue == 0);\n }\n\n /// @notice Toggles whitelisting for a given user and a given operator\n function toggleOperator(address user, address operator) external onlyTrustedOrUser(user) {\n uint256 oldValue = operators[user][operator];\n operators[user][operator] = 1 - oldValue;\n emit OperatorToggled(user, operator, oldValue == 0);\n }\n\n /// @notice Recovers any ERC20 token\n function recoverERC20(address tokenAddress, address to, uint256 amountToRecover) external onlyGovernorOrGuardian {\n IERC20(tokenAddress).safeTransfer(to, amountToRecover);\n emit Recovered(tokenAddress, to, amountToRecover);\n }\n\n /// @notice Sets the dispute period after which a tree update becomes effective\n function setDisputePeriod(uint48 _disputePeriod) external onlyGovernorOrGuardian {\n disputePeriod = uint48(_disputePeriod);\n emit DisputePeriodUpdated(_disputePeriod);\n }\n\n /// @notice Sets the token used as a caution during disputes\n function setDisputeToken(IERC20 _disputeToken) external onlyGovernorOrGuardian {\n if (disputer != address(0)) revert UnresolvedDispute();\n disputeToken = _disputeToken;\n emit DisputeTokenUpdated(address(_disputeToken));\n }\n\n /// @notice Sets the amount of `disputeToken` used as a caution during disputes\n function setDisputeAmount(uint256 _disputeAmount) external onlyGovernorOrGuardian {\n if (disputer != address(0)) revert UnresolvedDispute();\n disputeAmount = _disputeAmount;\n emit DisputeAmountUpdated(_disputeAmount);\n }\n\n // ============================= INTERNAL FUNCTIONS ============================\n\n /// @notice Fallback to the last version of the tree\n function _revokeTree() internal {\n MerkleTree memory _tree = lastTree;\n endOfDisputePeriod = 0;\n tree = _tree;\n emit Revoked();\n emit TreeUpdated(\n _tree.merkleRoot,\n _tree.ipfsHash,\n (uint48(block.timestamp) / _EPOCH_DURATION) * (_EPOCH_DURATION) // Last hour\n );\n }\n\n /// @notice Returns the end of the dispute period\n /// @dev treeUpdate is rounded up to next hour and then `disputePeriod` hours are added\n function _endOfDisputePeriod(uint48 treeUpdate) internal view returns (uint48) {\n return ((treeUpdate - 1) / _EPOCH_DURATION + 1 + disputePeriod) * (_EPOCH_DURATION);\n }\n\n /// @notice Checks the validity of a proof\n /// @param leaf Hashed leaf data, the starting point of the proof\n /// @param proof Array of hashes forming a hash chain from leaf to root\n /// @return true If proof is correct, else false\n function _verifyProof(bytes32 leaf, bytes32[] memory proof) internal view returns (bool) {\n bytes32 currentHash = leaf;\n uint256 proofLength = proof.length;\n for (uint256 i; i < proofLength; ) {\n if (currentHash < proof[i]) {\n currentHash = keccak256(abi.encode(currentHash, proof[i]));\n } else {\n currentHash = keccak256(abi.encode(proof[i], currentHash));\n }\n unchecked {\n ++i;\n }\n }\n bytes32 root = getMerkleRoot();\n if (root == bytes32(0)) revert InvalidUninitializedRoot();\n return currentHash == root;\n }\n}\n" + }, + "contracts/external/AccessControlUpgradeable.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.7;\n\nimport \"@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\n\n/**\n * @dev This contract is fully forked from OpenZeppelin `AccessControlUpgradeable`.\n * The only difference is the removal of the ERC165 implementation as it's not\n * needed in Angle.\n *\n * Contract module that allows children to implement role-based access\n * control mechanisms. This is a lightweight version that doesn't allow enumerating role\n * members except through off-chain means by accessing the contract event logs. Some\n * applications may benefit from on-chain enumerability, for those cases see\n * {AccessControlEnumerable}.\n *\n * Roles are referred to by their `bytes32` identifier. These should be exposed\n * in the external API and be unique. The best way to achieve this is by\n * using `public constant` hash digests:\n *\n * ```\n * bytes32 public constant MY_ROLE = keccak256(\"MY_ROLE\");\n * ```\n *\n * Roles can be used to represent a set of permissions. To restrict access to a\n * function call, use {hasRole}:\n *\n * ```\n * function foo() public {\n * require(hasRole(MY_ROLE, msg.sender));\n * ...\n * }\n * ```\n *\n * Roles can be granted and revoked dynamically via the {grantRole} and\n * {revokeRole} functions. Each role has an associated admin role, and only\n * accounts that have a role's admin role can call {grantRole} and {revokeRole}.\n *\n * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means\n * that only accounts with this role will be able to grant or revoke other\n * roles. More complex role relationships can be created by using\n * {_setRoleAdmin}.\n *\n * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to\n * grant and revoke this role. Extra precautions should be taken to secure\n * accounts that have been granted it.\n */\n//solhint-disable\nabstract contract AccessControlUpgradeable is Initializable {\n function __AccessControl_init() internal initializer {\n __AccessControl_init_unchained();\n }\n\n function __AccessControl_init_unchained() internal initializer {}\n\n struct RoleData {\n mapping(address => bool) members;\n bytes32 adminRole;\n }\n\n mapping(bytes32 => RoleData) private _roles;\n\n bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;\n\n /**\n * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`\n *\n * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite\n * {RoleAdminChanged} not being emitted signaling this.\n *\n * _Available since v3.1._\n */\n event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);\n\n /**\n * @dev Emitted when `account` is granted `role`.\n *\n * `sender` is the account that originated the contract call, an admin role\n * bearer except when using {_setupRole}.\n */\n event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);\n\n /**\n * @dev Emitted when `account` is revoked `role`.\n *\n * `sender` is the account that originated the contract call:\n * - if using `revokeRole`, it is the admin role bearer\n * - if using `renounceRole`, it is the role bearer (i.e. `account`)\n */\n event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);\n\n /**\n * @dev Modifier that checks that an account has a specific role. Reverts\n * with a standardized message including the required role.\n *\n * The format of the revert reason is given by the following regular expression:\n *\n * /^AccessControl: account (0x[0-9a-f]{20}) is missing role (0x[0-9a-f]{32})$/\n *\n * _Available since v4.1._\n */\n modifier onlyRole(bytes32 role) {\n _checkRole(role, msg.sender);\n _;\n }\n\n /**\n * @dev Returns `true` if `account` has been granted `role`.\n */\n function hasRole(bytes32 role, address account) public view returns (bool) {\n return _roles[role].members[account];\n }\n\n /**\n * @dev Revert with a standard message if `account` is missing `role`.\n *\n * The format of the revert reason is given by the following regular expression:\n *\n * /^AccessControl: account (0x[0-9a-f]{20}) is missing role (0x[0-9a-f]{32})$/\n */\n function _checkRole(bytes32 role, address account) internal view {\n if (!hasRole(role, account)) {\n revert(\n string(\n abi.encodePacked(\n \"AccessControl: account \",\n StringsUpgradeable.toHexString(uint160(account), 20),\n \" is missing role \",\n StringsUpgradeable.toHexString(uint256(role), 32)\n )\n )\n );\n }\n }\n\n /**\n * @dev Returns the admin role that controls `role`. See {grantRole} and\n * {revokeRole}.\n *\n * To change a role's admin, use {_setRoleAdmin}.\n */\n function getRoleAdmin(bytes32 role) public view returns (bytes32) {\n return _roles[role].adminRole;\n }\n\n /**\n * @dev Grants `role` to `account`.\n *\n * If `account` had not been already granted `role`, emits a {RoleGranted}\n * event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n */\n function grantRole(bytes32 role, address account) external onlyRole(getRoleAdmin(role)) {\n _grantRole(role, account);\n }\n\n /**\n * @dev Revokes `role` from `account`.\n *\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n */\n function revokeRole(bytes32 role, address account) external onlyRole(getRoleAdmin(role)) {\n _revokeRole(role, account);\n }\n\n /**\n * @dev Revokes `role` from the calling account.\n *\n * Roles are often managed via {grantRole} and {revokeRole}: this function's\n * purpose is to provide a mechanism for accounts to lose their privileges\n * if they are compromised (such as when a trusted device is misplaced).\n *\n * If the calling account had been granted `role`, emits a {RoleRevoked}\n * event.\n *\n * Requirements:\n *\n * - the caller must be `account`.\n */\n function renounceRole(bytes32 role, address account) external {\n require(account == msg.sender, \"71\");\n\n _revokeRole(role, account);\n }\n\n /**\n * @dev Grants `role` to `account`.\n *\n * If `account` had not been already granted `role`, emits a {RoleGranted}\n * event. Note that unlike {grantRole}, this function doesn't perform any\n * checks on the calling account.\n *\n * [WARNING]\n * ====\n * This function should only be called from the constructor when setting\n * up the initial roles for the system.\n *\n * Using this function in any other way is effectively circumventing the admin\n * system imposed by {AccessControl}.\n * ====\n */\n function _setupRole(bytes32 role, address account) internal {\n _grantRole(role, account);\n }\n\n /**\n * @dev Sets `adminRole` as ``role``'s admin role.\n *\n * Emits a {RoleAdminChanged} event.\n */\n function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal {\n emit RoleAdminChanged(role, getRoleAdmin(role), adminRole);\n _roles[role].adminRole = adminRole;\n }\n\n function _grantRole(bytes32 role, address account) internal {\n if (!hasRole(role, account)) {\n _roles[role].members[account] = true;\n emit RoleGranted(role, account, msg.sender);\n }\n }\n\n function _revokeRole(bytes32 role, address account) internal {\n if (hasRole(role, account)) {\n _roles[role].members[account] = false;\n emit RoleRevoked(role, account, msg.sender);\n }\n }\n\n uint256[49] private __gap;\n}\n" + }, + "contracts/external/ProxyAdmin.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"./TransparentUpgradeableProxy.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\n/**\n * @dev This is an auxiliary contract meant to be assigned as the admin of a {TransparentUpgradeableProxy}. For an\n * explanation of why you would want to use this see the documentation for {TransparentUpgradeableProxy}.\n * This contract was fully forked from OpenZeppelin `ProxyAdmin`\n */\ncontract ProxyAdmin is Ownable {\n /**\n * @dev Returns the current implementation of `proxy`.\n *\n * Requirements:\n *\n * - This contract must be the admin of `proxy`.\n */\n function getProxyImplementation(TransparentUpgradeableProxy proxy) public view virtual returns (address) {\n // We need to manually run the static call since the getter cannot be flagged as view\n // bytes4(keccak256(\"implementation()\")) == 0x5c60da1b\n (bool success, bytes memory returndata) = address(proxy).staticcall(hex\"5c60da1b\");\n require(success);\n return abi.decode(returndata, (address));\n }\n\n /**\n * @dev Returns the current admin of `proxy`.\n *\n * Requirements:\n *\n * - This contract must be the admin of `proxy`.\n */\n function getProxyAdmin(TransparentUpgradeableProxy proxy) public view virtual returns (address) {\n // We need to manually run the static call since the getter cannot be flagged as view\n // bytes4(keccak256(\"admin()\")) == 0xf851a440\n (bool success, bytes memory returndata) = address(proxy).staticcall(hex\"f851a440\");\n require(success);\n return abi.decode(returndata, (address));\n }\n\n /**\n * @dev Changes the admin of `proxy` to `newAdmin`.\n *\n * Requirements:\n *\n * - This contract must be the current admin of `proxy`.\n */\n function changeProxyAdmin(TransparentUpgradeableProxy proxy, address newAdmin) public virtual onlyOwner {\n proxy.changeAdmin(newAdmin);\n }\n\n /**\n * @dev Upgrades `proxy` to `implementation`. See {TransparentUpgradeableProxy-upgradeTo}.\n *\n * Requirements:\n *\n * - This contract must be the admin of `proxy`.\n */\n function upgrade(TransparentUpgradeableProxy proxy, address implementation) public virtual onlyOwner {\n proxy.upgradeTo(implementation);\n }\n\n /**\n * @dev Upgrades `proxy` to `implementation` and calls a function on the new implementation. See\n * {TransparentUpgradeableProxy-upgradeToAndCall}.\n *\n * Requirements:\n *\n * - This contract must be the admin of `proxy`.\n */\n function upgradeAndCall(\n TransparentUpgradeableProxy proxy,\n address implementation,\n bytes memory data\n ) public payable virtual onlyOwner {\n proxy.upgradeToAndCall{ value: msg.value }(implementation, data);\n }\n}\n" + }, + "contracts/external/TransparentUpgradeableProxy.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol\";\n\n/**\n * @dev This contract implements a proxy that is upgradeable by an admin. It is fully forked from OpenZeppelin\n * `TransparentUpgradeableProxy`\n *\n * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector\n * clashing], which can potentially be used in an attack, this contract uses the\n * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two\n * things that go hand in hand:\n *\n * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if\n * that call matches one of the admin functions exposed by the proxy itself.\n * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the\n * implementation. If the admin tries to call a function on the implementation it will fail with an error that says\n * \"admin cannot fallback to proxy target\".\n *\n * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing\n * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due\n * to sudden errors when trying to call a function from the proxy implementation.\n *\n * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,\n * you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\n */\ncontract TransparentUpgradeableProxy is ERC1967Proxy {\n /**\n * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.\n */\n modifier ifAdmin() {\n if (msg.sender == _getAdmin()) {\n _;\n } else {\n _fallback();\n }\n }\n\n /**\n * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and\n * optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\n */\n constructor(\n address _logic,\n address admin_,\n bytes memory _data\n ) payable ERC1967Proxy(_logic, _data) {\n assert(_ADMIN_SLOT == bytes32(uint256(keccak256(\"eip1967.proxy.admin\")) - 1));\n _changeAdmin(admin_);\n }\n\n /**\n * @dev Returns the current admin.\n *\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.\n *\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\n */\n function admin() external ifAdmin returns (address admin_) {\n admin_ = _getAdmin();\n }\n\n /**\n * @dev Returns the current implementation.\n *\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.\n *\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\n * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\n */\n function implementation() external ifAdmin returns (address implementation_) {\n implementation_ = _implementation();\n }\n\n /**\n * @dev Changes the admin of the proxy.\n *\n * Emits an {AdminChanged} event.\n *\n * NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\n */\n function changeAdmin(address newAdmin) external virtual ifAdmin {\n _changeAdmin(newAdmin);\n }\n\n /**\n * @dev Upgrade the implementation of the proxy.\n *\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\n */\n function upgradeTo(address newImplementation) external ifAdmin {\n _upgradeToAndCall(newImplementation, bytes(\"\"), false);\n }\n\n /**\n * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified\n * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the\n * proxied contract.\n *\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\n */\n function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {\n _upgradeToAndCall(newImplementation, data, true);\n }\n\n /**\n * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.\n */\n function _beforeFallback() internal virtual override {\n require(msg.sender != _getAdmin(), \"TransparentUpgradeableProxy: admin cannot fallback to proxy target\");\n super._beforeFallback();\n }\n\n /**\n * @dev Returns the current admin.\n */\n function _admin() internal view virtual returns (address) {\n return _getAdmin();\n }\n}\n" + }, + "contracts/interfaces/CoreModuleInterfaces.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.7;\n\n/// @title IAngleMiddlemanGauge\n/// @author Angle Core Team\n/// @notice Interface for the `AngleMiddleman` contract\ninterface IAngleMiddlemanGauge {\n function notifyReward(address gauge, uint256 amount) external;\n}\n\ninterface IStakingRewards {\n function notifyRewardAmount(uint256 reward) external;\n}\n\ninterface IGaugeController {\n //solhint-disable-next-line\n function gauge_types(address addr) external view returns (int128);\n\n //solhint-disable-next-line\n function gauge_relative_weight_write(address addr, uint256 timestamp) external returns (uint256);\n\n //solhint-disable-next-line\n function gauge_relative_weight(address addr, uint256 timestamp) external view returns (uint256);\n}\n\ninterface ILiquidityGauge {\n // solhint-disable-next-line\n function deposit_reward_token(address _rewardToken, uint256 _amount) external;\n}\n" + }, + "contracts/interfaces/external/algebra/IAlgebraPool.sol": { + "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title IAlgebraPool\n/// @dev Copied from: https://github.com/cryptoalgebra/Algebra/blob/master/src/core/contracts/interfaces/pool/IAlgebraPoolState.sol\ninterface IAlgebraPool {\n /**\n * @notice The globalState structure in the pool stores many values but requires only one slot\n * and is exposed as a single method to save gas when accessed externally.\n * @return price The current price of the pool as a sqrt(token1/token0) Q64.96 value;\n * Returns tick The current tick of the pool, i.e. according to the last tick transition that was run;\n * Returns This value may not always be equal to SqrtTickMath.getTickAtSqrtRatio(price) if the price is on a tick\n * boundary;\n * Returns fee The last pool fee value in hundredths of a bip, i.e. 1e-6;\n * Returns timepointIndex The index of the last written timepoint;\n * Returns communityFeeToken0 The community fee percentage of the swap fee in thousandths (1e-3) for token0;\n * Returns communityFeeToken1 The community fee percentage of the swap fee in thousandths (1e-3) for token1;\n * Returns unlocked Whether the pool is currently locked to reentrancy;\n */\n function globalState()\n external\n view\n returns (\n uint160 price,\n int24 tick,\n uint16 fee,\n uint16 timepointIndex,\n uint8 communityFeeToken0,\n uint8 communityFeeToken1,\n bool unlocked\n );\n}\n" + }, + "contracts/interfaces/external/uniswap/IUniswapV3Pool.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity >=0.5.0;\n\n/// @title Pool state that never changes\n/// @notice These parameters are fixed for a pool forever, i.e., the methods will always return the same values\ninterface IUniswapV3Pool {\n /// @notice The first of the two tokens of the pool, sorted by address\n /// @return The token contract address\n function token0() external view returns (address);\n\n /// @notice The second of the two tokens of the pool, sorted by address\n /// @return The token contract address\n function token1() external view returns (address);\n\n /// @notice The pool's fee in hundredths of a bip, i.e. 1e-6\n /// @return The fee\n function fee() external view returns (uint24);\n}\n" + }, + "contracts/interfaces/IAgToken.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\";\n\n/// @title IAgToken\n/// @author Angle Core Team\n/// @notice Interface for the stablecoins `AgToken` contracts\n/// @dev This interface only contains functions of the `AgToken` contract which are called by other contracts\n/// of this module or of the first module of the Angle Protocol\ninterface IAgToken is IERC20Upgradeable {\n // ======================= Minter Role Only Functions ===========================\n\n /// @notice Lets the `StableMaster` contract or another whitelisted contract mint agTokens\n /// @param account Address to mint to\n /// @param amount Amount to mint\n /// @dev The contracts allowed to issue agTokens are the `StableMaster` contract, `VaultManager` contracts\n /// associated to this stablecoin as well as the flash loan module (if activated) and potentially contracts\n /// whitelisted by governance\n function mint(address account, uint256 amount) external;\n\n /// @notice Burns `amount` tokens from a `burner` address after being asked to by `sender`\n /// @param amount Amount of tokens to burn\n /// @param burner Address to burn from\n /// @param sender Address which requested the burn from `burner`\n /// @dev This method is to be called by a contract with the minter right after being requested\n /// to do so by a `sender` address willing to burn tokens from another `burner` address\n /// @dev The method checks the allowance between the `sender` and the `burner`\n function burnFrom(uint256 amount, address burner, address sender) external;\n\n /// @notice Burns `amount` tokens from a `burner` address\n /// @param amount Amount of tokens to burn\n /// @param burner Address to burn from\n /// @dev This method is to be called by a contract with a minter right on the AgToken after being\n /// requested to do so by an address willing to burn tokens from its address\n function burnSelf(uint256 amount, address burner) external;\n\n // ========================= Treasury Only Functions ===========================\n\n /// @notice Adds a minter in the contract\n /// @param minter Minter address to add\n /// @dev Zero address checks are performed directly in the `Treasury` contract\n function addMinter(address minter) external;\n\n /// @notice Removes a minter from the contract\n /// @param minter Minter address to remove\n /// @dev This function can also be called by a minter wishing to revoke itself\n function removeMinter(address minter) external;\n\n /// @notice Sets a new treasury contract\n /// @param _treasury New treasury address\n function setTreasury(address _treasury) external;\n\n // ========================= External functions ================================\n\n /// @notice Checks whether an address has the right to mint agTokens\n /// @param minter Address for which the minting right should be checked\n /// @return Whether the address has the right to mint agTokens or not\n function isMinter(address minter) external view returns (bool);\n}\n" + }, + "contracts/interfaces/ICore.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\n/// @title ICore\n/// @author Angle Labs, Inc.\n/// @notice Interface for the `Core` contracts of smart contract modules used in Angle Labs contracts\ninterface ICore {\n /// @notice Checks whether an address is governor\n /// @param admin Address to check\n /// @return Whether the address has the `GOVERNOR_ROLE` or not\n function isGovernor(address admin) external view returns (bool);\n\n /// @notice Checks whether an address is a governor or a guardian of a module\n /// @param admin Address to check\n /// @return Whether the address has the `GUARDIAN_ROLE` or not\n /// @dev Governance should make sure when adding a governor to also give this governor the guardian\n /// role by calling the `addGovernor` function\n function isGovernorOrGuardian(address admin) external view returns (bool);\n}\n" + }, + "contracts/interfaces/ITreasury.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"./IAgToken.sol\";\nimport \"./ICore.sol\";\n\n/// @title ITreasury\n/// @author Angle Core Team\n/// @notice Interface for the `Treasury` contract\n/// @dev This interface only contains functions of the `Treasury` which are called by other contracts\n/// of this module\ninterface ITreasury {\n /// @notice Stablecoin handled by this `treasury` contract\n function stablecoin() external view returns (IAgToken);\n\n /// @notice Checks whether a given address has the governor role\n /// @param admin Address to check\n /// @return Whether the address has the governor role\n /// @dev Access control is only kept in the `CoreBorrow` contract\n function isGovernor(address admin) external view returns (bool);\n\n /// @notice Checks whether a given address has the guardian or the governor role\n /// @param admin Address to check\n /// @return Whether the address has the guardian or the governor role\n /// @dev Access control is only kept in the `CoreBorrow` contract which means that this function\n /// queries the `CoreBorrow` contract\n function isGovernorOrGuardian(address admin) external view returns (bool);\n}\n" + }, + "contracts/middleman/MerklGaugeMiddleman.sol": { + "content": "// SPDX-License-Identifier: BUSL-1.1\n\n/*\n * █ \n ***** ▓▓▓ \n * ▓▓▓▓▓▓▓ \n * ///. ▓▓▓▓▓▓▓▓▓▓▓▓▓ \n ***** //////// ▓▓▓▓▓▓▓ \n * ///////////// ▓▓▓ \n ▓▓ ////////////////// █ ▓▓ \n ▓▓ ▓▓ /////////////////////// ▓▓ ▓▓ \n ▓▓ ▓▓ //////////////////////////// ▓▓ ▓▓ \n ▓▓ ▓▓ /////////▓▓▓///////▓▓▓///////// ▓▓ ▓▓ \n ▓▓ ,////////////////////////////////////// ▓▓ ▓▓ \n ▓▓ ////////////////////////////////////////// ▓▓ \n ▓▓ //////////////////////▓▓▓▓///////////////////// \n ,//////////////////////////////////////////////////// \n .////////////////////////////////////////////////////////// \n .//////////////////////////██.,//////////////////////////█ \n .//////////////////////████..,./////////////////////██ \n ...////////////////███████.....,.////////////////███ \n ,.,////////////████████ ........,///////////████ \n .,.,//////█████████ ,.......///////████ \n ,..//████████ ........./████ \n ..,██████ .....,███ \n .██ ,.,█ \n \n \n \n ▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓ ▓▓▓▓▓▓▓▓▓▓ \n ▓▓▓▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓ ▓▓ ▓▓▓▓ \n ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓ ▓▓▓▓▓ \n ▓▓▓ ▓▓ ▓▓▓ ▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ \n*/\n\npragma solidity ^0.8.17;\n\nimport { IERC20 } from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport { SafeERC20 } from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\n\nimport \"../DistributionCreator.sol\";\n\n/// @title MerklGaugeMiddleman\n/// @author Angle Labs, Inc.\n/// @notice Manages the transfer of ANGLE rewards to the `DistributionCreator` contract\n/// @dev This contract is built under the assumption that the `DistributionCreator` contract has already whitelisted\n/// this contract for it to distribute rewards without having to sign a message\n/// @dev Transient funds left in this contract after a call may be exploited\ncontract MerklGaugeMiddleman {\n using SafeERC20 for IERC20;\n\n // ================================= PARAMETERS ================================\n\n /// @notice Contract handling access control\n ICore public accessControlManager;\n\n /// @notice Maps a gauge to its reward parameters\n mapping(address => DistributionParameters) public gaugeParams;\n\n // =================================== EVENT ===================================\n\n event GaugeSet(address indexed gauge);\n\n constructor(ICore _accessControlManager) {\n if (address(_accessControlManager) == address(0)) revert ZeroAddress();\n accessControlManager = _accessControlManager;\n IERC20 _angle = angle();\n // Condition left here for testing purposes\n if (address(_angle) != address(0))\n _angle.safeIncreaseAllowance(address(merklDistributionCreator()), type(uint256).max);\n }\n\n // ================================= REFERENCES ================================\n\n /// @notice Address of the ANGLE token\n function angle() public view virtual returns (IERC20) {\n return IERC20(0x31429d1856aD1377A8A0079410B297e1a9e214c2);\n }\n\n /// @notice Address of the Merkl contract managing rewards to be distributed\n /// @dev Address is the same across the different chains on which it is deployed\n function merklDistributionCreator() public view virtual returns (DistributionCreator) {\n return DistributionCreator(0x8BB4C975Ff3c250e0ceEA271728547f3802B36Fd);\n }\n\n // ============================= EXTERNAL FUNCTIONS ============================\n\n /// @notice Restores the allowance for the ANGLE token to the `DistributionCreator` contract\n function setAngleAllowance() external {\n IERC20 _angle = angle();\n address manager = address(merklDistributionCreator());\n uint256 currentAllowance = _angle.allowance(address(this), manager);\n if (currentAllowance < type(uint256).max)\n _angle.safeIncreaseAllowance(manager, type(uint256).max - currentAllowance);\n }\n\n /// @notice Specifies the reward distribution parameters for `gauge`\n function setGauge(address gauge, DistributionParameters memory params) external {\n if (!accessControlManager.isGovernorOrGuardian(msg.sender)) revert NotGovernorOrGuardian();\n DistributionCreator manager = merklDistributionCreator();\n if (\n gauge == address(0) ||\n params.rewardToken != address(angle()) ||\n (manager.isWhitelistedToken(IUniswapV3Pool(params.uniV3Pool).token0()) == 0 &&\n manager.isWhitelistedToken(IUniswapV3Pool(params.uniV3Pool).token1()) == 0)\n ) revert InvalidParams();\n gaugeParams[gauge] = params;\n emit GaugeSet(gauge);\n }\n\n /// @notice Transmits rewards from the `AngleDistributor` to the `DistributionCreator` with the correct\n /// parameters\n /// @dev Callable by any contract\n /// @dev This method can be used to recover leftover ANGLE tokens in the contract\n function notifyReward(address gauge, uint256 amount) public {\n DistributionParameters memory params = gaugeParams[gauge];\n if (params.uniV3Pool == address(0)) revert InvalidParams();\n if (amount == 0) amount = angle().balanceOf(address(this));\n params.epochStart = uint32(block.timestamp);\n params.amount = amount;\n DistributionCreator creator = merklDistributionCreator();\n if (amount > 0) {\n // Need to deal with minimum distribution amounts\n if (amount > creator.rewardTokenMinAmounts(address(angle())) * params.numEpoch) {\n merklDistributionCreator().createDistribution(params);\n } else {\n // Sending leftover ANGLE tokens to the `msg.sender`\n angle().safeTransfer(msg.sender, amount);\n }\n }\n }\n\n /// @notice Fetches tokens and transmits rewards in the same transaction\n function notifyRewardWithTransfer(address gauge, uint256 amount) external {\n angle().safeTransferFrom(msg.sender, address(this), amount);\n notifyReward(gauge, amount);\n }\n}\n" + }, + "contracts/middleman/MerklGaugeMiddlemanPolygon.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"./MerklGaugeMiddleman.sol\";\n\n/// @title MerklGaugeMiddlemanPolygon\n/// @author Angle Labs, Inc.\ncontract MerklGaugeMiddlemanPolygon is MerklGaugeMiddleman {\n constructor(ICore _accessControlManager) MerklGaugeMiddleman(_accessControlManager) {}\n\n function angle() public pure override returns (IERC20) {\n return IERC20(0x900F717EA076E1E7a484ad9DD2dB81CEEc60eBF1);\n }\n}\n" + }, + "contracts/mock/AngleDistributor.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.7;\n\nimport \"./AngleDistributorEvents.sol\";\n\n/// @title AngleDistributor\n/// @author Forked from contracts developed by Curve and Frax and adapted by Angle Core Team\n/// - ERC20CRV.vy (https://github.com/curvefi/curve-dao-contracts/blob/master/contracts/ERC20CRV.vy)\n/// - FraxGaugeFXSRewardsDistributor.sol (https://github.com/FraxFinance/frax-solidity/blob/master/src/hardhat/contracts/Curve/FraxGaugeFXSRewardsDistributor.sol)\n/// @notice All the events used in `AngleDistributor` contract\ncontract AngleDistributor is AngleDistributorEvents, ReentrancyGuardUpgradeable, AccessControlUpgradeable {\n using SafeERC20 for IERC20;\n\n /// @notice Role for governors only\n bytes32 public constant GOVERNOR_ROLE = keccak256(\"GOVERNOR_ROLE\");\n /// @notice Role for the guardian\n bytes32 public constant GUARDIAN_ROLE = keccak256(\"GUARDIAN_ROLE\");\n\n /// @notice Length of a week in seconds\n uint256 public constant WEEK = 3600 * 24 * 7;\n\n /// @notice Time at which the emission rate is updated\n uint256 public constant RATE_REDUCTION_TIME = WEEK;\n\n /// @notice Reduction of the emission rate\n uint256 public constant RATE_REDUCTION_COEFFICIENT = 1007827884862117171; // 1.5 ^ (1/52) * 10**18\n\n /// @notice Base used for computation\n uint256 public constant BASE = 10**18;\n\n /// @notice Maps the address of a gauge to the last time this gauge received rewards\n mapping(address => uint256) public lastTimeGaugePaid;\n\n /// @notice Maps the address of a gauge to whether it was killed or not\n /// A gauge killed in this contract cannot receive any rewards\n mapping(address => bool) public killedGauges;\n\n /// @notice Maps the address of a type >= 2 gauge to a delegate address responsible\n /// for giving rewards to the actual gauge\n mapping(address => address) public delegateGauges;\n\n /// @notice Maps the address of a gauge delegate to whether this delegate supports the `notifyReward` interface\n /// and is therefore built for automation\n mapping(address => bool) public isInterfaceKnown;\n\n /// @notice Address of the ANGLE token given as a reward\n IERC20 public rewardToken;\n\n /// @notice Address of the `GaugeController` contract\n IGaugeController public controller;\n\n /// @notice Address responsible for pulling rewards of type >= 2 gauges and distributing it to the\n /// associated contracts if there is not already an address delegated for this specific contract\n address public delegateGauge;\n\n /// @notice ANGLE current emission rate, it is first defined in the initializer and then updated every week\n uint256 public rate;\n\n /// @notice Timestamp at which the current emission epoch started\n uint256 public startEpochTime;\n\n /// @notice Amount of ANGLE tokens distributed through staking at the start of the epoch\n /// This is an informational variable used to track how much has been distributed through liquidity mining\n uint256 public startEpochSupply;\n\n /// @notice Index of the current emission epoch\n /// Here also, this variable is not useful per se inside the smart contracts of the protocol, it is\n /// just an informational variable\n uint256 public miningEpoch;\n\n /// @notice Whether ANGLE distribution through this contract is on or no\n bool public distributionsOn;\n\n /// @notice Constructor of the contract\n /// @param _rewardToken Address of the ANGLE token\n /// @param _controller Address of the GaugeController\n /// @param _initialRate Initial ANGLE emission rate\n /// @param _startEpochSupply Amount of ANGLE tokens already distributed via liquidity mining\n /// @param governor Governor address of the contract\n /// @param guardian Address of the guardian of this contract\n /// @param _delegateGauge Address that will be used to pull rewards for type 2 gauges\n /// @dev After this contract is created, the correct amount of ANGLE tokens should be transferred to the contract\n /// @dev The `_delegateGauge` can be the zero address\n function initialize(\n address _rewardToken,\n address _controller,\n uint256 _initialRate,\n uint256 _startEpochSupply,\n address governor,\n address guardian,\n address _delegateGauge\n ) external initializer {\n require(\n _controller != address(0) && _rewardToken != address(0) && guardian != address(0) && governor != address(0),\n \"0\"\n );\n rewardToken = IERC20(_rewardToken);\n controller = IGaugeController(_controller);\n startEpochSupply = _startEpochSupply;\n miningEpoch = 0;\n // Some ANGLE tokens should be sent to the contract directly after initialization\n rate = _initialRate;\n delegateGauge = _delegateGauge;\n distributionsOn = false;\n startEpochTime = block.timestamp;\n _setRoleAdmin(GOVERNOR_ROLE, GOVERNOR_ROLE);\n _setRoleAdmin(GUARDIAN_ROLE, GOVERNOR_ROLE);\n _setupRole(GUARDIAN_ROLE, guardian);\n _setupRole(GOVERNOR_ROLE, governor);\n _setupRole(GUARDIAN_ROLE, governor);\n }\n\n /// @custom:oz-upgrades-unsafe-allow constructor\n constructor() initializer {}\n\n // ======================== Internal Functions =================================\n\n /// @notice Internal function to distribute rewards to a gauge\n /// @param gaugeAddr Address of the gauge to distribute rewards to\n /// @return weeksElapsed Weeks elapsed since the last call\n /// @return rewardTally Amount of rewards distributed to the gauge\n /// @dev The reason for having an internal function is that it's called by the `distributeReward` and the\n /// `distributeRewardToMultipleGauges`\n /// @dev Although they would need to be performed all the time this function is called, this function does not\n /// contain checks on whether distribution is on, and on whether rate should be reduced. These are done in each external\n /// function calling this function for gas efficiency\n function _distributeReward(address gaugeAddr) internal returns (uint256 weeksElapsed, uint256 rewardTally) {\n // Checking if the gauge has been added or if it still possible to distribute rewards to this gauge\n int128 gaugeType = IGaugeController(controller).gauge_types(gaugeAddr);\n require(gaugeType >= 0 && !killedGauges[gaugeAddr], \"110\");\n\n // Calculate the elapsed time in weeks.\n uint256 lastTimePaid = lastTimeGaugePaid[gaugeAddr];\n\n // Edge case for first reward for this gauge\n if (lastTimePaid == 0) {\n weeksElapsed = 1;\n if (gaugeType == 0) {\n // We give a full approval for the gauges with type zero which correspond to the staking\n // contracts of the protocol\n rewardToken.safeApprove(gaugeAddr, type(uint256).max);\n }\n } else {\n // Truncation desired\n weeksElapsed = (block.timestamp - lastTimePaid) / WEEK;\n // Return early here for 0 weeks instead of throwing, as it could have bad effects in other contracts\n if (weeksElapsed == 0) {\n return (0, 0);\n }\n }\n rewardTally = 0;\n // We use this variable to keep track of the emission rate across different weeks\n uint256 weeklyRate = rate;\n for (uint256 i = 0; i < weeksElapsed; i++) {\n uint256 relWeightAtWeek;\n if (i == 0) {\n // Mutative, for the current week: makes sure the weight is checkpointed. Also returns the weight.\n relWeightAtWeek = controller.gauge_relative_weight_write(gaugeAddr, block.timestamp);\n } else {\n // View\n relWeightAtWeek = controller.gauge_relative_weight(gaugeAddr, (block.timestamp - WEEK * i));\n }\n rewardTally += (weeklyRate * relWeightAtWeek * WEEK) / BASE;\n\n // To get the rate of the week prior from the current rate we just have to multiply by the weekly division\n // factor\n // There may be some precisions error: inferred previous values of the rate may be different to what we would\n // have had if the rate had been computed correctly in these weeks: we expect from empirical observations\n // this `weeklyRate` to be inferior to what the `rate` would have been\n weeklyRate = (weeklyRate * RATE_REDUCTION_COEFFICIENT) / BASE;\n }\n\n // Update the last time paid, rounded to the closest week\n // in order not to have an ever moving time on when to call this function\n lastTimeGaugePaid[gaugeAddr] = (block.timestamp / WEEK) * WEEK;\n\n // If the `gaugeType >= 2`, this means that the gauge is a gauge on another chain (and corresponds to tokens\n // that need to be bridged) or is associated to an external contract of the Angle Protocol\n if (gaugeType >= 2) {\n // If it is defined, we use the specific delegate attached to the gauge\n address delegate = delegateGauges[gaugeAddr];\n if (delegate == address(0)) {\n // If not, we check if a delegate common to all gauges with type >= 2 can be used\n delegate = delegateGauge;\n }\n if (delegate != address(0)) {\n _sendDelegateRewards(gaugeAddr, delegate, rewardTally);\n } else {\n rewardToken.safeTransfer(gaugeAddr, rewardTally);\n }\n } else if (gaugeType == 1) {\n // This is for the case of Perpetual contracts which need to be able to receive their reward tokens\n rewardToken.safeTransfer(gaugeAddr, rewardTally);\n IStakingRewards(gaugeAddr).notifyRewardAmount(rewardTally);\n } else {\n // Potentially override the gauge address\n address delegate = delegateGauges[gaugeAddr];\n if (delegate != address(0)) {\n _sendDelegateRewards(gaugeAddr, delegate, rewardTally);\n } else {\n ILiquidityGauge(gaugeAddr).deposit_reward_token(address(rewardToken), rewardTally);\n }\n }\n emit RewardDistributed(gaugeAddr, rewardTally);\n }\n\n /// @notice Helper to send `rewardTally` for `gaugeAddr` to the non zero `delegate` address\n function _sendDelegateRewards(\n address gaugeAddr,\n address delegate,\n uint256 rewardTally\n ) internal {\n rewardToken.safeTransfer(delegate, rewardTally);\n // If this delegate supports a specific interface, then rewards sent are notified through this\n // interface\n if (isInterfaceKnown[delegate]) {\n IAngleMiddlemanGauge(delegate).notifyReward(gaugeAddr, rewardTally);\n }\n }\n\n /// @notice Updates mining rate and supply at the start of the epoch\n /// @dev Any modifying mining call must also call this\n /// @dev It is possible that more than one week past between two calls of this function, and for this reason\n /// this function has been slightly modified from Curve implementation by Angle Team\n function _updateMiningParameters() internal {\n // When entering this function, we always have: `(block.timestamp - startEpochTime) / RATE_REDUCTION_TIME >= 1`\n uint256 epochDelta = (block.timestamp - startEpochTime) / RATE_REDUCTION_TIME;\n\n // Storing intermediate values for the rate and for the `startEpochSupply`\n uint256 _rate = rate;\n uint256 _startEpochSupply = startEpochSupply;\n\n startEpochTime += RATE_REDUCTION_TIME * epochDelta;\n miningEpoch += epochDelta;\n\n for (uint256 i = 0; i < epochDelta; i++) {\n // Updating the intermediate values of the `startEpochSupply`\n _startEpochSupply += _rate * RATE_REDUCTION_TIME;\n _rate = (_rate * BASE) / RATE_REDUCTION_COEFFICIENT;\n }\n rate = _rate;\n startEpochSupply = _startEpochSupply;\n emit UpdateMiningParameters(block.timestamp, _rate, _startEpochSupply);\n }\n\n /// @notice Toggles the fact that a gauge delegate can be used for automation or not and therefore supports\n /// the `notifyReward` interface\n /// @param _delegateGauge Address of the gauge to change\n function _toggleInterfaceKnown(address _delegateGauge) internal {\n bool isInterfaceKnownMem = isInterfaceKnown[_delegateGauge];\n isInterfaceKnown[_delegateGauge] = !isInterfaceKnownMem;\n emit InterfaceKnownToggled(_delegateGauge, !isInterfaceKnownMem);\n }\n\n // ================= Permissionless External Functions =========================\n\n /// @notice Distributes rewards to a staking contract (also called gauge)\n /// @param gaugeAddr Address of the gauge to send tokens too\n /// @return weeksElapsed Number of weeks elapsed since the last time rewards were distributed\n /// @return rewardTally Amount of tokens sent to the gauge\n /// @dev Anyone can call this function to distribute rewards to the different staking contracts\n function distributeReward(address gaugeAddr) external nonReentrant returns (uint256, uint256) {\n // Checking if distribution is on\n require(distributionsOn == true, \"109\");\n // Updating rate distribution parameters if need be\n if (block.timestamp >= startEpochTime + RATE_REDUCTION_TIME) {\n _updateMiningParameters();\n }\n return _distributeReward(gaugeAddr);\n }\n\n /// @notice Distributes rewards to multiple staking contracts\n /// @param gauges Addresses of the gauge to send tokens too\n /// @dev Anyone can call this function to distribute rewards to the different staking contracts\n /// @dev Compared with the `distributeReward` function, this function sends rewards to multiple\n /// contracts at the same time\n function distributeRewardToMultipleGauges(address[] memory gauges) external nonReentrant {\n // Checking if distribution is on\n require(distributionsOn == true, \"109\");\n // Updating rate distribution parameters if need be\n if (block.timestamp >= startEpochTime + RATE_REDUCTION_TIME) {\n _updateMiningParameters();\n }\n for (uint256 i = 0; i < gauges.length; i++) {\n _distributeReward(gauges[i]);\n }\n }\n\n /// @notice Updates mining rate and supply at the start of the epoch\n /// @dev Callable by any address, but only once per epoch\n function updateMiningParameters() external {\n require(block.timestamp >= startEpochTime + RATE_REDUCTION_TIME, \"108\");\n _updateMiningParameters();\n }\n\n // ========================= Governor Functions ================================\n\n /// @notice Withdraws ERC20 tokens that could accrue on this contract\n /// @param tokenAddress Address of the ERC20 token to withdraw\n /// @param to Address to transfer to\n /// @param amount Amount to transfer\n /// @dev Added to support recovering LP Rewards and other mistaken tokens\n /// from other systems to be distributed to holders\n /// @dev This function could also be used to recover ANGLE tokens in case the rate got smaller\n function recoverERC20(\n address tokenAddress,\n address to,\n uint256 amount\n ) external onlyRole(GOVERNOR_ROLE) {\n // If the token is the ANGLE token, we need to make sure that governance is not going to withdraw\n // too many tokens and that it'll be able to sustain the weekly distribution forever\n // This check assumes that `distributeReward` has been called for gauges and that there are no gauges\n // which have not received their past week's rewards\n if (tokenAddress == address(rewardToken)) {\n uint256 currentBalance = rewardToken.balanceOf(address(this));\n // The amount distributed till the end is `rate * WEEK / (1 - RATE_REDUCTION_FACTOR)` where\n // `RATE_REDUCTION_FACTOR = BASE / RATE_REDUCTION_COEFFICIENT` which translates to:\n require(\n currentBalance >=\n ((rate * RATE_REDUCTION_COEFFICIENT) * WEEK) / (RATE_REDUCTION_COEFFICIENT - BASE) + amount,\n \"4\"\n );\n }\n IERC20(tokenAddress).safeTransfer(to, amount);\n emit Recovered(tokenAddress, to, amount);\n }\n\n /// @notice Sets a new gauge controller\n /// @param _controller Address of the new gauge controller\n function setGaugeController(address _controller) external onlyRole(GOVERNOR_ROLE) {\n require(_controller != address(0), \"0\");\n controller = IGaugeController(_controller);\n emit GaugeControllerUpdated(_controller);\n }\n\n /// @notice Sets a new delegate gauge for pulling rewards of a type >= 2 gauges or of all type >= 2 gauges\n /// @param gaugeAddr Gauge to change the delegate of\n /// @param _delegateGauge Address of the new gauge delegate related to `gaugeAddr`\n /// @param toggleInterface Whether we should toggle the fact that the `_delegateGauge` is built for automation or not\n /// @dev This function can be used to remove delegating or introduce the pulling of rewards to a given address\n /// @dev If `gaugeAddr` is the zero address, this function updates the delegate gauge common to all gauges with type >= 2\n /// @dev The `toggleInterface` parameter has been added for convenience to save one transaction when adding a gauge delegate\n /// which supports the `notifyReward` interface\n function setDelegateGauge(\n address gaugeAddr,\n address _delegateGauge,\n bool toggleInterface\n ) external onlyRole(GOVERNOR_ROLE) {\n if (gaugeAddr != address(0)) {\n delegateGauges[gaugeAddr] = _delegateGauge;\n } else {\n delegateGauge = _delegateGauge;\n }\n emit DelegateGaugeUpdated(gaugeAddr, _delegateGauge);\n\n if (toggleInterface) {\n _toggleInterfaceKnown(_delegateGauge);\n }\n }\n\n /// @notice Changes the ANGLE emission rate\n /// @param _newRate New ANGLE emission rate\n /// @dev It is important to be super wary when calling this function and to make sure that `distributeReward`\n /// has been called for all gauges in the past weeks. If not, gauges may get an incorrect distribution of ANGLE rewards\n /// for these past weeks based on the new rate and not on the old rate\n /// @dev Governance should thus make sure to call this function rarely and when it does to do it after the weekly `distributeReward`\n /// calls for all existing gauges\n /// @dev As this function assumes that `distributeReward` has been called during the week, it also assumes that the `startEpochSupply`\n /// parameter has been put up to date\n function setRate(uint256 _newRate) external onlyRole(GOVERNOR_ROLE) {\n // Checking if the new rate is compatible with the amount of ANGLE tokens this contract has in balance\n // This check assumes, like this function, that `distributeReward` has correctly been called before\n require(\n rewardToken.balanceOf(address(this)) >=\n ((_newRate * RATE_REDUCTION_COEFFICIENT) * WEEK) / (RATE_REDUCTION_COEFFICIENT - BASE),\n \"4\"\n );\n rate = _newRate;\n emit RateUpdated(_newRate);\n }\n\n /// @notice Toggles the status of a gauge to either killed or unkilled\n /// @param gaugeAddr Gauge to toggle the status of\n /// @dev It is impossible to kill a gauge in the `GaugeController` contract, for this reason killing of gauges\n /// takes place in the `AngleDistributor` contract\n /// @dev This means that people could vote for a gauge in the gauge controller contract but that rewards are not going\n /// to be distributed to it in the end: people would need to remove their weights on the gauge killed to end the diminution\n /// in rewards\n /// @dev In the case of a gauge being killed, this function resets the timestamps at which this gauge has been approved and\n /// disapproves the gauge to spend the token\n /// @dev It should be cautiously called by governance as it could result in less ANGLE overall rewards than initially planned\n /// if people do not remove their voting weights to the killed gauge\n function toggleGauge(address gaugeAddr) external onlyRole(GOVERNOR_ROLE) {\n bool gaugeKilledMem = killedGauges[gaugeAddr];\n if (!gaugeKilledMem) {\n delete lastTimeGaugePaid[gaugeAddr];\n rewardToken.safeApprove(gaugeAddr, 0);\n }\n killedGauges[gaugeAddr] = !gaugeKilledMem;\n emit GaugeToggled(gaugeAddr, !gaugeKilledMem);\n }\n\n // ========================= Guardian Function =================================\n\n /// @notice Halts or activates distribution of rewards\n function toggleDistributions() external onlyRole(GUARDIAN_ROLE) {\n bool distributionsOnMem = distributionsOn;\n distributionsOn = !distributionsOnMem;\n emit DistributionsToggled(!distributionsOnMem);\n }\n\n /// @notice Notifies that the interface of a gauge delegate is known or has changed\n /// @param _delegateGauge Address of the gauge to change\n /// @dev Gauge delegates that are built for automation should be toggled\n function toggleInterfaceKnown(address _delegateGauge) external onlyRole(GUARDIAN_ROLE) {\n _toggleInterfaceKnown(_delegateGauge);\n }\n}\n" + }, + "contracts/mock/AngleDistributorEvents.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.7;\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport \"@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol\";\n\nimport \"../interfaces/CoreModuleInterfaces.sol\";\n\nimport \"../external/AccessControlUpgradeable.sol\";\n\n/// @title AngleDistributorEvents\n/// @author Angle Core Team\n/// @notice All the events used in `AngleDistributor` contract\ncontract AngleDistributorEvents {\n event DelegateGaugeUpdated(address indexed _gaugeAddr, address indexed _delegateGauge);\n event DistributionsToggled(bool _distributionsOn);\n event GaugeControllerUpdated(address indexed _controller);\n event GaugeToggled(address indexed gaugeAddr, bool newStatus);\n event InterfaceKnownToggled(address indexed _delegateGauge, bool _isInterfaceKnown);\n event RateUpdated(uint256 _newRate);\n event Recovered(address indexed tokenAddress, address indexed to, uint256 amount);\n event RewardDistributed(address indexed gaugeAddr, uint256 rewardTally);\n event UpdateMiningParameters(uint256 time, uint256 rate, uint256 supply);\n}\n" + }, + "contracts/mock/MockCoreBorrow.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\ncontract MockCoreBorrow {\n mapping(address => bool) public governors;\n mapping(address => bool) public guardians;\n\n function isGovernor(address admin) external view returns (bool) {\n return governors[admin];\n }\n\n function isGovernorOrGuardian(address admin) external view returns (bool) {\n return governors[admin] || guardians[admin];\n }\n\n function toggleGovernor(address admin) external {\n governors[admin] = !governors[admin];\n }\n\n function toggleGuardian(address admin) external {\n guardians[admin] = !guardians[admin];\n }\n}\n" + }, + "contracts/mock/MockMerklGaugeMiddleman.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"../middleman/MerklGaugeMiddleman.sol\";\n\ncontract MockMerklGaugeMiddleman is MerklGaugeMiddleman {\n address public angleDistributorAddress;\n IERC20 public angleAddress;\n DistributionCreator public manager;\n\n constructor(ICore _coreBorrow) MerklGaugeMiddleman(_coreBorrow) {}\n\n function angle() public view override returns (IERC20) {\n return angleAddress;\n }\n\n function merklDistributionCreator() public view override returns (DistributionCreator) {\n return manager;\n }\n\n function setAddresses(\n address _angleDistributorAddress,\n IERC20 _angleAddress,\n DistributionCreator _manager\n ) external {\n angleDistributorAddress = _angleDistributorAddress;\n angleAddress = _angleAddress;\n manager = _manager;\n }\n}\n" + }, + "contracts/mock/MockPool.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.7;\n\ncontract MockPool {\n address public token0;\n address public token1;\n uint32 public constant EPOCH_DURATION = 3600;\n\n function setToken(address token, uint256 who) external {\n if (who == 0) token0 = token;\n else token1 = token;\n }\n}\n" + }, + "contracts/mock/MockToken.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.7;\n\nimport \"@openzeppelin/contracts/token/ERC20/ERC20.sol\";\n\ncontract MockToken is ERC20 {\n event Minting(address indexed _to, address indexed _minter, uint256 _amount);\n\n event Burning(address indexed _from, address indexed _burner, uint256 _amount);\n\n uint8 internal _decimal;\n mapping(address => bool) public minters;\n address public treasury;\n\n constructor(\n string memory name_,\n string memory symbol_,\n uint8 decimal_\n ) ERC20(name_, symbol_) {\n _decimal = decimal_;\n }\n\n function decimals() public view override returns (uint8) {\n return _decimal;\n }\n\n function mint(address account, uint256 amount) external {\n _mint(account, amount);\n emit Minting(account, msg.sender, amount);\n }\n\n function burn(address account, uint256 amount) public {\n _burn(account, amount);\n emit Burning(account, msg.sender, amount);\n }\n\n function setAllowance(address from, address to) public {\n _approve(from, to, type(uint256).max);\n }\n\n function burnSelf(uint256 amount, address account) public {\n _burn(account, amount);\n emit Burning(account, msg.sender, amount);\n }\n\n function addMinter(address minter) public {\n minters[minter] = true;\n }\n\n function removeMinter(address minter) public {\n minters[minter] = false;\n }\n\n function setTreasury(address _treasury) public {\n treasury = _treasury;\n }\n}\n" + }, + "contracts/mock/MockTokenPermit.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.7;\n\nimport \"@openzeppelin/contracts/token/ERC20/extensions/draft-ERC20Permit.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\n\ncontract MockTokenPermit is ERC20Permit {\n using SafeERC20 for IERC20;\n event Minting(address indexed _to, address indexed _minter, uint256 _amount);\n\n event Burning(address indexed _from, address indexed _burner, uint256 _amount);\n\n uint8 internal _decimal;\n mapping(address => bool) public minters;\n address public treasury;\n uint256 public fees;\n\n bool public reverts;\n\n constructor(\n string memory name_,\n string memory symbol_,\n uint8 decimal_\n ) ERC20Permit(name_) ERC20(name_, symbol_) {\n _decimal = decimal_;\n }\n\n function decimals() public view override returns (uint8) {\n return _decimal;\n }\n\n function mint(address account, uint256 amount) external {\n _mint(account, amount);\n emit Minting(account, msg.sender, amount);\n }\n\n function burn(address account, uint256 amount) public {\n _burn(account, amount);\n emit Burning(account, msg.sender, amount);\n }\n\n function setAllowance(address from, address to) public {\n _approve(from, to, type(uint256).max);\n }\n\n function burnSelf(uint256 amount, address account) public {\n _burn(account, amount);\n emit Burning(account, msg.sender, amount);\n }\n\n function addMinter(address minter) public {\n minters[minter] = true;\n }\n\n function removeMinter(address minter) public {\n minters[minter] = false;\n }\n\n function setTreasury(address _treasury) public {\n treasury = _treasury;\n }\n\n function setFees(uint256 _fees) public {\n fees = _fees;\n }\n\n function recoverERC20(\n IERC20 token,\n address to,\n uint256 amount\n ) external {\n token.safeTransfer(to, amount);\n }\n\n function swapIn(\n address bridgeToken,\n uint256 amount,\n address to\n ) external returns (uint256) {\n require(!reverts);\n\n IERC20(bridgeToken).safeTransferFrom(msg.sender, address(this), amount);\n uint256 canonicalOut = amount;\n canonicalOut -= (canonicalOut * fees) / 10**9;\n _mint(to, canonicalOut);\n return canonicalOut;\n }\n\n function swapOut(\n address bridgeToken,\n uint256 amount,\n address to\n ) external returns (uint256) {\n require(!reverts);\n _burn(msg.sender, amount);\n uint256 bridgeOut = amount;\n bridgeOut -= (bridgeOut * fees) / 10**9;\n IERC20(bridgeToken).safeTransfer(to, bridgeOut);\n return bridgeOut;\n }\n}\n" + }, + "contracts/mock/MockTreasury.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\ncontract MockTreasury {\n address public stablecoin;\n address public governor;\n address public guardian;\n address public vaultManager1;\n address public vaultManager2;\n address public flashLoanModule;\n\n constructor(\n address _stablecoin,\n address _governor,\n address _guardian,\n address _vaultManager1,\n address _vaultManager2,\n address _flashLoanModule\n ) {\n stablecoin = _stablecoin;\n governor = _governor;\n guardian = _guardian;\n vaultManager1 = _vaultManager1;\n vaultManager2 = _vaultManager2;\n flashLoanModule = _flashLoanModule;\n }\n\n function isGovernor(address admin) external view returns (bool) {\n return (admin == governor);\n }\n\n function isGovernorOrGuardian(address admin) external view returns (bool) {\n return (admin == governor || admin == guardian);\n }\n}\n" + }, + "contracts/mock/MockUniswapV3Pool.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.7;\n\ncontract MockUniswapV3Pool {\n address public token0;\n address public token1;\n uint32 public constant EPOCH_DURATION = 3600;\n uint256 public fee;\n\n function setToken(address token, uint256 who) external {\n if (who == 0) token0 = token;\n else token1 = token;\n }\n\n function round(uint256 amount) external pure returns (uint256) {\n return (amount / EPOCH_DURATION) * EPOCH_DURATION;\n }\n}\n" + }, + "contracts/struct/DistributionParameters.sol": { + "content": "// SPDX-License-Identifier: BUSL-1.1\n\npragma solidity ^0.8.17;\n\nstruct DistributionParameters {\n // ID of the reward (populated once created)\n bytes32 rewardId;\n // Address of the UniswapV3 pool that needs to be incentivized\n address uniV3Pool;\n // Address of the reward token for the incentives\n address rewardToken;\n // Amount of `rewardToken` to distribute across all the epochs\n // Amount distributed per epoch is `amount/numEpoch`\n uint256 amount;\n // List of all position wrappers to consider or not for this contract. Some wrappers like Gamma or Arrakis\n // are automatically detected and so there is no need to specify them here. Check out the docs to find out\n // which need to be specified and which are not automatically detected.\n address[] positionWrappers;\n // Type (Arrakis, Gamma, Blacklist, ...) encoded as a `uint32` for each wrapper in the list above. Mapping between\n // wrapper types and their corresponding `uint32` value can be found in Angle Docs\n uint32[] wrapperTypes;\n // In the incentivization formula, how much of the fees should go to holders of token0\n // in base 10**4\n uint32 propToken0;\n // Proportion for holding token1 (in base 10**4)\n uint32 propToken1;\n // Proportion for providing a useful liquidity (in base 10**4) that generates fees\n uint32 propFees;\n // Timestamp at which the incentivization should start\n uint32 epochStart;\n // Amount of epochs for which incentivization should last\n uint32 numEpoch;\n // Whether out of range liquidity should still be incentivized or not\n // This should be equal to 1 if out of range liquidity should still be incentivized\n // and 0 otherwise\n uint32 isOutOfRangeIncentivized;\n // How much more addresses with a maximum boost can get with respect to addresses\n // which do not have a boost (in base 4). In the case of Curve where addresses get 2.5x more\n // this would be 25000\n uint32 boostedReward;\n // Address of the token which dictates who gets boosted rewards or not. This is optional\n // and if the zero address is given no boost will be taken into account\n address boostingAddress;\n // Additional data passed when distributing rewards. This parameter may be used in case\n // the reward distribution script needs to look into other parameters beyond the ones above.\n bytes additionalData;\n}\n" + }, + "contracts/struct/ExtensiveDistributionParameters.sol": { + "content": "// SPDX-License-Identifier: BUSL-1.1\n\npragma solidity ^0.8.17;\n\nimport \"./DistributionParameters.sol\";\n\nstruct UniswapTokenData {\n address add;\n uint8 decimals;\n string symbol;\n uint256 poolBalance;\n}\n\nstruct ExtensiveDistributionParameters {\n DistributionParameters base;\n // Uniswap pool data\n uint24 poolFee;\n UniswapTokenData token0;\n UniswapTokenData token1;\n // rewardToken data\n string rewardTokenSymbol;\n uint8 rewardTokenDecimals;\n}\n" + }, + "contracts/struct/RewardTokenAmounts.sol": { + "content": "// SPDX-License-Identifier: BUSL-1.1\n\npragma solidity ^0.8.17;\n\nstruct RewardTokenAmounts {\n address token;\n uint256 minimumAmountPerEpoch;\n}\n" + }, + "contracts/utils/Errors.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nerror InvalidDispute();\nerror InvalidLengths();\nerror InvalidParam();\nerror InvalidParams();\nerror InvalidProof();\nerror InvalidUninitializedRoot();\nerror InvalidReward();\nerror InvalidSignature();\nerror NoDispute();\nerror NotGovernor();\nerror NotGovernorOrGuardian();\nerror NotSigned();\nerror NotTrusted();\nerror NotWhitelisted();\nerror UnresolvedDispute();\nerror ZeroAddress();\n" + }, + "contracts/utils/UUPSHelper.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\n/*\n * █ \n ***** ▓▓▓ \n * ▓▓▓▓▓▓▓ \n * ///. ▓▓▓▓▓▓▓▓▓▓▓▓▓ \n ***** //////// ▓▓▓▓▓▓▓ \n * ///////////// ▓▓▓ \n ▓▓ ////////////////// █ ▓▓ \n ▓▓ ▓▓ /////////////////////// ▓▓ ▓▓ \n ▓▓ ▓▓ //////////////////////////// ▓▓ ▓▓ \n ▓▓ ▓▓ /////////▓▓▓///////▓▓▓///////// ▓▓ ▓▓ \n ▓▓ ,////////////////////////////////////// ▓▓ ▓▓ \n ▓▓ ////////////////////////////////////////// ▓▓ \n ▓▓ //////////////////////▓▓▓▓///////////////////// \n ,//////////////////////////////////////////////////// \n .////////////////////////////////////////////////////////// \n .//////////////////////////██.,//////////////////////////█ \n .//////////////////////████..,./////////////////////██ \n ...////////////////███████.....,.////////////////███ \n ,.,////////////████████ ........,///////////████ \n .,.,//////█████████ ,.......///////████ \n ,..//████████ ........./████ \n ..,██████ .....,███ \n .██ ,.,█ \n \n \n \n ▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓ ▓▓▓▓▓▓▓▓▓▓ \n ▓▓▓▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓ ▓▓ ▓▓▓▓ \n ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓ ▓▓▓▓▓ \n ▓▓▓ ▓▓ ▓▓▓ ▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ \n*/\n\npragma solidity ^0.8.17;\n\nimport \"@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol\";\n\nimport \"../interfaces/ICore.sol\";\nimport \"../utils/Errors.sol\";\n\n/// @title UUPSHelper\n/// @notice Helper contract for UUPSUpgradeable contracts where the upgradeability is controlled by a specific address\n/// @author Angle Labs., Inc\n/// @dev The 0 address check in the modifier allows the use of these modifiers during initialization\nabstract contract UUPSHelper is UUPSUpgradeable {\n modifier onlyGuardianUpgrader(ICore _core) {\n if (address(_core) != address(0) && !_core.isGovernorOrGuardian(msg.sender)) revert NotGovernorOrGuardian();\n _;\n }\n\n modifier onlyGovernorUpgrader(ICore _core) {\n if (address(_core) != address(0) && !_core.isGovernor(msg.sender)) revert NotGovernor();\n _;\n }\n\n constructor() initializer {}\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 100000 + }, + "viaIR": false, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + } + } +} \ No newline at end of file diff --git a/deployments/thundercore/.chainId b/deployments/thundercore/.chainId new file mode 100644 index 0000000..615088b --- /dev/null +++ b/deployments/thundercore/.chainId @@ -0,0 +1 @@ +108 \ No newline at end of file diff --git a/deployments/thundercore/DistributionCreator.json b/deployments/thundercore/DistributionCreator.json new file mode 100644 index 0000000..eac48e8 --- /dev/null +++ b/deployments/thundercore/DistributionCreator.json @@ -0,0 +1,132 @@ +{ + "address": "0x8BB4C975Ff3c250e0ceEA271728547f3802B36Fd", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_logic", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "stateMutability": "payable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "previousAdmin", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "AdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "beacon", + "type": "address" + } + ], + "name": "BeaconUpgraded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "stateMutability": "payable", + "type": "receive" + } + ], + "transactionHash": "0x1de85bf94534d6eb4fad5d2206b79184761a1bb7b7dc11c2e7751fb62e5c893b", + "receipt": { + "to": null, + "from": "0x9f76a95AA7535bb0893cf88A146396e00ed21A12", + "contractAddress": "0x8BB4C975Ff3c250e0ceEA271728547f3802B36Fd", + "transactionIndex": 0, + "gasUsed": "306987", + "logsBloom": "0x00000000000000000000000000000000400000001000000000000000000000000000000002001000000000000000000000000200000000800000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x4942b26a201dd05ee6ed0ddd496ed23ef11379bb204c0d935a1ac02f07d8f0dc", + "transactionHash": "0x1de85bf94534d6eb4fad5d2206b79184761a1bb7b7dc11c2e7751fb62e5c893b", + "logs": [ + { + "transactionIndex": 0, + "blockNumber": 147784016, + "transactionHash": "0x1de85bf94534d6eb4fad5d2206b79184761a1bb7b7dc11c2e7751fb62e5c893b", + "address": "0x8BB4C975Ff3c250e0ceEA271728547f3802B36Fd", + "topics": [ + "0xbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b", + "0x0000000000000000000000007db28175b63f154587bbb1cae62d39ea80a23383" + ], + "data": "0x", + "logIndex": 0, + "blockHash": "0x4942b26a201dd05ee6ed0ddd496ed23ef11379bb204c0d935a1ac02f07d8f0dc" + } + ], + "blockNumber": 147784016, + "cumulativeGasUsed": "306987", + "status": 1, + "byzantium": true + }, + "args": [ + "0x7Db28175B63f154587BbB1Cae62D39Ea80A23383", + "0x" + ], + "numDeployments": 1, + "solcInputHash": "e77f17fbb4334e4df730b35bdfde2517", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_logic\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"previousAdmin\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"AdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"beacon\",\"type\":\"address\"}],\"name\":\"BeaconUpgraded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"implementation\",\"type\":\"address\"}],\"name\":\"Upgraded\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"details\":\"This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an implementation address that can be changed. This address is stored in storage in the location specified by https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the implementation behind the proxy.\",\"kind\":\"dev\",\"methods\":{\"constructor\":{\"details\":\"Initializes the upgradeable proxy with an initial implementation specified by `_logic`. If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded function call, and allows initializing the storage of the proxy like a Solidity constructor.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol\":\"ERC1967Proxy\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":100000},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/interfaces/draft-IERC1822.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\\n * proxy whose upgrades are fully controlled by the current implementation.\\n */\\ninterface IERC1822Proxiable {\\n /**\\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\\n * address.\\n *\\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\\n * function revert if invoked through a proxy.\\n */\\n function proxiableUUID() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0x1d4afe6cb24200cc4545eed814ecf5847277dfe5d613a1707aad5fceecebcfff\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/ERC1967/ERC1967Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../Proxy.sol\\\";\\nimport \\\"./ERC1967Upgrade.sol\\\";\\n\\n/**\\n * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an\\n * implementation address that can be changed. This address is stored in storage in the location specified by\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the\\n * implementation behind the proxy.\\n */\\ncontract ERC1967Proxy is Proxy, ERC1967Upgrade {\\n /**\\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.\\n *\\n * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded\\n * function call, and allows initializing the storage of the proxy like a Solidity constructor.\\n */\\n constructor(address _logic, bytes memory _data) payable {\\n _upgradeToAndCall(_logic, _data, false);\\n }\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _implementation() internal view virtual override returns (address impl) {\\n return ERC1967Upgrade._getImplementation();\\n }\\n}\\n\",\"keccak256\":\"0xa2b22da3032e50b55f95ec1d13336102d675f341167aa76db571ef7f8bb7975d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/ERC1967/ERC1967Upgrade.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (proxy/ERC1967/ERC1967Upgrade.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../beacon/IBeacon.sol\\\";\\nimport \\\"../../interfaces/draft-IERC1822.sol\\\";\\nimport \\\"../../utils/Address.sol\\\";\\nimport \\\"../../utils/StorageSlot.sol\\\";\\n\\n/**\\n * @dev This abstract contract provides getters and event emitting update functions for\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\\n *\\n * _Available since v4.1._\\n *\\n * @custom:oz-upgrades-unsafe-allow delegatecall\\n */\\nabstract contract ERC1967Upgrade {\\n // This is the keccak-256 hash of \\\"eip1967.proxy.rollback\\\" subtracted by 1\\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\\n\\n /**\\n * @dev Storage slot with the address of the current implementation.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n /**\\n * @dev Emitted when the implementation is upgraded.\\n */\\n event Upgraded(address indexed implementation);\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _getImplementation() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 implementation slot.\\n */\\n function _setImplementation(address newImplementation) private {\\n require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n }\\n\\n /**\\n * @dev Perform implementation upgrade\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeTo(address newImplementation) internal {\\n _setImplementation(newImplementation);\\n emit Upgraded(newImplementation);\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCall(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _upgradeTo(newImplementation);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(newImplementation, data);\\n }\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCallUUPS(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n // Upgrades from old implementations will perform a rollback test. This test requires the new\\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\\n // this special case will break upgrade paths from old UUPS implementation to new ones.\\n if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) {\\n _setImplementation(newImplementation);\\n } else {\\n try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {\\n require(slot == _IMPLEMENTATION_SLOT, \\\"ERC1967Upgrade: unsupported proxiableUUID\\\");\\n } catch {\\n revert(\\\"ERC1967Upgrade: new implementation is not UUPS\\\");\\n }\\n _upgradeToAndCall(newImplementation, data, forceCall);\\n }\\n }\\n\\n /**\\n * @dev Storage slot with the admin of the contract.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.admin\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n /**\\n * @dev Emitted when the admin account has changed.\\n */\\n event AdminChanged(address previousAdmin, address newAdmin);\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _getAdmin() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 admin slot.\\n */\\n function _setAdmin(address newAdmin) private {\\n require(newAdmin != address(0), \\\"ERC1967: new admin is the zero address\\\");\\n StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n */\\n function _changeAdmin(address newAdmin) internal {\\n emit AdminChanged(_getAdmin(), newAdmin);\\n _setAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\\n */\\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\\n\\n /**\\n * @dev Emitted when the beacon is upgraded.\\n */\\n event BeaconUpgraded(address indexed beacon);\\n\\n /**\\n * @dev Returns the current beacon.\\n */\\n function _getBeacon() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_BEACON_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new beacon in the EIP1967 beacon slot.\\n */\\n function _setBeacon(address newBeacon) private {\\n require(Address.isContract(newBeacon), \\\"ERC1967: new beacon is not a contract\\\");\\n require(\\n Address.isContract(IBeacon(newBeacon).implementation()),\\n \\\"ERC1967: beacon implementation is not a contract\\\"\\n );\\n StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon;\\n }\\n\\n /**\\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\\n *\\n * Emits a {BeaconUpgraded} event.\\n */\\n function _upgradeBeaconToAndCall(\\n address newBeacon,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _setBeacon(newBeacon);\\n emit BeaconUpgraded(newBeacon);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xabf3f59bc0e5423eae45e459dbe92e7052c6983628d39008590edc852a62f94a\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (proxy/Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\\n * be specified by overriding the virtual {_implementation} function.\\n *\\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\\n * different contract through the {_delegate} function.\\n *\\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\\n */\\nabstract contract Proxy {\\n /**\\n * @dev Delegates the current call to `implementation`.\\n *\\n * This function does not return to its internal call site, it will return directly to the external caller.\\n */\\n function _delegate(address implementation) internal virtual {\\n assembly {\\n // Copy msg.data. We take full control of memory in this inline assembly\\n // block because it will not return to Solidity code. We overwrite the\\n // Solidity scratch pad at memory position 0.\\n calldatacopy(0, 0, calldatasize())\\n\\n // Call the implementation.\\n // out and outsize are 0 because we don't know the size yet.\\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\\n\\n // Copy the returned data.\\n returndatacopy(0, 0, returndatasize())\\n\\n switch result\\n // delegatecall returns 0 on error.\\n case 0 {\\n revert(0, returndatasize())\\n }\\n default {\\n return(0, returndatasize())\\n }\\n }\\n }\\n\\n /**\\n * @dev This is a virtual function that should be overridden so it returns the address to which the fallback function\\n * and {_fallback} should delegate.\\n */\\n function _implementation() internal view virtual returns (address);\\n\\n /**\\n * @dev Delegates the current call to the address returned by `_implementation()`.\\n *\\n * This function does not return to its internal call site, it will return directly to the external caller.\\n */\\n function _fallback() internal virtual {\\n _beforeFallback();\\n _delegate(_implementation());\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\\n * function in the contract matches the call data.\\n */\\n fallback() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data\\n * is empty.\\n */\\n receive() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`\\n * call, or as part of the Solidity `fallback` or `receive` functions.\\n *\\n * If overridden should call `super._beforeFallback()`.\\n */\\n function _beforeFallback() internal virtual {}\\n}\\n\",\"keccak256\":\"0xc130fe33f1b2132158531a87734153293f6d07bc263ff4ac90e85da9c82c0e27\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/beacon/IBeacon.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\\n */\\ninterface IBeacon {\\n /**\\n * @dev Must return an address that can be used as a delegate call target.\\n *\\n * {BeaconProxy} will check that this address is a contract.\\n */\\n function implementation() external view returns (address);\\n}\\n\",\"keccak256\":\"0xd50a3421ac379ccb1be435fa646d66a65c986b4924f0849839f08692f39dde61\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\n *\\n * _Available since v4.8._\\n */\\n function verifyCallResultFromTarget(\\n address target,\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n if (success) {\\n if (returndata.length == 0) {\\n // only check isContract if the call was successful and the return data is empty\\n // otherwise we already know that it was a contract\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n }\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason or using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xf96f969e24029d43d0df89e59d365f277021dac62b48e1c1e3ebe0acdd7f1ca1\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/StorageSlot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/StorageSlot.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for reading and writing primitive types to specific storage slots.\\n *\\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\\n * This library helps with reading and writing to such slots without the need for inline assembly.\\n *\\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\\n *\\n * Example usage to set ERC1967 implementation slot:\\n * ```\\n * contract ERC1967 {\\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n *\\n * function _getImplementation() internal view returns (address) {\\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n * }\\n *\\n * function _setImplementation(address newImplementation) internal {\\n * require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n * }\\n * }\\n * ```\\n *\\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\\n */\\nlibrary StorageSlot {\\n struct AddressSlot {\\n address value;\\n }\\n\\n struct BooleanSlot {\\n bool value;\\n }\\n\\n struct Bytes32Slot {\\n bytes32 value;\\n }\\n\\n struct Uint256Slot {\\n uint256 value;\\n }\\n\\n /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\\n */\\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\\n */\\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\\n */\\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd5c50c54bf02740ebd122ff06832546cb5fa84486d52695a9ccfd11666e0c81d\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x60806040526040516107ad3803806107ad83398101604081905261002291610319565b61002e82826000610035565b5050610436565b61003e8361006b565b60008251118061004b5750805b156100665761006483836100ab60201b6100291760201c565b505b505050565b610074816100d7565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b60606100d08383604051806060016040528060278152602001610786602791396101a9565b9392505050565b6100ea8161022260201b6100551760201c565b6101515760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b60648201526084015b60405180910390fd5b806101887f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc60001b61023160201b6100711760201c565b80546001600160a01b0319166001600160a01b039290921691909117905550565b6060600080856001600160a01b0316856040516101c691906103e7565b600060405180830381855af49150503d8060008114610201576040519150601f19603f3d011682016040523d82523d6000602084013e610206565b606091505b50909250905061021886838387610234565b9695505050505050565b6001600160a01b03163b151590565b90565b606083156102a357825160000361029c576001600160a01b0385163b61029c5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610148565b50816102ad565b6102ad83836102b5565b949350505050565b8151156102c55781518083602001fd5b8060405162461bcd60e51b81526004016101489190610403565b634e487b7160e01b600052604160045260246000fd5b60005b838110156103105781810151838201526020016102f8565b50506000910152565b6000806040838503121561032c57600080fd5b82516001600160a01b038116811461034357600080fd5b60208401519092506001600160401b038082111561036057600080fd5b818501915085601f83011261037457600080fd5b815181811115610386576103866102df565b604051601f8201601f19908116603f011681019083821181831017156103ae576103ae6102df565b816040528281528860208487010111156103c757600080fd5b6103d88360208301602088016102f5565b80955050505050509250929050565b600082516103f98184602087016102f5565b9190910192915050565b60208152600082518060208401526104228160408501602087016102f5565b601f01601f19169190910160400192915050565b610341806104456000396000f3fe60806040523661001357610011610017565b005b6100115b610027610022610074565b6100b9565b565b606061004e83836040518060600160405280602781526020016102e5602791396100dd565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b90565b60006100b47f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5473ffffffffffffffffffffffffffffffffffffffff1690565b905090565b3660008037600080366000845af43d6000803e8080156100d8573d6000f35b3d6000fd5b60606000808573ffffffffffffffffffffffffffffffffffffffff16856040516101079190610277565b600060405180830381855af49150503d8060008114610142576040519150601f19603f3d011682016040523d82523d6000602084013e610147565b606091505b509150915061015886838387610162565b9695505050505050565b606083156101fd5782516000036101f65773ffffffffffffffffffffffffffffffffffffffff85163b6101f6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064015b60405180910390fd5b5081610207565b610207838361020f565b949350505050565b81511561021f5781518083602001fd5b806040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016101ed9190610293565b60005b8381101561026e578181015183820152602001610256565b50506000910152565b60008251610289818460208701610253565b9190910192915050565b60208152600082518060208401526102b2816040850160208701610253565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a26469706673582212208d6f628b23c1e021c9b2ae38fc6a126b22b03b9629f5dfe1de8fc7f044229aec64736f6c63430008110033416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564", + "deployedBytecode": "0x60806040523661001357610011610017565b005b6100115b610027610022610074565b6100b9565b565b606061004e83836040518060600160405280602781526020016102e5602791396100dd565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b90565b60006100b47f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5473ffffffffffffffffffffffffffffffffffffffff1690565b905090565b3660008037600080366000845af43d6000803e8080156100d8573d6000f35b3d6000fd5b60606000808573ffffffffffffffffffffffffffffffffffffffff16856040516101079190610277565b600060405180830381855af49150503d8060008114610142576040519150601f19603f3d011682016040523d82523d6000602084013e610147565b606091505b509150915061015886838387610162565b9695505050505050565b606083156101fd5782516000036101f65773ffffffffffffffffffffffffffffffffffffffff85163b6101f6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064015b60405180910390fd5b5081610207565b610207838361020f565b949350505050565b81511561021f5781518083602001fd5b806040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016101ed9190610293565b60005b8381101561026e578181015183820152602001610256565b50506000910152565b60008251610289818460208701610253565b9190910192915050565b60208152600082518060208401526102b2816040850160208701610253565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a26469706673582212208d6f628b23c1e021c9b2ae38fc6a126b22b03b9629f5dfe1de8fc7f044229aec64736f6c63430008110033", + "devdoc": { + "details": "This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an implementation address that can be changed. This address is stored in storage in the location specified by https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the implementation behind the proxy.", + "kind": "dev", + "methods": { + "constructor": { + "details": "Initializes the upgradeable proxy with an initial implementation specified by `_logic`. If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded function call, and allows initializing the storage of the proxy like a Solidity constructor." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/deployments/thundercore/DistributionCreator_Implementation_7.json b/deployments/thundercore/DistributionCreator_Implementation_7.json new file mode 100644 index 0000000..05dca9c --- /dev/null +++ b/deployments/thundercore/DistributionCreator_Implementation_7.json @@ -0,0 +1,4743 @@ +{ + "address": "0x7Db28175B63f154587BbB1Cae62D39Ea80A23383", + "abi": [ + { + "inputs": [], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "InvalidLengths", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidParam", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidReward", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidSignature", + "type": "error" + }, + { + "inputs": [], + "name": "NotGovernorOrGuardian", + "type": "error" + }, + { + "inputs": [], + "name": "NotSigned", + "type": "error" + }, + { + "inputs": [], + "name": "ZeroAddress", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "previousAdmin", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "AdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "beacon", + "type": "address" + } + ], + "name": "BeaconUpgraded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "_distributor", + "type": "address" + } + ], + "name": "DistributorUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "userFeeRebate", + "type": "uint256" + } + ], + "name": "FeeRebateUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "_feeRecipient", + "type": "address" + } + ], + "name": "FeeRecipientUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "_fees", + "type": "uint256" + } + ], + "name": "FeesSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "bytes32", + "name": "_messageHash", + "type": "bytes32" + } + ], + "name": "MessageUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "components": [ + { + "internalType": "bytes32", + "name": "rewardId", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "uniV3Pool", + "type": "address" + }, + { + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address[]", + "name": "positionWrappers", + "type": "address[]" + }, + { + "internalType": "uint32[]", + "name": "wrapperTypes", + "type": "uint32[]" + }, + { + "internalType": "uint32", + "name": "propToken0", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propToken1", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propFees", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "epochStart", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "numEpoch", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "isOutOfRangeIncentivized", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "boostedReward", + "type": "uint32" + }, + { + "internalType": "address", + "name": "boostingAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "additionalData", + "type": "bytes" + } + ], + "indexed": false, + "internalType": "struct DistributionParameters", + "name": "distribution", + "type": "tuple" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "NewDistribution", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "RewardTokenMinimumAmountUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "toggleStatus", + "type": "uint256" + } + ], + "name": "TokenWhitelistToggled", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "bytes32", + "name": "messageHash", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + } + ], + "name": "UserSigned", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "toggleStatus", + "type": "uint256" + } + ], + "name": "UserSigningWhitelistToggled", + "type": "event" + }, + { + "inputs": [], + "name": "BASE_9", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "EPOCH_DURATION", + "outputs": [ + { + "internalType": "uint32", + "name": "", + "type": "uint32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "core", + "outputs": [ + { + "internalType": "contract ICore", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "bytes32", + "name": "rewardId", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "uniV3Pool", + "type": "address" + }, + { + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address[]", + "name": "positionWrappers", + "type": "address[]" + }, + { + "internalType": "uint32[]", + "name": "wrapperTypes", + "type": "uint32[]" + }, + { + "internalType": "uint32", + "name": "propToken0", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propToken1", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propFees", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "epochStart", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "numEpoch", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "isOutOfRangeIncentivized", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "boostedReward", + "type": "uint32" + }, + { + "internalType": "address", + "name": "boostingAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "additionalData", + "type": "bytes" + } + ], + "internalType": "struct DistributionParameters", + "name": "distribution", + "type": "tuple" + } + ], + "name": "createDistribution", + "outputs": [ + { + "internalType": "uint256", + "name": "distributionAmount", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "bytes32", + "name": "rewardId", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "uniV3Pool", + "type": "address" + }, + { + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address[]", + "name": "positionWrappers", + "type": "address[]" + }, + { + "internalType": "uint32[]", + "name": "wrapperTypes", + "type": "uint32[]" + }, + { + "internalType": "uint32", + "name": "propToken0", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propToken1", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propFees", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "epochStart", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "numEpoch", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "isOutOfRangeIncentivized", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "boostedReward", + "type": "uint32" + }, + { + "internalType": "address", + "name": "boostingAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "additionalData", + "type": "bytes" + } + ], + "internalType": "struct DistributionParameters[]", + "name": "distributions", + "type": "tuple[]" + } + ], + "name": "createDistributions", + "outputs": [ + { + "internalType": "uint256[]", + "name": "", + "type": "uint256[]" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "distributionList", + "outputs": [ + { + "internalType": "bytes32", + "name": "rewardId", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "uniV3Pool", + "type": "address" + }, + { + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "uint32", + "name": "propToken0", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propToken1", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propFees", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "epochStart", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "numEpoch", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "isOutOfRangeIncentivized", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "boostedReward", + "type": "uint32" + }, + { + "internalType": "address", + "name": "boostingAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "additionalData", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "distributor", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "feeRebate", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "feeRecipient", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "fees", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getActiveDistributions", + "outputs": [ + { + "components": [ + { + "components": [ + { + "internalType": "bytes32", + "name": "rewardId", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "uniV3Pool", + "type": "address" + }, + { + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address[]", + "name": "positionWrappers", + "type": "address[]" + }, + { + "internalType": "uint32[]", + "name": "wrapperTypes", + "type": "uint32[]" + }, + { + "internalType": "uint32", + "name": "propToken0", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propToken1", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propFees", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "epochStart", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "numEpoch", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "isOutOfRangeIncentivized", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "boostedReward", + "type": "uint32" + }, + { + "internalType": "address", + "name": "boostingAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "additionalData", + "type": "bytes" + } + ], + "internalType": "struct DistributionParameters", + "name": "base", + "type": "tuple" + }, + { + "internalType": "uint24", + "name": "poolFee", + "type": "uint24" + }, + { + "components": [ + { + "internalType": "address", + "name": "add", + "type": "address" + }, + { + "internalType": "uint8", + "name": "decimals", + "type": "uint8" + }, + { + "internalType": "string", + "name": "symbol", + "type": "string" + }, + { + "internalType": "uint256", + "name": "poolBalance", + "type": "uint256" + } + ], + "internalType": "struct UniswapTokenData", + "name": "token0", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "address", + "name": "add", + "type": "address" + }, + { + "internalType": "uint8", + "name": "decimals", + "type": "uint8" + }, + { + "internalType": "string", + "name": "symbol", + "type": "string" + }, + { + "internalType": "uint256", + "name": "poolBalance", + "type": "uint256" + } + ], + "internalType": "struct UniswapTokenData", + "name": "token1", + "type": "tuple" + }, + { + "internalType": "string", + "name": "rewardTokenSymbol", + "type": "string" + }, + { + "internalType": "uint8", + "name": "rewardTokenDecimals", + "type": "uint8" + } + ], + "internalType": "struct ExtensiveDistributionParameters[]", + "name": "searchDistributions", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint32", + "name": "skip", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "first", + "type": "uint32" + } + ], + "name": "getActiveDistributions", + "outputs": [ + { + "components": [ + { + "components": [ + { + "internalType": "bytes32", + "name": "rewardId", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "uniV3Pool", + "type": "address" + }, + { + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address[]", + "name": "positionWrappers", + "type": "address[]" + }, + { + "internalType": "uint32[]", + "name": "wrapperTypes", + "type": "uint32[]" + }, + { + "internalType": "uint32", + "name": "propToken0", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propToken1", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propFees", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "epochStart", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "numEpoch", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "isOutOfRangeIncentivized", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "boostedReward", + "type": "uint32" + }, + { + "internalType": "address", + "name": "boostingAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "additionalData", + "type": "bytes" + } + ], + "internalType": "struct DistributionParameters", + "name": "base", + "type": "tuple" + }, + { + "internalType": "uint24", + "name": "poolFee", + "type": "uint24" + }, + { + "components": [ + { + "internalType": "address", + "name": "add", + "type": "address" + }, + { + "internalType": "uint8", + "name": "decimals", + "type": "uint8" + }, + { + "internalType": "string", + "name": "symbol", + "type": "string" + }, + { + "internalType": "uint256", + "name": "poolBalance", + "type": "uint256" + } + ], + "internalType": "struct UniswapTokenData", + "name": "token0", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "address", + "name": "add", + "type": "address" + }, + { + "internalType": "uint8", + "name": "decimals", + "type": "uint8" + }, + { + "internalType": "string", + "name": "symbol", + "type": "string" + }, + { + "internalType": "uint256", + "name": "poolBalance", + "type": "uint256" + } + ], + "internalType": "struct UniswapTokenData", + "name": "token1", + "type": "tuple" + }, + { + "internalType": "string", + "name": "rewardTokenSymbol", + "type": "string" + }, + { + "internalType": "uint8", + "name": "rewardTokenDecimals", + "type": "uint8" + } + ], + "internalType": "struct ExtensiveDistributionParameters[]", + "name": "searchDistributions", + "type": "tuple[]" + }, + { + "internalType": "uint256", + "name": "lastIndexDistribution", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "uniV3Pool", + "type": "address" + } + ], + "name": "getActivePoolDistributions", + "outputs": [ + { + "components": [ + { + "components": [ + { + "internalType": "bytes32", + "name": "rewardId", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "uniV3Pool", + "type": "address" + }, + { + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address[]", + "name": "positionWrappers", + "type": "address[]" + }, + { + "internalType": "uint32[]", + "name": "wrapperTypes", + "type": "uint32[]" + }, + { + "internalType": "uint32", + "name": "propToken0", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propToken1", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propFees", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "epochStart", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "numEpoch", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "isOutOfRangeIncentivized", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "boostedReward", + "type": "uint32" + }, + { + "internalType": "address", + "name": "boostingAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "additionalData", + "type": "bytes" + } + ], + "internalType": "struct DistributionParameters", + "name": "base", + "type": "tuple" + }, + { + "internalType": "uint24", + "name": "poolFee", + "type": "uint24" + }, + { + "components": [ + { + "internalType": "address", + "name": "add", + "type": "address" + }, + { + "internalType": "uint8", + "name": "decimals", + "type": "uint8" + }, + { + "internalType": "string", + "name": "symbol", + "type": "string" + }, + { + "internalType": "uint256", + "name": "poolBalance", + "type": "uint256" + } + ], + "internalType": "struct UniswapTokenData", + "name": "token0", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "address", + "name": "add", + "type": "address" + }, + { + "internalType": "uint8", + "name": "decimals", + "type": "uint8" + }, + { + "internalType": "string", + "name": "symbol", + "type": "string" + }, + { + "internalType": "uint256", + "name": "poolBalance", + "type": "uint256" + } + ], + "internalType": "struct UniswapTokenData", + "name": "token1", + "type": "tuple" + }, + { + "internalType": "string", + "name": "rewardTokenSymbol", + "type": "string" + }, + { + "internalType": "uint8", + "name": "rewardTokenDecimals", + "type": "uint8" + } + ], + "internalType": "struct ExtensiveDistributionParameters[]", + "name": "searchDistributions", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "uniV3Pool", + "type": "address" + }, + { + "internalType": "uint32", + "name": "skip", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "first", + "type": "uint32" + } + ], + "name": "getActivePoolDistributions", + "outputs": [ + { + "components": [ + { + "components": [ + { + "internalType": "bytes32", + "name": "rewardId", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "uniV3Pool", + "type": "address" + }, + { + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address[]", + "name": "positionWrappers", + "type": "address[]" + }, + { + "internalType": "uint32[]", + "name": "wrapperTypes", + "type": "uint32[]" + }, + { + "internalType": "uint32", + "name": "propToken0", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propToken1", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propFees", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "epochStart", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "numEpoch", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "isOutOfRangeIncentivized", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "boostedReward", + "type": "uint32" + }, + { + "internalType": "address", + "name": "boostingAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "additionalData", + "type": "bytes" + } + ], + "internalType": "struct DistributionParameters", + "name": "base", + "type": "tuple" + }, + { + "internalType": "uint24", + "name": "poolFee", + "type": "uint24" + }, + { + "components": [ + { + "internalType": "address", + "name": "add", + "type": "address" + }, + { + "internalType": "uint8", + "name": "decimals", + "type": "uint8" + }, + { + "internalType": "string", + "name": "symbol", + "type": "string" + }, + { + "internalType": "uint256", + "name": "poolBalance", + "type": "uint256" + } + ], + "internalType": "struct UniswapTokenData", + "name": "token0", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "address", + "name": "add", + "type": "address" + }, + { + "internalType": "uint8", + "name": "decimals", + "type": "uint8" + }, + { + "internalType": "string", + "name": "symbol", + "type": "string" + }, + { + "internalType": "uint256", + "name": "poolBalance", + "type": "uint256" + } + ], + "internalType": "struct UniswapTokenData", + "name": "token1", + "type": "tuple" + }, + { + "internalType": "string", + "name": "rewardTokenSymbol", + "type": "string" + }, + { + "internalType": "uint8", + "name": "rewardTokenDecimals", + "type": "uint8" + } + ], + "internalType": "struct ExtensiveDistributionParameters[]", + "name": "", + "type": "tuple[]" + }, + { + "internalType": "uint256", + "name": "lastIndexDistribution", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getAllDistributions", + "outputs": [ + { + "components": [ + { + "internalType": "bytes32", + "name": "rewardId", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "uniV3Pool", + "type": "address" + }, + { + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address[]", + "name": "positionWrappers", + "type": "address[]" + }, + { + "internalType": "uint32[]", + "name": "wrapperTypes", + "type": "uint32[]" + }, + { + "internalType": "uint32", + "name": "propToken0", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propToken1", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propFees", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "epochStart", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "numEpoch", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "isOutOfRangeIncentivized", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "boostedReward", + "type": "uint32" + }, + { + "internalType": "address", + "name": "boostingAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "additionalData", + "type": "bytes" + } + ], + "internalType": "struct DistributionParameters[]", + "name": "", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint32", + "name": "epochStart", + "type": "uint32" + } + ], + "name": "getDistributionsAfterEpoch", + "outputs": [ + { + "components": [ + { + "components": [ + { + "internalType": "bytes32", + "name": "rewardId", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "uniV3Pool", + "type": "address" + }, + { + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address[]", + "name": "positionWrappers", + "type": "address[]" + }, + { + "internalType": "uint32[]", + "name": "wrapperTypes", + "type": "uint32[]" + }, + { + "internalType": "uint32", + "name": "propToken0", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propToken1", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propFees", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "epochStart", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "numEpoch", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "isOutOfRangeIncentivized", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "boostedReward", + "type": "uint32" + }, + { + "internalType": "address", + "name": "boostingAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "additionalData", + "type": "bytes" + } + ], + "internalType": "struct DistributionParameters", + "name": "base", + "type": "tuple" + }, + { + "internalType": "uint24", + "name": "poolFee", + "type": "uint24" + }, + { + "components": [ + { + "internalType": "address", + "name": "add", + "type": "address" + }, + { + "internalType": "uint8", + "name": "decimals", + "type": "uint8" + }, + { + "internalType": "string", + "name": "symbol", + "type": "string" + }, + { + "internalType": "uint256", + "name": "poolBalance", + "type": "uint256" + } + ], + "internalType": "struct UniswapTokenData", + "name": "token0", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "address", + "name": "add", + "type": "address" + }, + { + "internalType": "uint8", + "name": "decimals", + "type": "uint8" + }, + { + "internalType": "string", + "name": "symbol", + "type": "string" + }, + { + "internalType": "uint256", + "name": "poolBalance", + "type": "uint256" + } + ], + "internalType": "struct UniswapTokenData", + "name": "token1", + "type": "tuple" + }, + { + "internalType": "string", + "name": "rewardTokenSymbol", + "type": "string" + }, + { + "internalType": "uint8", + "name": "rewardTokenDecimals", + "type": "uint8" + } + ], + "internalType": "struct ExtensiveDistributionParameters[]", + "name": "searchDistributions", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint32", + "name": "epochStart", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "skip", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "first", + "type": "uint32" + } + ], + "name": "getDistributionsAfterEpoch", + "outputs": [ + { + "components": [ + { + "components": [ + { + "internalType": "bytes32", + "name": "rewardId", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "uniV3Pool", + "type": "address" + }, + { + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address[]", + "name": "positionWrappers", + "type": "address[]" + }, + { + "internalType": "uint32[]", + "name": "wrapperTypes", + "type": "uint32[]" + }, + { + "internalType": "uint32", + "name": "propToken0", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propToken1", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propFees", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "epochStart", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "numEpoch", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "isOutOfRangeIncentivized", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "boostedReward", + "type": "uint32" + }, + { + "internalType": "address", + "name": "boostingAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "additionalData", + "type": "bytes" + } + ], + "internalType": "struct DistributionParameters", + "name": "base", + "type": "tuple" + }, + { + "internalType": "uint24", + "name": "poolFee", + "type": "uint24" + }, + { + "components": [ + { + "internalType": "address", + "name": "add", + "type": "address" + }, + { + "internalType": "uint8", + "name": "decimals", + "type": "uint8" + }, + { + "internalType": "string", + "name": "symbol", + "type": "string" + }, + { + "internalType": "uint256", + "name": "poolBalance", + "type": "uint256" + } + ], + "internalType": "struct UniswapTokenData", + "name": "token0", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "address", + "name": "add", + "type": "address" + }, + { + "internalType": "uint8", + "name": "decimals", + "type": "uint8" + }, + { + "internalType": "string", + "name": "symbol", + "type": "string" + }, + { + "internalType": "uint256", + "name": "poolBalance", + "type": "uint256" + } + ], + "internalType": "struct UniswapTokenData", + "name": "token1", + "type": "tuple" + }, + { + "internalType": "string", + "name": "rewardTokenSymbol", + "type": "string" + }, + { + "internalType": "uint8", + "name": "rewardTokenDecimals", + "type": "uint8" + } + ], + "internalType": "struct ExtensiveDistributionParameters[]", + "name": "", + "type": "tuple[]" + }, + { + "internalType": "uint256", + "name": "lastIndexDistribution", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint32", + "name": "epochStart", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "epochEnd", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "skip", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "first", + "type": "uint32" + } + ], + "name": "getDistributionsBetweenEpochs", + "outputs": [ + { + "components": [ + { + "components": [ + { + "internalType": "bytes32", + "name": "rewardId", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "uniV3Pool", + "type": "address" + }, + { + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address[]", + "name": "positionWrappers", + "type": "address[]" + }, + { + "internalType": "uint32[]", + "name": "wrapperTypes", + "type": "uint32[]" + }, + { + "internalType": "uint32", + "name": "propToken0", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propToken1", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propFees", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "epochStart", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "numEpoch", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "isOutOfRangeIncentivized", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "boostedReward", + "type": "uint32" + }, + { + "internalType": "address", + "name": "boostingAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "additionalData", + "type": "bytes" + } + ], + "internalType": "struct DistributionParameters", + "name": "base", + "type": "tuple" + }, + { + "internalType": "uint24", + "name": "poolFee", + "type": "uint24" + }, + { + "components": [ + { + "internalType": "address", + "name": "add", + "type": "address" + }, + { + "internalType": "uint8", + "name": "decimals", + "type": "uint8" + }, + { + "internalType": "string", + "name": "symbol", + "type": "string" + }, + { + "internalType": "uint256", + "name": "poolBalance", + "type": "uint256" + } + ], + "internalType": "struct UniswapTokenData", + "name": "token0", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "address", + "name": "add", + "type": "address" + }, + { + "internalType": "uint8", + "name": "decimals", + "type": "uint8" + }, + { + "internalType": "string", + "name": "symbol", + "type": "string" + }, + { + "internalType": "uint256", + "name": "poolBalance", + "type": "uint256" + } + ], + "internalType": "struct UniswapTokenData", + "name": "token1", + "type": "tuple" + }, + { + "internalType": "string", + "name": "rewardTokenSymbol", + "type": "string" + }, + { + "internalType": "uint8", + "name": "rewardTokenDecimals", + "type": "uint8" + } + ], + "internalType": "struct ExtensiveDistributionParameters[]", + "name": "", + "type": "tuple[]" + }, + { + "internalType": "uint256", + "name": "lastIndexDistribution", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint32", + "name": "epochStart", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "epochEnd", + "type": "uint32" + } + ], + "name": "getDistributionsBetweenEpochs", + "outputs": [ + { + "components": [ + { + "components": [ + { + "internalType": "bytes32", + "name": "rewardId", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "uniV3Pool", + "type": "address" + }, + { + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address[]", + "name": "positionWrappers", + "type": "address[]" + }, + { + "internalType": "uint32[]", + "name": "wrapperTypes", + "type": "uint32[]" + }, + { + "internalType": "uint32", + "name": "propToken0", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propToken1", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propFees", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "epochStart", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "numEpoch", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "isOutOfRangeIncentivized", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "boostedReward", + "type": "uint32" + }, + { + "internalType": "address", + "name": "boostingAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "additionalData", + "type": "bytes" + } + ], + "internalType": "struct DistributionParameters", + "name": "base", + "type": "tuple" + }, + { + "internalType": "uint24", + "name": "poolFee", + "type": "uint24" + }, + { + "components": [ + { + "internalType": "address", + "name": "add", + "type": "address" + }, + { + "internalType": "uint8", + "name": "decimals", + "type": "uint8" + }, + { + "internalType": "string", + "name": "symbol", + "type": "string" + }, + { + "internalType": "uint256", + "name": "poolBalance", + "type": "uint256" + } + ], + "internalType": "struct UniswapTokenData", + "name": "token0", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "address", + "name": "add", + "type": "address" + }, + { + "internalType": "uint8", + "name": "decimals", + "type": "uint8" + }, + { + "internalType": "string", + "name": "symbol", + "type": "string" + }, + { + "internalType": "uint256", + "name": "poolBalance", + "type": "uint256" + } + ], + "internalType": "struct UniswapTokenData", + "name": "token1", + "type": "tuple" + }, + { + "internalType": "string", + "name": "rewardTokenSymbol", + "type": "string" + }, + { + "internalType": "uint8", + "name": "rewardTokenDecimals", + "type": "uint8" + } + ], + "internalType": "struct ExtensiveDistributionParameters[]", + "name": "searchDistributions", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint32", + "name": "epoch", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "skip", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "first", + "type": "uint32" + } + ], + "name": "getDistributionsForEpoch", + "outputs": [ + { + "components": [ + { + "components": [ + { + "internalType": "bytes32", + "name": "rewardId", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "uniV3Pool", + "type": "address" + }, + { + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address[]", + "name": "positionWrappers", + "type": "address[]" + }, + { + "internalType": "uint32[]", + "name": "wrapperTypes", + "type": "uint32[]" + }, + { + "internalType": "uint32", + "name": "propToken0", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propToken1", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propFees", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "epochStart", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "numEpoch", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "isOutOfRangeIncentivized", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "boostedReward", + "type": "uint32" + }, + { + "internalType": "address", + "name": "boostingAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "additionalData", + "type": "bytes" + } + ], + "internalType": "struct DistributionParameters", + "name": "base", + "type": "tuple" + }, + { + "internalType": "uint24", + "name": "poolFee", + "type": "uint24" + }, + { + "components": [ + { + "internalType": "address", + "name": "add", + "type": "address" + }, + { + "internalType": "uint8", + "name": "decimals", + "type": "uint8" + }, + { + "internalType": "string", + "name": "symbol", + "type": "string" + }, + { + "internalType": "uint256", + "name": "poolBalance", + "type": "uint256" + } + ], + "internalType": "struct UniswapTokenData", + "name": "token0", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "address", + "name": "add", + "type": "address" + }, + { + "internalType": "uint8", + "name": "decimals", + "type": "uint8" + }, + { + "internalType": "string", + "name": "symbol", + "type": "string" + }, + { + "internalType": "uint256", + "name": "poolBalance", + "type": "uint256" + } + ], + "internalType": "struct UniswapTokenData", + "name": "token1", + "type": "tuple" + }, + { + "internalType": "string", + "name": "rewardTokenSymbol", + "type": "string" + }, + { + "internalType": "uint8", + "name": "rewardTokenDecimals", + "type": "uint8" + } + ], + "internalType": "struct ExtensiveDistributionParameters[]", + "name": "", + "type": "tuple[]" + }, + { + "internalType": "uint256", + "name": "lastIndexDistribution", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint32", + "name": "epoch", + "type": "uint32" + } + ], + "name": "getDistributionsForEpoch", + "outputs": [ + { + "components": [ + { + "components": [ + { + "internalType": "bytes32", + "name": "rewardId", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "uniV3Pool", + "type": "address" + }, + { + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address[]", + "name": "positionWrappers", + "type": "address[]" + }, + { + "internalType": "uint32[]", + "name": "wrapperTypes", + "type": "uint32[]" + }, + { + "internalType": "uint32", + "name": "propToken0", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propToken1", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propFees", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "epochStart", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "numEpoch", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "isOutOfRangeIncentivized", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "boostedReward", + "type": "uint32" + }, + { + "internalType": "address", + "name": "boostingAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "additionalData", + "type": "bytes" + } + ], + "internalType": "struct DistributionParameters", + "name": "base", + "type": "tuple" + }, + { + "internalType": "uint24", + "name": "poolFee", + "type": "uint24" + }, + { + "components": [ + { + "internalType": "address", + "name": "add", + "type": "address" + }, + { + "internalType": "uint8", + "name": "decimals", + "type": "uint8" + }, + { + "internalType": "string", + "name": "symbol", + "type": "string" + }, + { + "internalType": "uint256", + "name": "poolBalance", + "type": "uint256" + } + ], + "internalType": "struct UniswapTokenData", + "name": "token0", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "address", + "name": "add", + "type": "address" + }, + { + "internalType": "uint8", + "name": "decimals", + "type": "uint8" + }, + { + "internalType": "string", + "name": "symbol", + "type": "string" + }, + { + "internalType": "uint256", + "name": "poolBalance", + "type": "uint256" + } + ], + "internalType": "struct UniswapTokenData", + "name": "token1", + "type": "tuple" + }, + { + "internalType": "string", + "name": "rewardTokenSymbol", + "type": "string" + }, + { + "internalType": "uint8", + "name": "rewardTokenDecimals", + "type": "uint8" + } + ], + "internalType": "struct ExtensiveDistributionParameters[]", + "name": "searchDistributions", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "bytes32", + "name": "rewardId", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "uniV3Pool", + "type": "address" + }, + { + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address[]", + "name": "positionWrappers", + "type": "address[]" + }, + { + "internalType": "uint32[]", + "name": "wrapperTypes", + "type": "uint32[]" + }, + { + "internalType": "uint32", + "name": "propToken0", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propToken1", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propFees", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "epochStart", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "numEpoch", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "isOutOfRangeIncentivized", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "boostedReward", + "type": "uint32" + }, + { + "internalType": "address", + "name": "boostingAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "additionalData", + "type": "bytes" + } + ], + "internalType": "struct DistributionParameters", + "name": "distribution", + "type": "tuple" + } + ], + "name": "getExtensiveDistributionParameters", + "outputs": [ + { + "components": [ + { + "components": [ + { + "internalType": "bytes32", + "name": "rewardId", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "uniV3Pool", + "type": "address" + }, + { + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address[]", + "name": "positionWrappers", + "type": "address[]" + }, + { + "internalType": "uint32[]", + "name": "wrapperTypes", + "type": "uint32[]" + }, + { + "internalType": "uint32", + "name": "propToken0", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propToken1", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propFees", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "epochStart", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "numEpoch", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "isOutOfRangeIncentivized", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "boostedReward", + "type": "uint32" + }, + { + "internalType": "address", + "name": "boostingAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "additionalData", + "type": "bytes" + } + ], + "internalType": "struct DistributionParameters", + "name": "base", + "type": "tuple" + }, + { + "internalType": "uint24", + "name": "poolFee", + "type": "uint24" + }, + { + "components": [ + { + "internalType": "address", + "name": "add", + "type": "address" + }, + { + "internalType": "uint8", + "name": "decimals", + "type": "uint8" + }, + { + "internalType": "string", + "name": "symbol", + "type": "string" + }, + { + "internalType": "uint256", + "name": "poolBalance", + "type": "uint256" + } + ], + "internalType": "struct UniswapTokenData", + "name": "token0", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "address", + "name": "add", + "type": "address" + }, + { + "internalType": "uint8", + "name": "decimals", + "type": "uint8" + }, + { + "internalType": "string", + "name": "symbol", + "type": "string" + }, + { + "internalType": "uint256", + "name": "poolBalance", + "type": "uint256" + } + ], + "internalType": "struct UniswapTokenData", + "name": "token1", + "type": "tuple" + }, + { + "internalType": "string", + "name": "rewardTokenSymbol", + "type": "string" + }, + { + "internalType": "uint8", + "name": "rewardTokenDecimals", + "type": "uint8" + } + ], + "internalType": "struct ExtensiveDistributionParameters", + "name": "extensiveParams", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "uniV3Pool", + "type": "address" + }, + { + "internalType": "uint32", + "name": "epochStart", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "skip", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "first", + "type": "uint32" + } + ], + "name": "getPoolDistributionsAfterEpoch", + "outputs": [ + { + "components": [ + { + "components": [ + { + "internalType": "bytes32", + "name": "rewardId", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "uniV3Pool", + "type": "address" + }, + { + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address[]", + "name": "positionWrappers", + "type": "address[]" + }, + { + "internalType": "uint32[]", + "name": "wrapperTypes", + "type": "uint32[]" + }, + { + "internalType": "uint32", + "name": "propToken0", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propToken1", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propFees", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "epochStart", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "numEpoch", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "isOutOfRangeIncentivized", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "boostedReward", + "type": "uint32" + }, + { + "internalType": "address", + "name": "boostingAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "additionalData", + "type": "bytes" + } + ], + "internalType": "struct DistributionParameters", + "name": "base", + "type": "tuple" + }, + { + "internalType": "uint24", + "name": "poolFee", + "type": "uint24" + }, + { + "components": [ + { + "internalType": "address", + "name": "add", + "type": "address" + }, + { + "internalType": "uint8", + "name": "decimals", + "type": "uint8" + }, + { + "internalType": "string", + "name": "symbol", + "type": "string" + }, + { + "internalType": "uint256", + "name": "poolBalance", + "type": "uint256" + } + ], + "internalType": "struct UniswapTokenData", + "name": "token0", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "address", + "name": "add", + "type": "address" + }, + { + "internalType": "uint8", + "name": "decimals", + "type": "uint8" + }, + { + "internalType": "string", + "name": "symbol", + "type": "string" + }, + { + "internalType": "uint256", + "name": "poolBalance", + "type": "uint256" + } + ], + "internalType": "struct UniswapTokenData", + "name": "token1", + "type": "tuple" + }, + { + "internalType": "string", + "name": "rewardTokenSymbol", + "type": "string" + }, + { + "internalType": "uint8", + "name": "rewardTokenDecimals", + "type": "uint8" + } + ], + "internalType": "struct ExtensiveDistributionParameters[]", + "name": "", + "type": "tuple[]" + }, + { + "internalType": "uint256", + "name": "lastIndexDistribution", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "uniV3Pool", + "type": "address" + }, + { + "internalType": "uint32", + "name": "epochStart", + "type": "uint32" + } + ], + "name": "getPoolDistributionsAfterEpoch", + "outputs": [ + { + "components": [ + { + "components": [ + { + "internalType": "bytes32", + "name": "rewardId", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "uniV3Pool", + "type": "address" + }, + { + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address[]", + "name": "positionWrappers", + "type": "address[]" + }, + { + "internalType": "uint32[]", + "name": "wrapperTypes", + "type": "uint32[]" + }, + { + "internalType": "uint32", + "name": "propToken0", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propToken1", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propFees", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "epochStart", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "numEpoch", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "isOutOfRangeIncentivized", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "boostedReward", + "type": "uint32" + }, + { + "internalType": "address", + "name": "boostingAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "additionalData", + "type": "bytes" + } + ], + "internalType": "struct DistributionParameters", + "name": "base", + "type": "tuple" + }, + { + "internalType": "uint24", + "name": "poolFee", + "type": "uint24" + }, + { + "components": [ + { + "internalType": "address", + "name": "add", + "type": "address" + }, + { + "internalType": "uint8", + "name": "decimals", + "type": "uint8" + }, + { + "internalType": "string", + "name": "symbol", + "type": "string" + }, + { + "internalType": "uint256", + "name": "poolBalance", + "type": "uint256" + } + ], + "internalType": "struct UniswapTokenData", + "name": "token0", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "address", + "name": "add", + "type": "address" + }, + { + "internalType": "uint8", + "name": "decimals", + "type": "uint8" + }, + { + "internalType": "string", + "name": "symbol", + "type": "string" + }, + { + "internalType": "uint256", + "name": "poolBalance", + "type": "uint256" + } + ], + "internalType": "struct UniswapTokenData", + "name": "token1", + "type": "tuple" + }, + { + "internalType": "string", + "name": "rewardTokenSymbol", + "type": "string" + }, + { + "internalType": "uint8", + "name": "rewardTokenDecimals", + "type": "uint8" + } + ], + "internalType": "struct ExtensiveDistributionParameters[]", + "name": "searchDistributions", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "uniV3Pool", + "type": "address" + }, + { + "internalType": "uint32", + "name": "epochStart", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "epochEnd", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "skip", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "first", + "type": "uint32" + } + ], + "name": "getPoolDistributionsBetweenEpochs", + "outputs": [ + { + "components": [ + { + "components": [ + { + "internalType": "bytes32", + "name": "rewardId", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "uniV3Pool", + "type": "address" + }, + { + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address[]", + "name": "positionWrappers", + "type": "address[]" + }, + { + "internalType": "uint32[]", + "name": "wrapperTypes", + "type": "uint32[]" + }, + { + "internalType": "uint32", + "name": "propToken0", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propToken1", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propFees", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "epochStart", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "numEpoch", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "isOutOfRangeIncentivized", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "boostedReward", + "type": "uint32" + }, + { + "internalType": "address", + "name": "boostingAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "additionalData", + "type": "bytes" + } + ], + "internalType": "struct DistributionParameters", + "name": "base", + "type": "tuple" + }, + { + "internalType": "uint24", + "name": "poolFee", + "type": "uint24" + }, + { + "components": [ + { + "internalType": "address", + "name": "add", + "type": "address" + }, + { + "internalType": "uint8", + "name": "decimals", + "type": "uint8" + }, + { + "internalType": "string", + "name": "symbol", + "type": "string" + }, + { + "internalType": "uint256", + "name": "poolBalance", + "type": "uint256" + } + ], + "internalType": "struct UniswapTokenData", + "name": "token0", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "address", + "name": "add", + "type": "address" + }, + { + "internalType": "uint8", + "name": "decimals", + "type": "uint8" + }, + { + "internalType": "string", + "name": "symbol", + "type": "string" + }, + { + "internalType": "uint256", + "name": "poolBalance", + "type": "uint256" + } + ], + "internalType": "struct UniswapTokenData", + "name": "token1", + "type": "tuple" + }, + { + "internalType": "string", + "name": "rewardTokenSymbol", + "type": "string" + }, + { + "internalType": "uint8", + "name": "rewardTokenDecimals", + "type": "uint8" + } + ], + "internalType": "struct ExtensiveDistributionParameters[]", + "name": "", + "type": "tuple[]" + }, + { + "internalType": "uint256", + "name": "lastIndexDistribution", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "uniV3Pool", + "type": "address" + }, + { + "internalType": "uint32", + "name": "epochStart", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "epochEnd", + "type": "uint32" + } + ], + "name": "getPoolDistributionsBetweenEpochs", + "outputs": [ + { + "components": [ + { + "components": [ + { + "internalType": "bytes32", + "name": "rewardId", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "uniV3Pool", + "type": "address" + }, + { + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address[]", + "name": "positionWrappers", + "type": "address[]" + }, + { + "internalType": "uint32[]", + "name": "wrapperTypes", + "type": "uint32[]" + }, + { + "internalType": "uint32", + "name": "propToken0", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propToken1", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propFees", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "epochStart", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "numEpoch", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "isOutOfRangeIncentivized", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "boostedReward", + "type": "uint32" + }, + { + "internalType": "address", + "name": "boostingAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "additionalData", + "type": "bytes" + } + ], + "internalType": "struct DistributionParameters", + "name": "base", + "type": "tuple" + }, + { + "internalType": "uint24", + "name": "poolFee", + "type": "uint24" + }, + { + "components": [ + { + "internalType": "address", + "name": "add", + "type": "address" + }, + { + "internalType": "uint8", + "name": "decimals", + "type": "uint8" + }, + { + "internalType": "string", + "name": "symbol", + "type": "string" + }, + { + "internalType": "uint256", + "name": "poolBalance", + "type": "uint256" + } + ], + "internalType": "struct UniswapTokenData", + "name": "token0", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "address", + "name": "add", + "type": "address" + }, + { + "internalType": "uint8", + "name": "decimals", + "type": "uint8" + }, + { + "internalType": "string", + "name": "symbol", + "type": "string" + }, + { + "internalType": "uint256", + "name": "poolBalance", + "type": "uint256" + } + ], + "internalType": "struct UniswapTokenData", + "name": "token1", + "type": "tuple" + }, + { + "internalType": "string", + "name": "rewardTokenSymbol", + "type": "string" + }, + { + "internalType": "uint8", + "name": "rewardTokenDecimals", + "type": "uint8" + } + ], + "internalType": "struct ExtensiveDistributionParameters[]", + "name": "searchDistributions", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "uniV3Pool", + "type": "address" + }, + { + "internalType": "uint32", + "name": "epoch", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "skip", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "first", + "type": "uint32" + } + ], + "name": "getPoolDistributionsForEpoch", + "outputs": [ + { + "components": [ + { + "components": [ + { + "internalType": "bytes32", + "name": "rewardId", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "uniV3Pool", + "type": "address" + }, + { + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address[]", + "name": "positionWrappers", + "type": "address[]" + }, + { + "internalType": "uint32[]", + "name": "wrapperTypes", + "type": "uint32[]" + }, + { + "internalType": "uint32", + "name": "propToken0", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propToken1", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propFees", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "epochStart", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "numEpoch", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "isOutOfRangeIncentivized", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "boostedReward", + "type": "uint32" + }, + { + "internalType": "address", + "name": "boostingAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "additionalData", + "type": "bytes" + } + ], + "internalType": "struct DistributionParameters", + "name": "base", + "type": "tuple" + }, + { + "internalType": "uint24", + "name": "poolFee", + "type": "uint24" + }, + { + "components": [ + { + "internalType": "address", + "name": "add", + "type": "address" + }, + { + "internalType": "uint8", + "name": "decimals", + "type": "uint8" + }, + { + "internalType": "string", + "name": "symbol", + "type": "string" + }, + { + "internalType": "uint256", + "name": "poolBalance", + "type": "uint256" + } + ], + "internalType": "struct UniswapTokenData", + "name": "token0", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "address", + "name": "add", + "type": "address" + }, + { + "internalType": "uint8", + "name": "decimals", + "type": "uint8" + }, + { + "internalType": "string", + "name": "symbol", + "type": "string" + }, + { + "internalType": "uint256", + "name": "poolBalance", + "type": "uint256" + } + ], + "internalType": "struct UniswapTokenData", + "name": "token1", + "type": "tuple" + }, + { + "internalType": "string", + "name": "rewardTokenSymbol", + "type": "string" + }, + { + "internalType": "uint8", + "name": "rewardTokenDecimals", + "type": "uint8" + } + ], + "internalType": "struct ExtensiveDistributionParameters[]", + "name": "", + "type": "tuple[]" + }, + { + "internalType": "uint256", + "name": "lastIndexDistribution", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "uniV3Pool", + "type": "address" + }, + { + "internalType": "uint32", + "name": "epoch", + "type": "uint32" + } + ], + "name": "getPoolDistributionsForEpoch", + "outputs": [ + { + "components": [ + { + "components": [ + { + "internalType": "bytes32", + "name": "rewardId", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "uniV3Pool", + "type": "address" + }, + { + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address[]", + "name": "positionWrappers", + "type": "address[]" + }, + { + "internalType": "uint32[]", + "name": "wrapperTypes", + "type": "uint32[]" + }, + { + "internalType": "uint32", + "name": "propToken0", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propToken1", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propFees", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "epochStart", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "numEpoch", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "isOutOfRangeIncentivized", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "boostedReward", + "type": "uint32" + }, + { + "internalType": "address", + "name": "boostingAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "additionalData", + "type": "bytes" + } + ], + "internalType": "struct DistributionParameters", + "name": "base", + "type": "tuple" + }, + { + "internalType": "uint24", + "name": "poolFee", + "type": "uint24" + }, + { + "components": [ + { + "internalType": "address", + "name": "add", + "type": "address" + }, + { + "internalType": "uint8", + "name": "decimals", + "type": "uint8" + }, + { + "internalType": "string", + "name": "symbol", + "type": "string" + }, + { + "internalType": "uint256", + "name": "poolBalance", + "type": "uint256" + } + ], + "internalType": "struct UniswapTokenData", + "name": "token0", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "address", + "name": "add", + "type": "address" + }, + { + "internalType": "uint8", + "name": "decimals", + "type": "uint8" + }, + { + "internalType": "string", + "name": "symbol", + "type": "string" + }, + { + "internalType": "uint256", + "name": "poolBalance", + "type": "uint256" + } + ], + "internalType": "struct UniswapTokenData", + "name": "token1", + "type": "tuple" + }, + { + "internalType": "string", + "name": "rewardTokenSymbol", + "type": "string" + }, + { + "internalType": "uint8", + "name": "rewardTokenDecimals", + "type": "uint8" + } + ], + "internalType": "struct ExtensiveDistributionParameters[]", + "name": "searchDistributions", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getValidRewardTokens", + "outputs": [ + { + "components": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "minimumAmountPerEpoch", + "type": "uint256" + } + ], + "internalType": "struct RewardTokenAmounts[]", + "name": "", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract ICore", + "name": "_core", + "type": "address" + }, + { + "internalType": "address", + "name": "_distributor", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_fees", + "type": "uint256" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "isWhitelistedToken", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "message", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "messageHash", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "nonces", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "proxiableUUID", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IERC20[]", + "name": "tokens", + "type": "address[]" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + } + ], + "name": "recoverFees", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "rewardTokenMinAmounts", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "rewardTokens", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_feeRecipient", + "type": "address" + } + ], + "name": "setFeeRecipient", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_fees", + "type": "uint256" + } + ], + "name": "setFees", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "_message", + "type": "string" + } + ], + "name": "setMessage", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_distributor", + "type": "address" + } + ], + "name": "setNewDistributor", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "tokens", + "type": "address[]" + }, + { + "internalType": "uint256[]", + "name": "amounts", + "type": "uint256[]" + } + ], + "name": "setRewardTokenMinAmounts", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "internalType": "uint256", + "name": "userFeeRebate", + "type": "uint256" + } + ], + "name": "setUserFeeRebate", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "signature", + "type": "bytes" + } + ], + "name": "sign", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "bytes32", + "name": "rewardId", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "uniV3Pool", + "type": "address" + }, + { + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address[]", + "name": "positionWrappers", + "type": "address[]" + }, + { + "internalType": "uint32[]", + "name": "wrapperTypes", + "type": "uint32[]" + }, + { + "internalType": "uint32", + "name": "propToken0", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propToken1", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propFees", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "epochStart", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "numEpoch", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "isOutOfRangeIncentivized", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "boostedReward", + "type": "uint32" + }, + { + "internalType": "address", + "name": "boostingAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "additionalData", + "type": "bytes" + } + ], + "internalType": "struct DistributionParameters", + "name": "distribution", + "type": "tuple" + }, + { + "internalType": "bytes", + "name": "signature", + "type": "bytes" + } + ], + "name": "signAndCreateDistribution", + "outputs": [ + { + "internalType": "uint256", + "name": "distributionAmount", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "user", + "type": "address" + } + ], + "name": "toggleSigningWhitelist", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + } + ], + "name": "toggleTokenWhitelist", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "bytes32", + "name": "rewardId", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "uniV3Pool", + "type": "address" + }, + { + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address[]", + "name": "positionWrappers", + "type": "address[]" + }, + { + "internalType": "uint32[]", + "name": "wrapperTypes", + "type": "uint32[]" + }, + { + "internalType": "uint32", + "name": "propToken0", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propToken1", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propFees", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "epochStart", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "numEpoch", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "isOutOfRangeIncentivized", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "boostedReward", + "type": "uint32" + }, + { + "internalType": "address", + "name": "boostingAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "additionalData", + "type": "bytes" + } + ], + "internalType": "struct DistributionParameters", + "name": "distribution", + "type": "tuple" + } + ], + "name": "tryGetExtensiveDistributionParameters", + "outputs": [ + { + "internalType": "bool", + "name": "success", + "type": "bool" + }, + { + "components": [ + { + "components": [ + { + "internalType": "bytes32", + "name": "rewardId", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "uniV3Pool", + "type": "address" + }, + { + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address[]", + "name": "positionWrappers", + "type": "address[]" + }, + { + "internalType": "uint32[]", + "name": "wrapperTypes", + "type": "uint32[]" + }, + { + "internalType": "uint32", + "name": "propToken0", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propToken1", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "propFees", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "epochStart", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "numEpoch", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "isOutOfRangeIncentivized", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "boostedReward", + "type": "uint32" + }, + { + "internalType": "address", + "name": "boostingAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "additionalData", + "type": "bytes" + } + ], + "internalType": "struct DistributionParameters", + "name": "base", + "type": "tuple" + }, + { + "internalType": "uint24", + "name": "poolFee", + "type": "uint24" + }, + { + "components": [ + { + "internalType": "address", + "name": "add", + "type": "address" + }, + { + "internalType": "uint8", + "name": "decimals", + "type": "uint8" + }, + { + "internalType": "string", + "name": "symbol", + "type": "string" + }, + { + "internalType": "uint256", + "name": "poolBalance", + "type": "uint256" + } + ], + "internalType": "struct UniswapTokenData", + "name": "token0", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "address", + "name": "add", + "type": "address" + }, + { + "internalType": "uint8", + "name": "decimals", + "type": "uint8" + }, + { + "internalType": "string", + "name": "symbol", + "type": "string" + }, + { + "internalType": "uint256", + "name": "poolBalance", + "type": "uint256" + } + ], + "internalType": "struct UniswapTokenData", + "name": "token1", + "type": "tuple" + }, + { + "internalType": "string", + "name": "rewardTokenSymbol", + "type": "string" + }, + { + "internalType": "uint8", + "name": "rewardTokenDecimals", + "type": "uint8" + } + ], + "internalType": "struct ExtensiveDistributionParameters", + "name": "extensiveParams", + "type": "tuple" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "upgradeTo", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "upgradeToAndCall", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "userSignatureWhitelist", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "userSignatures", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "transactionHash": "0xc9ca76ed3a5b083e11041035ff7493a681a05f602915f608e784c7fcc400cff4", + "receipt": { + "to": null, + "from": "0x9f76a95AA7535bb0893cf88A146396e00ed21A12", + "contractAddress": "0x7Db28175B63f154587BbB1Cae62D39Ea80A23383", + "transactionIndex": 0, + "gasUsed": "5119266", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000", + "blockHash": "0x0f7a6802e91313d4ea784b785e87cab231b62ffcd8da03c57220561c5db5be69", + "transactionHash": "0xc9ca76ed3a5b083e11041035ff7493a681a05f602915f608e784c7fcc400cff4", + "logs": [ + { + "transactionIndex": 0, + "blockNumber": 147784011, + "transactionHash": "0xc9ca76ed3a5b083e11041035ff7493a681a05f602915f608e784c7fcc400cff4", + "address": "0x7Db28175B63f154587BbB1Cae62D39Ea80A23383", + "topics": [ + "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000000001", + "logIndex": 0, + "blockHash": "0x0f7a6802e91313d4ea784b785e87cab231b62ffcd8da03c57220561c5db5be69" + }, + { + "transactionIndex": 0, + "blockNumber": 147784011, + "transactionHash": "0xc9ca76ed3a5b083e11041035ff7493a681a05f602915f608e784c7fcc400cff4", + "address": "0x7Db28175B63f154587BbB1Cae62D39Ea80A23383", + "topics": [ + "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000000001", + "logIndex": 1, + "blockHash": "0x0f7a6802e91313d4ea784b785e87cab231b62ffcd8da03c57220561c5db5be69" + } + ], + "blockNumber": 147784011, + "cumulativeGasUsed": "5119266", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 1, + "solcInputHash": "69984a2380fa2fad0c3afbbb08b5652b", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"InvalidLengths\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidParam\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidReward\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidSignature\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotGovernorOrGuardian\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotSigned\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ZeroAddress\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"previousAdmin\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"AdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"beacon\",\"type\":\"address\"}],\"name\":\"BeaconUpgraded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_distributor\",\"type\":\"address\"}],\"name\":\"DistributorUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"userFeeRebate\",\"type\":\"uint256\"}],\"name\":\"FeeRebateUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_feeRecipient\",\"type\":\"address\"}],\"name\":\"FeeRecipientUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_fees\",\"type\":\"uint256\"}],\"name\":\"FeesSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"_messageHash\",\"type\":\"bytes32\"}],\"name\":\"MessageUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"rewardId\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"uniV3Pool\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"rewardToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"positionWrappers\",\"type\":\"address[]\"},{\"internalType\":\"uint32[]\",\"name\":\"wrapperTypes\",\"type\":\"uint32[]\"},{\"internalType\":\"uint32\",\"name\":\"propToken0\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propToken1\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propFees\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"epochStart\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"numEpoch\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"isOutOfRangeIncentivized\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"boostedReward\",\"type\":\"uint32\"},{\"internalType\":\"address\",\"name\":\"boostingAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"additionalData\",\"type\":\"bytes\"}],\"indexed\":false,\"internalType\":\"struct DistributionParameters\",\"name\":\"distribution\",\"type\":\"tuple\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"NewDistribution\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"RewardTokenMinimumAmountUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"toggleStatus\",\"type\":\"uint256\"}],\"name\":\"TokenWhitelistToggled\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"implementation\",\"type\":\"address\"}],\"name\":\"Upgraded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"messageHash\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"}],\"name\":\"UserSigned\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"toggleStatus\",\"type\":\"uint256\"}],\"name\":\"UserSigningWhitelistToggled\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"BASE_9\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"EPOCH_DURATION\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"core\",\"outputs\":[{\"internalType\":\"contract ICore\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"rewardId\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"uniV3Pool\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"rewardToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"positionWrappers\",\"type\":\"address[]\"},{\"internalType\":\"uint32[]\",\"name\":\"wrapperTypes\",\"type\":\"uint32[]\"},{\"internalType\":\"uint32\",\"name\":\"propToken0\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propToken1\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propFees\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"epochStart\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"numEpoch\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"isOutOfRangeIncentivized\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"boostedReward\",\"type\":\"uint32\"},{\"internalType\":\"address\",\"name\":\"boostingAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"additionalData\",\"type\":\"bytes\"}],\"internalType\":\"struct DistributionParameters\",\"name\":\"distribution\",\"type\":\"tuple\"}],\"name\":\"createDistribution\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"distributionAmount\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"rewardId\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"uniV3Pool\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"rewardToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"positionWrappers\",\"type\":\"address[]\"},{\"internalType\":\"uint32[]\",\"name\":\"wrapperTypes\",\"type\":\"uint32[]\"},{\"internalType\":\"uint32\",\"name\":\"propToken0\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propToken1\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propFees\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"epochStart\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"numEpoch\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"isOutOfRangeIncentivized\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"boostedReward\",\"type\":\"uint32\"},{\"internalType\":\"address\",\"name\":\"boostingAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"additionalData\",\"type\":\"bytes\"}],\"internalType\":\"struct DistributionParameters[]\",\"name\":\"distributions\",\"type\":\"tuple[]\"}],\"name\":\"createDistributions\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"\",\"type\":\"uint256[]\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"distributionList\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"rewardId\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"uniV3Pool\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"rewardToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"uint32\",\"name\":\"propToken0\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propToken1\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propFees\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"epochStart\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"numEpoch\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"isOutOfRangeIncentivized\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"boostedReward\",\"type\":\"uint32\"},{\"internalType\":\"address\",\"name\":\"boostingAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"additionalData\",\"type\":\"bytes\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"distributor\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"feeRebate\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"feeRecipient\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"fees\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getActiveDistributions\",\"outputs\":[{\"components\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"rewardId\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"uniV3Pool\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"rewardToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"positionWrappers\",\"type\":\"address[]\"},{\"internalType\":\"uint32[]\",\"name\":\"wrapperTypes\",\"type\":\"uint32[]\"},{\"internalType\":\"uint32\",\"name\":\"propToken0\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propToken1\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propFees\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"epochStart\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"numEpoch\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"isOutOfRangeIncentivized\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"boostedReward\",\"type\":\"uint32\"},{\"internalType\":\"address\",\"name\":\"boostingAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"additionalData\",\"type\":\"bytes\"}],\"internalType\":\"struct DistributionParameters\",\"name\":\"base\",\"type\":\"tuple\"},{\"internalType\":\"uint24\",\"name\":\"poolFee\",\"type\":\"uint24\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"add\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"decimals\",\"type\":\"uint8\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"poolBalance\",\"type\":\"uint256\"}],\"internalType\":\"struct UniswapTokenData\",\"name\":\"token0\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"add\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"decimals\",\"type\":\"uint8\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"poolBalance\",\"type\":\"uint256\"}],\"internalType\":\"struct UniswapTokenData\",\"name\":\"token1\",\"type\":\"tuple\"},{\"internalType\":\"string\",\"name\":\"rewardTokenSymbol\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"rewardTokenDecimals\",\"type\":\"uint8\"}],\"internalType\":\"struct ExtensiveDistributionParameters[]\",\"name\":\"searchDistributions\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"skip\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"first\",\"type\":\"uint32\"}],\"name\":\"getActiveDistributions\",\"outputs\":[{\"components\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"rewardId\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"uniV3Pool\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"rewardToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"positionWrappers\",\"type\":\"address[]\"},{\"internalType\":\"uint32[]\",\"name\":\"wrapperTypes\",\"type\":\"uint32[]\"},{\"internalType\":\"uint32\",\"name\":\"propToken0\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propToken1\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propFees\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"epochStart\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"numEpoch\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"isOutOfRangeIncentivized\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"boostedReward\",\"type\":\"uint32\"},{\"internalType\":\"address\",\"name\":\"boostingAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"additionalData\",\"type\":\"bytes\"}],\"internalType\":\"struct DistributionParameters\",\"name\":\"base\",\"type\":\"tuple\"},{\"internalType\":\"uint24\",\"name\":\"poolFee\",\"type\":\"uint24\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"add\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"decimals\",\"type\":\"uint8\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"poolBalance\",\"type\":\"uint256\"}],\"internalType\":\"struct UniswapTokenData\",\"name\":\"token0\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"add\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"decimals\",\"type\":\"uint8\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"poolBalance\",\"type\":\"uint256\"}],\"internalType\":\"struct UniswapTokenData\",\"name\":\"token1\",\"type\":\"tuple\"},{\"internalType\":\"string\",\"name\":\"rewardTokenSymbol\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"rewardTokenDecimals\",\"type\":\"uint8\"}],\"internalType\":\"struct ExtensiveDistributionParameters[]\",\"name\":\"searchDistributions\",\"type\":\"tuple[]\"},{\"internalType\":\"uint256\",\"name\":\"lastIndexDistribution\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"uniV3Pool\",\"type\":\"address\"}],\"name\":\"getActivePoolDistributions\",\"outputs\":[{\"components\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"rewardId\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"uniV3Pool\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"rewardToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"positionWrappers\",\"type\":\"address[]\"},{\"internalType\":\"uint32[]\",\"name\":\"wrapperTypes\",\"type\":\"uint32[]\"},{\"internalType\":\"uint32\",\"name\":\"propToken0\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propToken1\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propFees\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"epochStart\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"numEpoch\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"isOutOfRangeIncentivized\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"boostedReward\",\"type\":\"uint32\"},{\"internalType\":\"address\",\"name\":\"boostingAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"additionalData\",\"type\":\"bytes\"}],\"internalType\":\"struct DistributionParameters\",\"name\":\"base\",\"type\":\"tuple\"},{\"internalType\":\"uint24\",\"name\":\"poolFee\",\"type\":\"uint24\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"add\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"decimals\",\"type\":\"uint8\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"poolBalance\",\"type\":\"uint256\"}],\"internalType\":\"struct UniswapTokenData\",\"name\":\"token0\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"add\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"decimals\",\"type\":\"uint8\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"poolBalance\",\"type\":\"uint256\"}],\"internalType\":\"struct UniswapTokenData\",\"name\":\"token1\",\"type\":\"tuple\"},{\"internalType\":\"string\",\"name\":\"rewardTokenSymbol\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"rewardTokenDecimals\",\"type\":\"uint8\"}],\"internalType\":\"struct ExtensiveDistributionParameters[]\",\"name\":\"searchDistributions\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"uniV3Pool\",\"type\":\"address\"},{\"internalType\":\"uint32\",\"name\":\"skip\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"first\",\"type\":\"uint32\"}],\"name\":\"getActivePoolDistributions\",\"outputs\":[{\"components\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"rewardId\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"uniV3Pool\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"rewardToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"positionWrappers\",\"type\":\"address[]\"},{\"internalType\":\"uint32[]\",\"name\":\"wrapperTypes\",\"type\":\"uint32[]\"},{\"internalType\":\"uint32\",\"name\":\"propToken0\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propToken1\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propFees\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"epochStart\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"numEpoch\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"isOutOfRangeIncentivized\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"boostedReward\",\"type\":\"uint32\"},{\"internalType\":\"address\",\"name\":\"boostingAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"additionalData\",\"type\":\"bytes\"}],\"internalType\":\"struct DistributionParameters\",\"name\":\"base\",\"type\":\"tuple\"},{\"internalType\":\"uint24\",\"name\":\"poolFee\",\"type\":\"uint24\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"add\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"decimals\",\"type\":\"uint8\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"poolBalance\",\"type\":\"uint256\"}],\"internalType\":\"struct UniswapTokenData\",\"name\":\"token0\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"add\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"decimals\",\"type\":\"uint8\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"poolBalance\",\"type\":\"uint256\"}],\"internalType\":\"struct UniswapTokenData\",\"name\":\"token1\",\"type\":\"tuple\"},{\"internalType\":\"string\",\"name\":\"rewardTokenSymbol\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"rewardTokenDecimals\",\"type\":\"uint8\"}],\"internalType\":\"struct ExtensiveDistributionParameters[]\",\"name\":\"\",\"type\":\"tuple[]\"},{\"internalType\":\"uint256\",\"name\":\"lastIndexDistribution\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getAllDistributions\",\"outputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"rewardId\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"uniV3Pool\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"rewardToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"positionWrappers\",\"type\":\"address[]\"},{\"internalType\":\"uint32[]\",\"name\":\"wrapperTypes\",\"type\":\"uint32[]\"},{\"internalType\":\"uint32\",\"name\":\"propToken0\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propToken1\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propFees\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"epochStart\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"numEpoch\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"isOutOfRangeIncentivized\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"boostedReward\",\"type\":\"uint32\"},{\"internalType\":\"address\",\"name\":\"boostingAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"additionalData\",\"type\":\"bytes\"}],\"internalType\":\"struct DistributionParameters[]\",\"name\":\"\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"epochStart\",\"type\":\"uint32\"}],\"name\":\"getDistributionsAfterEpoch\",\"outputs\":[{\"components\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"rewardId\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"uniV3Pool\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"rewardToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"positionWrappers\",\"type\":\"address[]\"},{\"internalType\":\"uint32[]\",\"name\":\"wrapperTypes\",\"type\":\"uint32[]\"},{\"internalType\":\"uint32\",\"name\":\"propToken0\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propToken1\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propFees\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"epochStart\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"numEpoch\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"isOutOfRangeIncentivized\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"boostedReward\",\"type\":\"uint32\"},{\"internalType\":\"address\",\"name\":\"boostingAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"additionalData\",\"type\":\"bytes\"}],\"internalType\":\"struct DistributionParameters\",\"name\":\"base\",\"type\":\"tuple\"},{\"internalType\":\"uint24\",\"name\":\"poolFee\",\"type\":\"uint24\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"add\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"decimals\",\"type\":\"uint8\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"poolBalance\",\"type\":\"uint256\"}],\"internalType\":\"struct UniswapTokenData\",\"name\":\"token0\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"add\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"decimals\",\"type\":\"uint8\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"poolBalance\",\"type\":\"uint256\"}],\"internalType\":\"struct UniswapTokenData\",\"name\":\"token1\",\"type\":\"tuple\"},{\"internalType\":\"string\",\"name\":\"rewardTokenSymbol\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"rewardTokenDecimals\",\"type\":\"uint8\"}],\"internalType\":\"struct ExtensiveDistributionParameters[]\",\"name\":\"searchDistributions\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"epochStart\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"skip\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"first\",\"type\":\"uint32\"}],\"name\":\"getDistributionsAfterEpoch\",\"outputs\":[{\"components\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"rewardId\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"uniV3Pool\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"rewardToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"positionWrappers\",\"type\":\"address[]\"},{\"internalType\":\"uint32[]\",\"name\":\"wrapperTypes\",\"type\":\"uint32[]\"},{\"internalType\":\"uint32\",\"name\":\"propToken0\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propToken1\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propFees\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"epochStart\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"numEpoch\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"isOutOfRangeIncentivized\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"boostedReward\",\"type\":\"uint32\"},{\"internalType\":\"address\",\"name\":\"boostingAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"additionalData\",\"type\":\"bytes\"}],\"internalType\":\"struct DistributionParameters\",\"name\":\"base\",\"type\":\"tuple\"},{\"internalType\":\"uint24\",\"name\":\"poolFee\",\"type\":\"uint24\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"add\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"decimals\",\"type\":\"uint8\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"poolBalance\",\"type\":\"uint256\"}],\"internalType\":\"struct UniswapTokenData\",\"name\":\"token0\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"add\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"decimals\",\"type\":\"uint8\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"poolBalance\",\"type\":\"uint256\"}],\"internalType\":\"struct UniswapTokenData\",\"name\":\"token1\",\"type\":\"tuple\"},{\"internalType\":\"string\",\"name\":\"rewardTokenSymbol\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"rewardTokenDecimals\",\"type\":\"uint8\"}],\"internalType\":\"struct ExtensiveDistributionParameters[]\",\"name\":\"\",\"type\":\"tuple[]\"},{\"internalType\":\"uint256\",\"name\":\"lastIndexDistribution\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"epochStart\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"epochEnd\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"skip\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"first\",\"type\":\"uint32\"}],\"name\":\"getDistributionsBetweenEpochs\",\"outputs\":[{\"components\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"rewardId\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"uniV3Pool\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"rewardToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"positionWrappers\",\"type\":\"address[]\"},{\"internalType\":\"uint32[]\",\"name\":\"wrapperTypes\",\"type\":\"uint32[]\"},{\"internalType\":\"uint32\",\"name\":\"propToken0\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propToken1\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propFees\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"epochStart\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"numEpoch\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"isOutOfRangeIncentivized\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"boostedReward\",\"type\":\"uint32\"},{\"internalType\":\"address\",\"name\":\"boostingAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"additionalData\",\"type\":\"bytes\"}],\"internalType\":\"struct DistributionParameters\",\"name\":\"base\",\"type\":\"tuple\"},{\"internalType\":\"uint24\",\"name\":\"poolFee\",\"type\":\"uint24\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"add\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"decimals\",\"type\":\"uint8\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"poolBalance\",\"type\":\"uint256\"}],\"internalType\":\"struct UniswapTokenData\",\"name\":\"token0\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"add\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"decimals\",\"type\":\"uint8\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"poolBalance\",\"type\":\"uint256\"}],\"internalType\":\"struct UniswapTokenData\",\"name\":\"token1\",\"type\":\"tuple\"},{\"internalType\":\"string\",\"name\":\"rewardTokenSymbol\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"rewardTokenDecimals\",\"type\":\"uint8\"}],\"internalType\":\"struct ExtensiveDistributionParameters[]\",\"name\":\"\",\"type\":\"tuple[]\"},{\"internalType\":\"uint256\",\"name\":\"lastIndexDistribution\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"epochStart\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"epochEnd\",\"type\":\"uint32\"}],\"name\":\"getDistributionsBetweenEpochs\",\"outputs\":[{\"components\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"rewardId\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"uniV3Pool\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"rewardToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"positionWrappers\",\"type\":\"address[]\"},{\"internalType\":\"uint32[]\",\"name\":\"wrapperTypes\",\"type\":\"uint32[]\"},{\"internalType\":\"uint32\",\"name\":\"propToken0\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propToken1\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propFees\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"epochStart\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"numEpoch\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"isOutOfRangeIncentivized\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"boostedReward\",\"type\":\"uint32\"},{\"internalType\":\"address\",\"name\":\"boostingAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"additionalData\",\"type\":\"bytes\"}],\"internalType\":\"struct DistributionParameters\",\"name\":\"base\",\"type\":\"tuple\"},{\"internalType\":\"uint24\",\"name\":\"poolFee\",\"type\":\"uint24\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"add\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"decimals\",\"type\":\"uint8\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"poolBalance\",\"type\":\"uint256\"}],\"internalType\":\"struct UniswapTokenData\",\"name\":\"token0\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"add\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"decimals\",\"type\":\"uint8\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"poolBalance\",\"type\":\"uint256\"}],\"internalType\":\"struct UniswapTokenData\",\"name\":\"token1\",\"type\":\"tuple\"},{\"internalType\":\"string\",\"name\":\"rewardTokenSymbol\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"rewardTokenDecimals\",\"type\":\"uint8\"}],\"internalType\":\"struct ExtensiveDistributionParameters[]\",\"name\":\"searchDistributions\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"epoch\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"skip\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"first\",\"type\":\"uint32\"}],\"name\":\"getDistributionsForEpoch\",\"outputs\":[{\"components\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"rewardId\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"uniV3Pool\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"rewardToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"positionWrappers\",\"type\":\"address[]\"},{\"internalType\":\"uint32[]\",\"name\":\"wrapperTypes\",\"type\":\"uint32[]\"},{\"internalType\":\"uint32\",\"name\":\"propToken0\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propToken1\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propFees\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"epochStart\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"numEpoch\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"isOutOfRangeIncentivized\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"boostedReward\",\"type\":\"uint32\"},{\"internalType\":\"address\",\"name\":\"boostingAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"additionalData\",\"type\":\"bytes\"}],\"internalType\":\"struct DistributionParameters\",\"name\":\"base\",\"type\":\"tuple\"},{\"internalType\":\"uint24\",\"name\":\"poolFee\",\"type\":\"uint24\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"add\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"decimals\",\"type\":\"uint8\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"poolBalance\",\"type\":\"uint256\"}],\"internalType\":\"struct UniswapTokenData\",\"name\":\"token0\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"add\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"decimals\",\"type\":\"uint8\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"poolBalance\",\"type\":\"uint256\"}],\"internalType\":\"struct UniswapTokenData\",\"name\":\"token1\",\"type\":\"tuple\"},{\"internalType\":\"string\",\"name\":\"rewardTokenSymbol\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"rewardTokenDecimals\",\"type\":\"uint8\"}],\"internalType\":\"struct ExtensiveDistributionParameters[]\",\"name\":\"\",\"type\":\"tuple[]\"},{\"internalType\":\"uint256\",\"name\":\"lastIndexDistribution\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"epoch\",\"type\":\"uint32\"}],\"name\":\"getDistributionsForEpoch\",\"outputs\":[{\"components\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"rewardId\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"uniV3Pool\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"rewardToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"positionWrappers\",\"type\":\"address[]\"},{\"internalType\":\"uint32[]\",\"name\":\"wrapperTypes\",\"type\":\"uint32[]\"},{\"internalType\":\"uint32\",\"name\":\"propToken0\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propToken1\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propFees\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"epochStart\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"numEpoch\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"isOutOfRangeIncentivized\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"boostedReward\",\"type\":\"uint32\"},{\"internalType\":\"address\",\"name\":\"boostingAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"additionalData\",\"type\":\"bytes\"}],\"internalType\":\"struct DistributionParameters\",\"name\":\"base\",\"type\":\"tuple\"},{\"internalType\":\"uint24\",\"name\":\"poolFee\",\"type\":\"uint24\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"add\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"decimals\",\"type\":\"uint8\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"poolBalance\",\"type\":\"uint256\"}],\"internalType\":\"struct UniswapTokenData\",\"name\":\"token0\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"add\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"decimals\",\"type\":\"uint8\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"poolBalance\",\"type\":\"uint256\"}],\"internalType\":\"struct UniswapTokenData\",\"name\":\"token1\",\"type\":\"tuple\"},{\"internalType\":\"string\",\"name\":\"rewardTokenSymbol\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"rewardTokenDecimals\",\"type\":\"uint8\"}],\"internalType\":\"struct ExtensiveDistributionParameters[]\",\"name\":\"searchDistributions\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"rewardId\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"uniV3Pool\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"rewardToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"positionWrappers\",\"type\":\"address[]\"},{\"internalType\":\"uint32[]\",\"name\":\"wrapperTypes\",\"type\":\"uint32[]\"},{\"internalType\":\"uint32\",\"name\":\"propToken0\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propToken1\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propFees\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"epochStart\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"numEpoch\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"isOutOfRangeIncentivized\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"boostedReward\",\"type\":\"uint32\"},{\"internalType\":\"address\",\"name\":\"boostingAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"additionalData\",\"type\":\"bytes\"}],\"internalType\":\"struct DistributionParameters\",\"name\":\"distribution\",\"type\":\"tuple\"}],\"name\":\"getExtensiveDistributionParameters\",\"outputs\":[{\"components\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"rewardId\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"uniV3Pool\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"rewardToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"positionWrappers\",\"type\":\"address[]\"},{\"internalType\":\"uint32[]\",\"name\":\"wrapperTypes\",\"type\":\"uint32[]\"},{\"internalType\":\"uint32\",\"name\":\"propToken0\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propToken1\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propFees\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"epochStart\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"numEpoch\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"isOutOfRangeIncentivized\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"boostedReward\",\"type\":\"uint32\"},{\"internalType\":\"address\",\"name\":\"boostingAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"additionalData\",\"type\":\"bytes\"}],\"internalType\":\"struct DistributionParameters\",\"name\":\"base\",\"type\":\"tuple\"},{\"internalType\":\"uint24\",\"name\":\"poolFee\",\"type\":\"uint24\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"add\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"decimals\",\"type\":\"uint8\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"poolBalance\",\"type\":\"uint256\"}],\"internalType\":\"struct UniswapTokenData\",\"name\":\"token0\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"add\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"decimals\",\"type\":\"uint8\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"poolBalance\",\"type\":\"uint256\"}],\"internalType\":\"struct UniswapTokenData\",\"name\":\"token1\",\"type\":\"tuple\"},{\"internalType\":\"string\",\"name\":\"rewardTokenSymbol\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"rewardTokenDecimals\",\"type\":\"uint8\"}],\"internalType\":\"struct ExtensiveDistributionParameters\",\"name\":\"extensiveParams\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"uniV3Pool\",\"type\":\"address\"},{\"internalType\":\"uint32\",\"name\":\"epochStart\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"skip\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"first\",\"type\":\"uint32\"}],\"name\":\"getPoolDistributionsAfterEpoch\",\"outputs\":[{\"components\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"rewardId\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"uniV3Pool\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"rewardToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"positionWrappers\",\"type\":\"address[]\"},{\"internalType\":\"uint32[]\",\"name\":\"wrapperTypes\",\"type\":\"uint32[]\"},{\"internalType\":\"uint32\",\"name\":\"propToken0\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propToken1\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propFees\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"epochStart\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"numEpoch\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"isOutOfRangeIncentivized\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"boostedReward\",\"type\":\"uint32\"},{\"internalType\":\"address\",\"name\":\"boostingAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"additionalData\",\"type\":\"bytes\"}],\"internalType\":\"struct DistributionParameters\",\"name\":\"base\",\"type\":\"tuple\"},{\"internalType\":\"uint24\",\"name\":\"poolFee\",\"type\":\"uint24\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"add\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"decimals\",\"type\":\"uint8\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"poolBalance\",\"type\":\"uint256\"}],\"internalType\":\"struct UniswapTokenData\",\"name\":\"token0\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"add\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"decimals\",\"type\":\"uint8\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"poolBalance\",\"type\":\"uint256\"}],\"internalType\":\"struct UniswapTokenData\",\"name\":\"token1\",\"type\":\"tuple\"},{\"internalType\":\"string\",\"name\":\"rewardTokenSymbol\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"rewardTokenDecimals\",\"type\":\"uint8\"}],\"internalType\":\"struct ExtensiveDistributionParameters[]\",\"name\":\"\",\"type\":\"tuple[]\"},{\"internalType\":\"uint256\",\"name\":\"lastIndexDistribution\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"uniV3Pool\",\"type\":\"address\"},{\"internalType\":\"uint32\",\"name\":\"epochStart\",\"type\":\"uint32\"}],\"name\":\"getPoolDistributionsAfterEpoch\",\"outputs\":[{\"components\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"rewardId\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"uniV3Pool\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"rewardToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"positionWrappers\",\"type\":\"address[]\"},{\"internalType\":\"uint32[]\",\"name\":\"wrapperTypes\",\"type\":\"uint32[]\"},{\"internalType\":\"uint32\",\"name\":\"propToken0\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propToken1\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propFees\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"epochStart\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"numEpoch\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"isOutOfRangeIncentivized\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"boostedReward\",\"type\":\"uint32\"},{\"internalType\":\"address\",\"name\":\"boostingAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"additionalData\",\"type\":\"bytes\"}],\"internalType\":\"struct DistributionParameters\",\"name\":\"base\",\"type\":\"tuple\"},{\"internalType\":\"uint24\",\"name\":\"poolFee\",\"type\":\"uint24\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"add\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"decimals\",\"type\":\"uint8\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"poolBalance\",\"type\":\"uint256\"}],\"internalType\":\"struct UniswapTokenData\",\"name\":\"token0\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"add\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"decimals\",\"type\":\"uint8\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"poolBalance\",\"type\":\"uint256\"}],\"internalType\":\"struct UniswapTokenData\",\"name\":\"token1\",\"type\":\"tuple\"},{\"internalType\":\"string\",\"name\":\"rewardTokenSymbol\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"rewardTokenDecimals\",\"type\":\"uint8\"}],\"internalType\":\"struct ExtensiveDistributionParameters[]\",\"name\":\"searchDistributions\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"uniV3Pool\",\"type\":\"address\"},{\"internalType\":\"uint32\",\"name\":\"epochStart\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"epochEnd\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"skip\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"first\",\"type\":\"uint32\"}],\"name\":\"getPoolDistributionsBetweenEpochs\",\"outputs\":[{\"components\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"rewardId\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"uniV3Pool\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"rewardToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"positionWrappers\",\"type\":\"address[]\"},{\"internalType\":\"uint32[]\",\"name\":\"wrapperTypes\",\"type\":\"uint32[]\"},{\"internalType\":\"uint32\",\"name\":\"propToken0\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propToken1\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propFees\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"epochStart\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"numEpoch\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"isOutOfRangeIncentivized\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"boostedReward\",\"type\":\"uint32\"},{\"internalType\":\"address\",\"name\":\"boostingAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"additionalData\",\"type\":\"bytes\"}],\"internalType\":\"struct DistributionParameters\",\"name\":\"base\",\"type\":\"tuple\"},{\"internalType\":\"uint24\",\"name\":\"poolFee\",\"type\":\"uint24\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"add\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"decimals\",\"type\":\"uint8\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"poolBalance\",\"type\":\"uint256\"}],\"internalType\":\"struct UniswapTokenData\",\"name\":\"token0\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"add\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"decimals\",\"type\":\"uint8\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"poolBalance\",\"type\":\"uint256\"}],\"internalType\":\"struct UniswapTokenData\",\"name\":\"token1\",\"type\":\"tuple\"},{\"internalType\":\"string\",\"name\":\"rewardTokenSymbol\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"rewardTokenDecimals\",\"type\":\"uint8\"}],\"internalType\":\"struct ExtensiveDistributionParameters[]\",\"name\":\"\",\"type\":\"tuple[]\"},{\"internalType\":\"uint256\",\"name\":\"lastIndexDistribution\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"uniV3Pool\",\"type\":\"address\"},{\"internalType\":\"uint32\",\"name\":\"epochStart\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"epochEnd\",\"type\":\"uint32\"}],\"name\":\"getPoolDistributionsBetweenEpochs\",\"outputs\":[{\"components\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"rewardId\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"uniV3Pool\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"rewardToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"positionWrappers\",\"type\":\"address[]\"},{\"internalType\":\"uint32[]\",\"name\":\"wrapperTypes\",\"type\":\"uint32[]\"},{\"internalType\":\"uint32\",\"name\":\"propToken0\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propToken1\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propFees\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"epochStart\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"numEpoch\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"isOutOfRangeIncentivized\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"boostedReward\",\"type\":\"uint32\"},{\"internalType\":\"address\",\"name\":\"boostingAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"additionalData\",\"type\":\"bytes\"}],\"internalType\":\"struct DistributionParameters\",\"name\":\"base\",\"type\":\"tuple\"},{\"internalType\":\"uint24\",\"name\":\"poolFee\",\"type\":\"uint24\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"add\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"decimals\",\"type\":\"uint8\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"poolBalance\",\"type\":\"uint256\"}],\"internalType\":\"struct UniswapTokenData\",\"name\":\"token0\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"add\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"decimals\",\"type\":\"uint8\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"poolBalance\",\"type\":\"uint256\"}],\"internalType\":\"struct UniswapTokenData\",\"name\":\"token1\",\"type\":\"tuple\"},{\"internalType\":\"string\",\"name\":\"rewardTokenSymbol\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"rewardTokenDecimals\",\"type\":\"uint8\"}],\"internalType\":\"struct ExtensiveDistributionParameters[]\",\"name\":\"searchDistributions\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"uniV3Pool\",\"type\":\"address\"},{\"internalType\":\"uint32\",\"name\":\"epoch\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"skip\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"first\",\"type\":\"uint32\"}],\"name\":\"getPoolDistributionsForEpoch\",\"outputs\":[{\"components\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"rewardId\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"uniV3Pool\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"rewardToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"positionWrappers\",\"type\":\"address[]\"},{\"internalType\":\"uint32[]\",\"name\":\"wrapperTypes\",\"type\":\"uint32[]\"},{\"internalType\":\"uint32\",\"name\":\"propToken0\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propToken1\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propFees\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"epochStart\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"numEpoch\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"isOutOfRangeIncentivized\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"boostedReward\",\"type\":\"uint32\"},{\"internalType\":\"address\",\"name\":\"boostingAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"additionalData\",\"type\":\"bytes\"}],\"internalType\":\"struct DistributionParameters\",\"name\":\"base\",\"type\":\"tuple\"},{\"internalType\":\"uint24\",\"name\":\"poolFee\",\"type\":\"uint24\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"add\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"decimals\",\"type\":\"uint8\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"poolBalance\",\"type\":\"uint256\"}],\"internalType\":\"struct UniswapTokenData\",\"name\":\"token0\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"add\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"decimals\",\"type\":\"uint8\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"poolBalance\",\"type\":\"uint256\"}],\"internalType\":\"struct UniswapTokenData\",\"name\":\"token1\",\"type\":\"tuple\"},{\"internalType\":\"string\",\"name\":\"rewardTokenSymbol\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"rewardTokenDecimals\",\"type\":\"uint8\"}],\"internalType\":\"struct ExtensiveDistributionParameters[]\",\"name\":\"\",\"type\":\"tuple[]\"},{\"internalType\":\"uint256\",\"name\":\"lastIndexDistribution\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"uniV3Pool\",\"type\":\"address\"},{\"internalType\":\"uint32\",\"name\":\"epoch\",\"type\":\"uint32\"}],\"name\":\"getPoolDistributionsForEpoch\",\"outputs\":[{\"components\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"rewardId\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"uniV3Pool\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"rewardToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"positionWrappers\",\"type\":\"address[]\"},{\"internalType\":\"uint32[]\",\"name\":\"wrapperTypes\",\"type\":\"uint32[]\"},{\"internalType\":\"uint32\",\"name\":\"propToken0\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propToken1\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propFees\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"epochStart\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"numEpoch\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"isOutOfRangeIncentivized\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"boostedReward\",\"type\":\"uint32\"},{\"internalType\":\"address\",\"name\":\"boostingAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"additionalData\",\"type\":\"bytes\"}],\"internalType\":\"struct DistributionParameters\",\"name\":\"base\",\"type\":\"tuple\"},{\"internalType\":\"uint24\",\"name\":\"poolFee\",\"type\":\"uint24\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"add\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"decimals\",\"type\":\"uint8\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"poolBalance\",\"type\":\"uint256\"}],\"internalType\":\"struct UniswapTokenData\",\"name\":\"token0\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"add\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"decimals\",\"type\":\"uint8\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"poolBalance\",\"type\":\"uint256\"}],\"internalType\":\"struct UniswapTokenData\",\"name\":\"token1\",\"type\":\"tuple\"},{\"internalType\":\"string\",\"name\":\"rewardTokenSymbol\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"rewardTokenDecimals\",\"type\":\"uint8\"}],\"internalType\":\"struct ExtensiveDistributionParameters[]\",\"name\":\"searchDistributions\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getValidRewardTokens\",\"outputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"minimumAmountPerEpoch\",\"type\":\"uint256\"}],\"internalType\":\"struct RewardTokenAmounts[]\",\"name\":\"\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract ICore\",\"name\":\"_core\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_distributor\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_fees\",\"type\":\"uint256\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"isWhitelistedToken\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"message\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"messageHash\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"nonces\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"proxiableUUID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract IERC20[]\",\"name\":\"tokens\",\"type\":\"address[]\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"}],\"name\":\"recoverFees\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"rewardTokenMinAmounts\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"rewardTokens\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_feeRecipient\",\"type\":\"address\"}],\"name\":\"setFeeRecipient\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_fees\",\"type\":\"uint256\"}],\"name\":\"setFees\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_message\",\"type\":\"string\"}],\"name\":\"setMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_distributor\",\"type\":\"address\"}],\"name\":\"setNewDistributor\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"tokens\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"}],\"name\":\"setRewardTokenMinAmounts\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"userFeeRebate\",\"type\":\"uint256\"}],\"name\":\"setUserFeeRebate\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"signature\",\"type\":\"bytes\"}],\"name\":\"sign\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"rewardId\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"uniV3Pool\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"rewardToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"positionWrappers\",\"type\":\"address[]\"},{\"internalType\":\"uint32[]\",\"name\":\"wrapperTypes\",\"type\":\"uint32[]\"},{\"internalType\":\"uint32\",\"name\":\"propToken0\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propToken1\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propFees\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"epochStart\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"numEpoch\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"isOutOfRangeIncentivized\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"boostedReward\",\"type\":\"uint32\"},{\"internalType\":\"address\",\"name\":\"boostingAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"additionalData\",\"type\":\"bytes\"}],\"internalType\":\"struct DistributionParameters\",\"name\":\"distribution\",\"type\":\"tuple\"},{\"internalType\":\"bytes\",\"name\":\"signature\",\"type\":\"bytes\"}],\"name\":\"signAndCreateDistribution\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"distributionAmount\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"}],\"name\":\"toggleSigningWhitelist\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"}],\"name\":\"toggleTokenWhitelist\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"rewardId\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"uniV3Pool\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"rewardToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"positionWrappers\",\"type\":\"address[]\"},{\"internalType\":\"uint32[]\",\"name\":\"wrapperTypes\",\"type\":\"uint32[]\"},{\"internalType\":\"uint32\",\"name\":\"propToken0\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propToken1\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propFees\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"epochStart\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"numEpoch\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"isOutOfRangeIncentivized\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"boostedReward\",\"type\":\"uint32\"},{\"internalType\":\"address\",\"name\":\"boostingAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"additionalData\",\"type\":\"bytes\"}],\"internalType\":\"struct DistributionParameters\",\"name\":\"distribution\",\"type\":\"tuple\"}],\"name\":\"tryGetExtensiveDistributionParameters\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"success\",\"type\":\"bool\"},{\"components\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"rewardId\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"uniV3Pool\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"rewardToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"positionWrappers\",\"type\":\"address[]\"},{\"internalType\":\"uint32[]\",\"name\":\"wrapperTypes\",\"type\":\"uint32[]\"},{\"internalType\":\"uint32\",\"name\":\"propToken0\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propToken1\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"propFees\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"epochStart\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"numEpoch\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"isOutOfRangeIncentivized\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"boostedReward\",\"type\":\"uint32\"},{\"internalType\":\"address\",\"name\":\"boostingAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"additionalData\",\"type\":\"bytes\"}],\"internalType\":\"struct DistributionParameters\",\"name\":\"base\",\"type\":\"tuple\"},{\"internalType\":\"uint24\",\"name\":\"poolFee\",\"type\":\"uint24\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"add\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"decimals\",\"type\":\"uint8\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"poolBalance\",\"type\":\"uint256\"}],\"internalType\":\"struct UniswapTokenData\",\"name\":\"token0\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"add\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"decimals\",\"type\":\"uint8\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"poolBalance\",\"type\":\"uint256\"}],\"internalType\":\"struct UniswapTokenData\",\"name\":\"token1\",\"type\":\"tuple\"},{\"internalType\":\"string\",\"name\":\"rewardTokenSymbol\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"rewardTokenDecimals\",\"type\":\"uint8\"}],\"internalType\":\"struct ExtensiveDistributionParameters\",\"name\":\"extensiveParams\",\"type\":\"tuple\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"}],\"name\":\"upgradeTo\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"upgradeToAndCall\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"userSignatureWhitelist\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"userSignatures\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"author\":\"Angle Labs, Inc.\",\"details\":\"This contract is mostly a helper for APIs built on top of MerklPeople depositing rewards must have signed a `message` with the conditions for using the product\",\"kind\":\"dev\",\"methods\":{\"createDistribution((bytes32,address,address,uint256,address[],uint32[],uint32,uint32,uint32,uint32,uint32,uint32,uint32,address,bytes))\":{\"details\":\"If the address specified as a UniV3 pool is not effectively a pool, it will not be handled by the distribution script and rewards may be lostReward tokens sent as part of distributions must have been whitelisted before and amounts sent should be bigger than a minimum amount specific to each tokenThe `positionWrappers` specified in the `distribution` struct need to be supported by the script List of supported `positionWrappers` can be found in the docs.If the pool incentivized contains one whitelisted token, then no fees are taken on the rewardsThis function reverts if the sender has not signed the message `messageHash` once through one of the functions enabling to sign\",\"returns\":{\"distributionAmount\":\"How many reward tokens are actually taken into consideration in the contract\"}},\"createDistributions((bytes32,address,address,uint256,address[],uint32[],uint32,uint32,uint32,uint32,uint32,uint32,uint32,address,bytes)[])\":{\"returns\":{\"_0\":\"List of all the distribution amounts actually deposited for each `distribution` in the `distributions` list\"}},\"getActiveDistributions(uint32,uint32)\":{\"params\":{\"first\":\"Limit the length of the returned array to `first`\",\"skip\":\"Disregard distibutions with a global index lower than `skip`\"},\"returns\":{\"lastIndexDistribution\":\"Index of the last distribution assessed in the list of all distributions For pagniation purpose, in case of out of gas, you can call back the same function but with `skip` set to `lastIndexDistribution`\",\"searchDistributions\":\"Eligible distributions\"}},\"getActivePoolDistributions(address,uint32,uint32)\":{\"params\":{\"first\":\"Limit the length of the returned array to `first`\",\"skip\":\"Disregard distibutions with a global index lower than `skip`\"},\"returns\":{\"_0\":\"searchDistributions Eligible distributions\",\"lastIndexDistribution\":\"Index of the last distribution assessed in the list of all distributions For pagniation purpose, in case of out of gas, you can call back the same function but with `skip` set to `lastIndexDistribution`\"}},\"getDistributionsAfterEpoch(uint32,uint32,uint32)\":{\"params\":{\"first\":\"Limit the length of the returned array to `first`\",\"skip\":\"Disregard distibutions with a global index lower than `skip`\"},\"returns\":{\"_0\":\"searchDistributions Eligible distributions\",\"lastIndexDistribution\":\"Index of the last distribution assessed in the list of all distributions For pagniation purpose, in case of out of gas, you can call back the same function but with `skip` set to `lastIndexDistribution`\"}},\"getDistributionsBetweenEpochs(uint32,uint32)\":{\"details\":\"If a distribution starts during `epochEnd`, it is not be returned by this functionConversely, if a distribution starts after `epochStart` and ends before `epochEnd`, it is returned by this function\"},\"getDistributionsBetweenEpochs(uint32,uint32,uint32,uint32)\":{\"params\":{\"first\":\"Limit the length of the returned array to `first`\",\"skip\":\"Disregard distibutions with a global index lower than `skip`\"},\"returns\":{\"_0\":\"searchDistributions Eligible distributions\",\"lastIndexDistribution\":\"Index of the last distribution assessed in the list of all distributions For pagniation purpose, in case of out of gas, you can call back the same function but with `skip` set to `lastIndexDistribution`\"}},\"getDistributionsForEpoch(uint32,uint32,uint32)\":{\"params\":{\"first\":\"Limit the length of the returned array to `first`\",\"skip\":\"Disregard distibutions with a global index lower than `skip`\"},\"returns\":{\"_0\":\"searchDistributions Eligible distributions\",\"lastIndexDistribution\":\"Index of the last distribution assessed in the list of all distributions For pagniation purpose, in case of out of gas, you can call back the same function but with `skip` set to `lastIndexDistribution`\"}},\"getPoolDistributionsAfterEpoch(address,uint32,uint32,uint32)\":{\"params\":{\"first\":\"Limit the length of the returned array to `first`\",\"skip\":\"Disregard distibutions with a global index lower than `skip`\"},\"returns\":{\"_0\":\"searchDistributions Eligible distributions\",\"lastIndexDistribution\":\"Index of the last distribution assessed in the list of all distributions For pagniation purpose, in case of out of gas, you can call back the same function but with `skip` set to `lastIndexDistribution`\"}},\"getPoolDistributionsBetweenEpochs(address,uint32,uint32,uint32,uint32)\":{\"params\":{\"first\":\"Limit the length of the returned array to `first`\",\"skip\":\"Disregard distibutions with a global index lower than `skip`\"},\"returns\":{\"_0\":\"searchDistributions Eligible distributions\",\"lastIndexDistribution\":\"Index of the last distribution assessed in the list of all distributions For pagniation purpose, in case of out of gas, you can call back the same function but with `skip` set to `lastIndexDistribution`\"}},\"getPoolDistributionsForEpoch(address,uint32,uint32,uint32)\":{\"params\":{\"first\":\"Limit the length of the returned array to `first`\",\"skip\":\"Disregard distibutions with a global index lower than `skip`\"},\"returns\":{\"_0\":\"searchDistributions Eligible distributions\",\"lastIndexDistribution\":\"Index of the last distribution assessed in the list of all distributions For pagniation purpose, in case of out of gas, you can call back the same function but with `skip` set to `lastIndexDistribution`\"}},\"proxiableUUID()\":{\"details\":\"Implementation of the ERC1822 {proxiableUUID} function. This returns the storage slot used by the implementation. It is used to validate the implementation's compatibility when performing an upgrade. IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this function revert if invoked through a proxy. This is guaranteed by the `notDelegated` modifier.\"},\"sign(bytes)\":{\"details\":\"If you signed the message once, and the message has not been modified, then you do not need to sign again\"},\"upgradeTo(address)\":{\"details\":\"Upgrade the implementation of the proxy to `newImplementation`. Calls {_authorizeUpgrade}. Emits an {Upgraded} event.\"},\"upgradeToAndCall(address,bytes)\":{\"details\":\"Upgrade the implementation of the proxy to `newImplementation`, and subsequently execute the function call encoded in `data`. Calls {_authorizeUpgrade}. Emits an {Upgraded} event.\"}},\"stateVariables\":{\"distributionList\":{\"details\":\"An attacker could try to populate this list. It shouldn't be an issue as only view functions iterate on it\"},\"rewardTokenMinAmounts\":{\"details\":\"If `rewardTokenMinAmounts[token] == 0`, then `token` cannot be used as a reward\"}},\"title\":\"DistributionCreator\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"BASE_9()\":{\"notice\":\"Base for fee computation\"},\"EPOCH_DURATION()\":{\"notice\":\"Epoch duration\"},\"core()\":{\"notice\":\"`Core` contract handling access control\"},\"createDistribution((bytes32,address,address,uint256,address[],uint32[],uint32,uint32,uint32,uint32,uint32,uint32,uint32,address,bytes))\":{\"notice\":\"Creates a `distribution` to incentivize a given pool for a specific period of time\"},\"createDistributions((bytes32,address,address,uint256,address[],uint32[],uint32,uint32,uint32,uint32,uint32,uint32,uint32,address,bytes)[])\":{\"notice\":\"Same as the function above but for multiple distributions at once\"},\"distributionList(uint256)\":{\"notice\":\"List of all rewards ever distributed or to be distributed in the contract\"},\"distributor()\":{\"notice\":\"User contract for distributing rewards\"},\"feeRebate(address)\":{\"notice\":\"Maps an address to its fee rebate\"},\"feeRecipient()\":{\"notice\":\"Address to which fees are forwarded\"},\"fees()\":{\"notice\":\"Value (in base 10**9) of the fees taken when creating a distribution for a pool which do not have a whitelisted token in it\"},\"getActiveDistributions()\":{\"notice\":\"Returns the list of all currently active distributions on pools of supported AMMs (like Uniswap V3)\"},\"getActiveDistributions(uint32,uint32)\":{\"notice\":\"Similar to `getActiveDistributions()` with additional parameters to prevent out of gas error\"},\"getActivePoolDistributions(address)\":{\"notice\":\"Returns the list of all currently active distributions for a specific UniswapV3 pool\"},\"getActivePoolDistributions(address,uint32,uint32)\":{\"notice\":\"Similar to `getActivePoolDistributions(address uniV3Pool)` with additional parameters to prevent out of gas error\"},\"getAllDistributions()\":{\"notice\":\"Returns the list of all distributions ever made or to be done in the future\"},\"getDistributionsAfterEpoch(uint32)\":{\"notice\":\"Returns the list of all distributions that were or will be live after `epochStart` (included)\"},\"getDistributionsAfterEpoch(uint32,uint32,uint32)\":{\"notice\":\"Similar to `getDistributionsAfterEpoch(uint256 epochStart)` with additional parameters to prevent out of gas error\"},\"getDistributionsBetweenEpochs(uint32,uint32)\":{\"notice\":\"Gets the distributions that were or will be live at some point between `epochStart` (included) and `epochEnd` (excluded)\"},\"getDistributionsBetweenEpochs(uint32,uint32,uint32,uint32)\":{\"notice\":\"Similar to `getDistributionsBetweenEpochs(uint256 epochStart, uint256 epochEnd)` with additional parameters to prevent out of gas error\"},\"getDistributionsForEpoch(uint32)\":{\"notice\":\"Returns the list of all the distributions that were or that are going to be live at a specific epoch\"},\"getDistributionsForEpoch(uint32,uint32,uint32)\":{\"notice\":\"Similar to `getDistributionsForEpoch(uint256 epoch)` with additional parameters to prevent out of gas error\"},\"getExtensiveDistributionParameters((bytes32,address,address,uint256,address[],uint32[],uint32,uint32,uint32,uint32,uint32,uint32,uint32,address,bytes))\":{\"notice\":\"Fetches extra data about the parameters in a distribution\"},\"getPoolDistributionsAfterEpoch(address,uint32)\":{\"notice\":\"Returns the list of all distributions that were or will be live after `epochStart` (included) for a specific pool\"},\"getPoolDistributionsAfterEpoch(address,uint32,uint32,uint32)\":{\"notice\":\"Similar to `getPoolDistributionsAfterEpoch(address uniV3Pool,uint32 epochStart)` with additional parameters to prevent out of gas error\"},\"getPoolDistributionsBetweenEpochs(address,uint32,uint32)\":{\"notice\":\"Returns the list of all distributions that were or will be live at some point between `epochStart` (included) and `epochEnd` (excluded) for a specific pool\"},\"getPoolDistributionsBetweenEpochs(address,uint32,uint32,uint32,uint32)\":{\"notice\":\"Similar to `getPoolDistributionsBetweenEpochs(address uniV3Pool,uint32 epochStart, uint32 epochEnd)` with additional parameters to prevent out of gas error\"},\"getPoolDistributionsForEpoch(address,uint32)\":{\"notice\":\"Returns the list of all the distributions that were or that are going to be live at a specific epoch and for a specific pool\"},\"getPoolDistributionsForEpoch(address,uint32,uint32,uint32)\":{\"notice\":\"Similar to `getPoolDistributionsForEpoch(address uniV3Pool,uint32 epoch)` with additional parameters to prevent out of gas error\"},\"getValidRewardTokens()\":{\"notice\":\"Returns the list of all the reward tokens supported as well as their minimum amounts\"},\"isWhitelistedToken(address)\":{\"notice\":\"Maps a token to whether it is whitelisted or not. No fees are to be paid for incentives given on pools with whitelisted tokens\"},\"message()\":{\"notice\":\"Message that needs to be acknowledged by users creating a distribution\"},\"messageHash()\":{\"notice\":\"Hash of the message that needs to be signed\"},\"nonces(address)\":{\"notice\":\"Maps an address to its nonce for creating a distribution\"},\"recoverFees(address[],address)\":{\"notice\":\"Recovers fees accrued on the contract for a list of `tokens`\"},\"rewardTokenMinAmounts(address)\":{\"notice\":\"Maps a token to the minimum amount that must be sent per epoch for a distribution to be valid\"},\"rewardTokens(uint256)\":{\"notice\":\"List of all reward tokens that have at some point been accepted\"},\"setFeeRecipient(address)\":{\"notice\":\"Sets a new address to receive fees\"},\"setFees(uint256)\":{\"notice\":\"Sets the fees on deposit\"},\"setMessage(string)\":{\"notice\":\"Sets the message that needs to be signed by users before posting rewards\"},\"setNewDistributor(address)\":{\"notice\":\"Sets a new `distributor` to which rewards should be distributed\"},\"setRewardTokenMinAmounts(address[],uint256[])\":{\"notice\":\"Sets the minimum amounts per distribution epoch for different reward tokens\"},\"setUserFeeRebate(address,uint256)\":{\"notice\":\"Sets fee rebates for a given user\"},\"sign(bytes)\":{\"notice\":\"Checks whether the `msg.sender`'s `signature` is compatible with the message to sign and stores the signature\"},\"signAndCreateDistribution((bytes32,address,address,uint256,address[],uint32[],uint32,uint32,uint32,uint32,uint32,uint32,uint32,address,bytes),bytes)\":{\"notice\":\"Combines signing the message and creating a distribution\"},\"toggleSigningWhitelist(address)\":{\"notice\":\"Toggles the whitelist status for `user` when it comes to signing messages before depositing rewards.\"},\"toggleTokenWhitelist(address)\":{\"notice\":\"Toggles the fee whitelist for `token`\"},\"tryGetExtensiveDistributionParameters((bytes32,address,address,uint256,address[],uint32[],uint32,uint32,uint32,uint32,uint32,uint32,uint32,address,bytes))\":{\"notice\":\"Tries to fetch extra data about the parameters in a distribution\"},\"userSignatureWhitelist(address)\":{\"notice\":\"Maps a user to whether it is whitelisted for not signing\"},\"userSignatures(address)\":{\"notice\":\"Maps an address to the last valid hash signed\"}},\"notice\":\"Manages the distribution of rewards across different pools with concentrated liquidity (like on Uniswap V3)\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/DistributionCreator.sol\":\"DistributionCreator\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":100},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts-upgradeable/interfaces/draft-IERC1822Upgradeable.sol\":{\"keccak256\":\"0x77c89f893e403efc6929ba842b7ccf6534d4ffe03afe31670b4a528c0ad78c0f\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://496bd9b3df2455d571018c09f0c6badd29713fdeb907c6aa09d8d28cb603f053\",\"dweb:/ipfs/QmXdJDyYs6WMwMh21dez2BYPxhSUaUYFMDtVNcn2cgFR79\"]},\"@openzeppelin/contracts-upgradeable/proxy/ERC1967/ERC1967UpgradeUpgradeable.sol\":{\"keccak256\":\"0x315887e846f1e5f8d8fa535a229d318bb9290aaa69485117f1ee8a9a6b3be823\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://29dda00da6d269685b555e710e4abf1c3eb6d00c15b888a7880a2f8dd3c4fdc2\",\"dweb:/ipfs/QmSqcjtdECygtT1Gy7uEo42x8542srpgGEeKKHfcnQqXgn\"]},\"@openzeppelin/contracts-upgradeable/proxy/beacon/IBeaconUpgradeable.sol\":{\"keccak256\":\"0x24b86ac8c005b8c654fbf6ac34a5a4f61580d7273541e83e013e89d66fbf0908\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://4dbfe1a3b3b3fb64294ce41fd2ad362e7b7012208117864f42c1a67620a6d5c1\",\"dweb:/ipfs/QmVMU5tWt7zBQMmf5cpMX8UMHV86T3kFeTxBTBjFqVWfoJ\"]},\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\":{\"keccak256\":\"0x037c334add4b033ad3493038c25be1682d78c00992e1acb0e2795caff3925271\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://8a313cf42389440e2706837c91370323b85971c06afd6d056d21e2bc86459618\",\"dweb:/ipfs/QmT8XUrUvQ9aZaPKrqgRU2JVGWnaxBcUYJA7Q7K5KcLBSZ\"]},\"@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol\":{\"keccak256\":\"0x7967d130887c4b40666cd88f8744691d4527039a1b2a38aa0de41481ef646778\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://40e60cbf0e2efede4d9c169e66336a64615af7b719a896ef1f37ae8cd4614ec1\",\"dweb:/ipfs/QmYNiwY22ifhfa8yK6mLCEKfj39caYUHLqe2VBtzDnvdsV\"]},\"@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol\":{\"keccak256\":\"0x2b3005a0064cfc558bdf64b2bae94b565f4574a536aadd61c13838d4f2157790\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://622c3eb87563e71585c9f538d1a196fe2d154dcc5b8f335e8770a8acc95e1f3a\",\"dweb:/ipfs/QmSnDqJJLzv3mirjGB1vrk5X7hegFdS7BKpscpxyqj7sWu\"]},\"@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol\":{\"keccak256\":\"0x2edcb41c121abc510932e8d83ff8b82cf9cdde35e7c297622f5c29ef0af25183\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://72460c66cd1c3b1c11b863e0d8df0a1c56f37743019e468dc312c754f43e3b06\",\"dweb:/ipfs/QmPExYKiNb9PUsgktQBupPaM33kzDHxaYoVeJdLhv8s879\"]},\"@openzeppelin/contracts-upgradeable/utils/StorageSlotUpgradeable.sol\":{\"keccak256\":\"0x09864aea84f01e39313375b5610c73a3c1c68abbdc51e5ccdd25ff977fdadf9a\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://aedb48081190fa828d243529ce25c708202c7d4ccfe99f0e4ecd6bc0cfcd03f3\",\"dweb:/ipfs/QmWyiDQHPZA56iqsAwTmiJoxvNeRQLUVr4gTfzpdpXivpo\"]},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"keccak256\":\"0x9750c6b834f7b43000631af5cc30001c5f547b3ceb3635488f140f60e897ea6b\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://5a7d5b1ef5d8d5889ad2ed89d8619c09383b80b72ab226e0fe7bde1636481e34\",\"dweb:/ipfs/QmebXWgtEfumQGBdVeM6c71McLixYXQP5Bk6kKXuoY4Bmr\"]},\"@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol\":{\"keccak256\":\"0x8de418a5503946cabe331f35fe242d3201a73f67f77aaeb7110acb1f30423aca\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://5a376d3dda2cb70536c0a45c208b29b34ac560c4cb4f513a42079f96ba47d2dd\",\"dweb:/ipfs/QmZQg6gn1sUpM8wHzwNvSnihumUCAhxD119MpXeKp8B9s8\"]},\"@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol\":{\"keccak256\":\"0xf41ca991f30855bf80ffd11e9347856a517b977f0a6c2d52e6421a99b7840329\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://b2717fd2bdac99daa960a6de500754ea1b932093c946388c381da48658234b95\",\"dweb:/ipfs/QmP6QVMn6UeA3ByahyJbYQr5M6coHKBKsf3ySZSfbyA8R7\"]},\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\":{\"keccak256\":\"0x9b72f93be69ca894d8492c244259615c4a742afc8d63720dbc8bb81087d9b238\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://f5a7b96e511be78d5cdf635c784e6ab8cdd38625bb8cafb8a80914a1c89cf0f6\",\"dweb:/ipfs/QmVzTCwJxQAkjRQHboT5QrvsVJGWQHgfEjeTbvyxoKBrds\"]},\"@openzeppelin/contracts/utils/Address.sol\":{\"keccak256\":\"0xf96f969e24029d43d0df89e59d365f277021dac62b48e1c1e3ebe0acdd7f1ca1\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://ec772b45a624be516f1c81970caa8a2e144301e9d0921cbc1a2789fef39a1269\",\"dweb:/ipfs/QmNyjwxCrGhQMyzLD93oUobJXVe9ceJvRvfXwbEtuxPiEj\"]},\"@openzeppelin/contracts/utils/Strings.sol\":{\"keccak256\":\"0xa4d1d62251f8574deb032a35fc948386a9b4de74b812d4f545a1ac120486b48a\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://8c969013129ba9e651a20735ef659fef6d8a1139ea3607bd4b26ddea2d645634\",\"dweb:/ipfs/QmVhVa6LGuzAcB8qgDtVHRkucn4ihj5UZr8xBLcJkP6ucb\"]},\"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\":{\"keccak256\":\"0xda898fa084aa1ddfdb346e6a40459e00a59d87071cce7c315a46d648dd71d0ba\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://ce501a941f4aa1555c04dabb5e07992503bb6a9b32ff8f7cdcefdb4a742210cb\",\"dweb:/ipfs/QmeScPrUpdrGYs9BytV3Z5ZWJcBXtuAgCW4BLHua4xFUxx\"]},\"@openzeppelin/contracts/utils/math/Math.sol\":{\"keccak256\":\"0xa1e8e83cd0087785df04ac79fb395d9f3684caeaf973d9e2c71caef723a3a5d6\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://33bbf48cc069be677705037ba7520c22b1b622c23b33e1a71495f2d36549d40b\",\"dweb:/ipfs/Qmct36zWXv3j7LZB83uwbg7TXwnZSN1fqHNDZ93GG98bGz\"]},\"contracts/DistributionCreator.sol\":{\"keccak256\":\"0x6206a0425bde62264e0e250a94e72ff6145f79ce0eeb6cd33cb279536a40d336\",\"license\":\"BUSL-1.1\",\"urls\":[\"bzz-raw://7f8f4f7ce914408ce1aa8332bfae69a9f5f3a9f7e5eec1e2941a11f2a093891d\",\"dweb:/ipfs/QmUEPRnwZs3sVqt9tZnreR4ucHwSpWQY7f8qoEjUfX4hK6\"]},\"contracts/interfaces/ICore.sol\":{\"keccak256\":\"0x11e92b745193d16934aaeb873c0388041dce2ef3e359a9c3315b668b05903100\",\"license\":\"GPL-3.0\",\"urls\":[\"bzz-raw://2958b2c0b9b0365a3ddf0d39c3623c4b41cf9d1797d4aeee3bfd02ad255692d9\",\"dweb:/ipfs/QmUkyhLEfW3YfVKcnZ3CxBQj33EdBKsx5rijkezNmGVALL\"]},\"contracts/interfaces/external/uniswap/IUniswapV3Pool.sol\":{\"keccak256\":\"0x7035bcab3bfd00a984c1bedd1f78a6cd358a423a60f40666837b740dd2f73fe1\",\"license\":\"GPL-3.0\",\"urls\":[\"bzz-raw://3bbeeb4bd1317b6f1f1600e8b34960d41e91175c0008fb54eb5d15bef66b5b4f\",\"dweb:/ipfs/QmWtDrwF9WDMWbZCGTrXnk4yqynE9Pa1Zg3Ari1h4bbH5W\"]},\"contracts/struct/DistributionParameters.sol\":{\"keccak256\":\"0x9016781bc2054ab54b6efa88c63b029e916d32c747eb68797a0d2e1e87c32a17\",\"license\":\"BUSL-1.1\",\"urls\":[\"bzz-raw://284bd75af1c924723af7b2a21f5dc464477502b3fcde86e0077c6e9ace0a9007\",\"dweb:/ipfs/QmdCwWGQRhwkB8WjUG26TAtb5oqWmrBztqfVATZ4t8C75e\"]},\"contracts/struct/ExtensiveDistributionParameters.sol\":{\"keccak256\":\"0xeef63ebff3bb084f84a40268b06ab2788a161e5da92e0fdaac01658cc017939a\",\"license\":\"BUSL-1.1\",\"urls\":[\"bzz-raw://5872b78b62038a41f3e26384ed3e5d81941410177f16cd61fc752d6cb9889c82\",\"dweb:/ipfs/QmaACJ2SNNUtwFer3EqyG3nVSvD7rDZjjnJfp2FpwJ48oV\"]},\"contracts/struct/RewardTokenAmounts.sol\":{\"keccak256\":\"0x76b12fb56b989673bcead693bc7d925f21b8ab3b9c5e900fe8e8b42d85286f1d\",\"license\":\"BUSL-1.1\",\"urls\":[\"bzz-raw://f1f2c214dba600b041f9cb380350caa391213beada03b549b3e95c0ac3cb17ca\",\"dweb:/ipfs/QmR3deQ7bd1Ys3YQpF7DVkduNVMv3naKnkALepNaxqD1ih\"]},\"contracts/utils/Errors.sol\":{\"keccak256\":\"0x7cd16f5988dee579532a71ff4afd8668c75add546e7e4724c1aaadd888355139\",\"license\":\"GPL-3.0\",\"urls\":[\"bzz-raw://b3cbf955071047ef422c3d4107e3dc0dc2459e3de14d434c069b502cae4c578c\",\"dweb:/ipfs/QmcutpxLceyCRUg8E3krJnn1oKdbp71RpQb63onPT3Akym\"]},\"contracts/utils/UUPSHelper.sol\":{\"keccak256\":\"0xb8011db6d148c8a111678c8074343c82114b923806aee0f60c48ed05f8bd6c40\",\"license\":\"GPL-3.0\",\"urls\":[\"bzz-raw://50c3ecca8c5e46c57a3abc32bb4e74c5983f83722842018715ced14b68528efd\",\"dweb:/ipfs/QmYBTwe1sCieZ3nBLUc3zq1x78rBB9rRDVo9LSDnMTySdv\"]}},\"version\":1}", + "bytecode": "0x60a0604052306080523480156200001557600080fd5b50600054610100900460ff1615808015620000375750600054600160ff909116105b8062000067575062000054306200022060201b620025051760201c565b15801562000067575060005460ff166001145b620000bf5760405162461bcd60e51b815260206004820152602e6024820152600080516020620059fb83398151915260448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084015b60405180910390fd5b6000805460ff191660011790558015620000e3576000805461ff0019166101001790555b801562000119576000805461ff00191690556040516001815260008051602062005a1b8339815191529060200160405180910390a15b50600054610100900460ff16158080156200013b5750600054600160ff909116105b806200016b575062000158306200022060201b620025051760201c565b1580156200016b575060005460ff166001145b620001bf5760405162461bcd60e51b815260206004820152602e6024820152600080516020620059fb83398151915260448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401620000b6565b6000805460ff191660011790558015620001e3576000805461ff0019166101001790555b801562000219576000805461ff00191690556040516001815260008051602062005a1b8339815191529060200160405180910390a15b506200022f565b6001600160a01b03163b151590565b608051615794620002676000396000818161121501528181611255015281816114da0152818161151a015261159601526157946000f3fe6080604052600436106102ca5760003560e01c80637bb7bed11161017b578063b9d81abc116100d7578063e1394f7d11610085578063e1394f7d14610922578063e21f37ce14610942578063e74b981b14610964578063f2f4eb2614610984578063f6e6bb62146109a4578063fb1d2329146109c4578063feba1ed2146109e457600080fd5b8063b9d81abc1461080e578063ba5c3a9d1461082e578063bfe1092814610867578063c14007a014610887578063c53e7dab146108b5578063d0ff94b2146108d5578063d7fa5625146108f557600080fd5b80639af1d35a116101345780639af1d35a14610720578063a218404014610736578063a2686e2314610756578063a70b9f0c14610776578063aa529617146107a1578063ab37f486146107c1578063ae23bf28146107ee57600080fd5b80637bb7bed1146106445780637ecebe00146106645780638a4bd4b21461069157806392ccb581146106b157806395d3d5d8146106d157806396b3ce54146106f357600080fd5b80633d18678e1161022a57806358beb884116101e357806358beb8841461055d5780636c1550b11461057d5780636cca84bd146105aa578063734e7fb9146105ca578063752e8749146105ea57806376cd7cbc146106025780637b74691e1461062257600080fd5b80633d18678e146104a857806346904840146104c85780634d5aedbf146104f55780634f1ef2861461051557806352d1902d14610528578063586db1f51461053d57600080fd5b806317418a221161028757806317418a22146103c25780631794bb3c146103d75780632acd7ec4146103f7578063304440171461043257806334f150b7146104485780633659cfe614610468578063368b87721461048857600080fd5b80630241d8f9146102cf57806303d2944c146102f15780630db38252146103115780630f44380d146103475780631136b89514610374578063141df503146103a2575b600080fd5b3480156102db57600080fd5b506102ef6102ea366004613f96565b610a11565b005b3480156102fd57600080fd5b506102ef61030c366004613fc2565b610af8565b34801561031d57600080fd5b5061033161032c36600461436e565b610bf7565b60405161033e919061466d565b60405180910390f35b34801561035357600080fd5b50610367610362366004614680565b610e2e565b60405161033e91906146f2565b34801561038057600080fd5b5061039461038f366004614705565b610e56565b60405161033e929190614750565b3480156103ae57600080fd5b506102ef6103bd3660046147b6565b610e8c565b3480156103ce57600080fd5b50610367611003565b3480156103e357600080fd5b506102ef6103f2366004614801565b611030565b34801561040357600080fd5b50610424610412366004613fc2565b60a36020526000908152604090205481565b60405190815260200161033e565b34801561043e57600080fd5b50610424609c5481565b34801561045457600080fd5b50610394610463366004614842565b6111dc565b34801561047457600080fd5b506102ef610483366004613fc2565b61120b565b34801561049457600080fd5b506102ef6104a336600461487b565b6112d3565b3480156104b457600080fd5b506102ef6104c33660046148c3565b6113b8565b3480156104d457600080fd5b506099546104e8906001600160a01b031681565b60405161033e91906148dc565b34801561050157600080fd5b506103946105103660046148f0565b6114a5565b6102ef61052336600461494c565b6114d0565b34801561053457600080fd5b50610424611589565b34801561054957600080fd5b5061039461055836600461499b565b611637565b34801561056957600080fd5b506104246105783660046149fd565b611659565b34801561058957600080fd5b5061059d610598366004614a65565b611678565b60405161033e9190614b15565b3480156105b657600080fd5b506102ef6105c5366004613fc2565b6117a1565b3480156105d657600080fd5b506103676105e5366004614842565b6118a4565b3480156105f657600080fd5b50610424633b9aca0081565b34801561060e57600080fd5b506102ef61061d366004614b59565b6118c5565b34801561062e57600080fd5b506106376118cf565b60405161033e9190614b9a565b34801561065057600080fd5b506104e861065f3660046148c3565b611b52565b34801561067057600080fd5b5061042461067f366004613fc2565b60a06020526000908152604090205481565b34801561069d57600080fd5b506103676106ac366004613fc2565b611b7c565b3480156106bd57600080fd5b506103946106cc366004614bfc565b611b9c565b3480156106dd57600080fd5b506106e6611bbd565b60405161033e9190614c1c565b3480156106ff57600080fd5b5061042461070e366004613fc2565b60a16020526000908152604090205481565b34801561072c57600080fd5b50610424609a5481565b34801561074257600080fd5b506102ef610751366004614c67565b611cde565b34801561076257600080fd5b506102ef610771366004613fc2565b611f30565b34801561078257600080fd5b5061078c610e1081565b60405163ffffffff909116815260200161033e565b3480156107ad57600080fd5b506103946107bc3660046148f0565b612033565b3480156107cd57600080fd5b506104246107dc366004613fc2565b609f6020526000908152604090205481565b3480156107fa57600080fd5b50610367610809366004614cd2565b612062565b34801561081a57600080fd5b5061042461082936600461436e565b61208b565b34801561083a57600080fd5b5061084e6108493660046148c3565b61211c565b60405161033e9d9c9b9a99989796959493929190614cf0565b34801561087357600080fd5b506098546104e8906001600160a01b031681565b34801561089357600080fd5b506108a76108a236600461436e565b612249565b60405161033e929190614d9c565b3480156108c157600080fd5b506103946108d0366004614db7565b612323565b3480156108e157600080fd5b506103676108f0366004614cd2565b612342565b34801561090157600080fd5b50610424610910366004613fc2565b60a26020526000908152604090205481565b34801561092e57600080fd5b5061036761093d366004614680565b612351565b34801561094e57600080fd5b50610957612372565b60405161033e9190614e28565b34801561097057600080fd5b506102ef61097f366004613fc2565b612400565b34801561099057600080fd5b506097546104e8906001600160a01b031681565b3480156109b057600080fd5b506103946109bf366004614705565b6124d8565b3480156109d057600080fd5b506103676109df366004614bfc565b6124f6565b3480156109f057600080fd5b506104246109ff366004613fc2565b609e6020526000908152604090205481565b60975460405163521d4de960e01b81526001600160a01b039091169063521d4de990610a419033906004016148dc565b602060405180830381865afa158015610a5e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a829190614e4b565b610a9f57604051632678482f60e21b815260040160405180910390fd5b6001600160a01b0382166000818152609e602052604090819020839055517fab1d37d0b21937f334fc4164d147abbfdbfd7ef37ab9ea0ae73f2a58ffb7f1cc90610aec9084815260200190565b60405180910390a25050565b60975460405163521d4de960e01b81526001600160a01b039091169063521d4de990610b289033906004016148dc565b602060405180830381865afa158015610b45573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b699190614e4b565b610b8657604051632678482f60e21b815260040160405180910390fd5b6001600160a01b038116610bad57604051633494a40d60e21b815260040160405180910390fd5b609880546001600160a01b0319166001600160a01b0383169081179091556040517fc0ebb188f905d128bcd7e4282dd1f9cf24cd331b69071002e488349aca6a867b90600090a250565b610bff613d6c565b81816000018190525081602001516001600160a01b031663ddca3f436040518163ffffffff1660e01b8152600401602060405180830381865afa925050508015610c66575060408051601f3d908101601f19168201909252610c6391810190614e79565b60015b610c765760006020820152610c81565b62ffffff1660208201525b610cf482602001516001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa158015610cc6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cea9190614e9f565b8360200151612514565b8160400181905250610d4182602001516001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa158015610cc6573d6000803e3d6000fd5b816060018190525081604001516001600160a01b03166395d89b416040518163ffffffff1660e01b8152600401600060405180830381865afa158015610d8b573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610db39190810190614f01565b816080018190525081604001516001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015610dfd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e219190614f46565b60ff1660a0820152919050565b6060610e4f6000610e3e8461267c565b63ffffffff600063ffffffff612695565b5092915050565b6060600080610e648661267c565b9050610e7f600082610e78610e1082614f77565b8888612695565b9250925050935093915050565b60975460405163521d4de960e01b81526001600160a01b039091169063521d4de990610ebc9033906004016148dc565b602060405180830381865afa158015610ed9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610efd9190614e4b565b610f1a57604051632678482f60e21b815260040160405180910390fd5b8160005b81811015610ffc57610ff483868684818110610f3c57610f3c614f94565b9050602002016020810190610f519190613fc2565b6001600160a01b03166370a08231306040518263ffffffff1660e01b8152600401610f7c91906148dc565b602060405180830381865afa158015610f99573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fbd9190614faa565b878785818110610fcf57610fcf614f94565b9050602002016020810190610fe49190613fc2565b6001600160a01b03169190612a9c565b600101610f1e565b5050505050565b606060006110104261267c565b9050610e4f600082611024610e1082614f77565b600063ffffffff612695565b600054610100900460ff16158080156110505750600054600160ff909116105b80611071575061105f30612505565b158015611071575060005460ff166001145b6110d95760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084015b60405180910390fd5b6000805460ff1916600117905580156110fc576000805461ff0019166101001790555b6001600160a01b038416158061111957506001600160a01b038316155b156111375760405163d92e233d60e01b815260040160405180910390fd5b633b9aca00821061115b57604051633494a40d60e21b815260040160405180910390fd5b609880546001600160a01b038086166001600160a01b0319928316179092556097805492871692909116919091179055609a82905580156111d6576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50505050565b60606000806111ea4261267c565b90506111fe600082610e78610e1082614f77565b92509250505b9250929050565b6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001630036112535760405162461bcd60e51b81526004016110d090614fc3565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316611285612b04565b6001600160a01b0316146112ab5760405162461bcd60e51b81526004016110d09061500f565b6112b481612b20565b604080516000808252602082019092526112d091839190612bc3565b50565b60975460405163521d4de960e01b81526001600160a01b039091169063521d4de9906113039033906004016148dc565b602060405180830381865afa158015611320573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113449190614e4b565b61136157604051632678482f60e21b815260040160405180910390fd5b609b61136d82826150db565b50600061137982612d2e565b609c8190556040518181529091507fde3dc3335dea4d1a1060ef6cefcfcc109eb0a1e78ce151818d3f17a01e1f8a059060200160405180910390a15050565b60975460405163521d4de960e01b81526001600160a01b039091169063521d4de9906113e89033906004016148dc565b602060405180830381865afa158015611405573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114299190614e4b565b61144657604051632678482f60e21b815260040160405180910390fd5b633b9aca00811061146a57604051633494a40d60e21b815260040160405180910390fd5b609a8190556040518181527f3346af6da1932164d501f2ec28f8c5d686db5828a36b77f2da4332d89184fe7b9060200160405180910390a150565b606060006114c2866114b68761267c565b63ffffffff8787612695565b915091505b94509492505050565b6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001630036115185760405162461bcd60e51b81526004016110d090614fc3565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031661154a612b04565b6001600160a01b0316146115705760405162461bcd60e51b81526004016110d09061500f565b61157982612b20565b61158582826001612bc3565b5050565b6000306001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146116245760405162461bcd60e51b815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c6044820152771b1959081d1a1c9bdd59da0819195b1959d85d1958d85b1b60421b60648201526084016110d0565b5060008051602061571883398151915290565b606060006114c260006116498861267c565b6116528861267c565b8787612695565b60006116658383612d69565b61166e84612e25565b90505b9392505050565b33600090815260a260205260409020546060901580156116a95750609c5433600090815260a1602052604090205414155b80156116c2575032600090815260a26020526040902054155b80156116df5750609c5432600090815260a1602052604090205414155b156116fd576040516314e52a5b60e31b815260040160405180910390fd5b81516000816001600160401b0381111561171957611719613fdf565b604051908082528060200260200182016040528015611742578160200160208202803683370190505b50905060005b828110156117975761177285828151811061176557611765614f94565b6020026020010151612e25565b82828151811061178457611784614f94565b6020908102919091010152600101611748565b509150505b919050565b60975460405163521d4de960e01b81526001600160a01b039091169063521d4de9906117d19033906004016148dc565b602060405180830381865afa1580156117ee573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118129190614e4b565b61182f57604051632678482f60e21b815260040160405180910390fd5b6001600160a01b0381166000908152609f602052604081205461185390600161519a565b6001600160a01b0383166000818152609f60205260409081902083905551919250907fc6cd32b1acffa550abf886a9b443ff3ce485bfdb05e35ef5b26e745739a1eac190610aec9084815260200190565b60606118bd60006118b48561267c565b6110248561267c565b509392505050565b6115858282612d69565b6060609d805480602002602001604051908101604052809291908181526020016000905b82821015611b49576000848152602090819020604080516101e081018252600986029092018054835260018101546001600160a01b039081168486015260028201541683830152600381015460608401526004810180548351818702810187019094528084529394919360808601939283018282801561199c57602002820191906000526020600020905b81546001600160a01b0316815260019091019060200180831161197e575b5050505050815260200160058201805480602002602001604051908101604052809291908181526020018280548015611a2057602002820191906000526020600020906000905b82829054906101000a900463ffffffff1663ffffffff16815260200190600401906020826003010492830192600103820291508084116119e35790505b5050509183525050600682015463ffffffff8082166020840152600160201b820481166040840152600160401b820481166060840152600160601b820481166080840152600160801b8204811660a0840152600160a01b8204811660c0840152600160c01b9091041660e082015260078201546001600160a01b031661010082015260088201805461012090920191611ab89061505b565b80601f0160208091040260200160405190810160405280929190818152602001828054611ae49061505b565b8015611b315780601f10611b0657610100808354040283529160200191611b31565b820191906000526020600020905b815481529060010190602001808311611b1457829003601f168201915b505050505081525050815260200190600101906118f3565b50505050905090565b60a48181548110611b6257600080fd5b6000918252602090912001546001600160a01b0316905081565b60606000611b894261267c565b90506117978382611024610e1082614f77565b6060600080611baa4261267c565b9050610e7f8682610e78610e1082614f77565b60a45460609060009081816001600160401b03811115611bdf57611bdf613fdf565b604051908082528060200260200182016040528015611c2457816020015b6040805180820190915260008082526020820152815260200190600190039081611bfd5790505b50905060005b828163ffffffff161015611cd457600060a48263ffffffff1681548110611c5357611c53614f94565b60009182526020808320909101546001600160a01b031680835260a39091526040909120549091508015611cca576040518060400160405280836001600160a01b0316815260200182815250848781518110611cb157611cb1614f94565b6020908102919091010152611cc76001876151ad565b95505b5050600101611c2a565b5091825250919050565b60975460405163521d4de960e01b81526001600160a01b039091169063521d4de990611d0e9033906004016148dc565b602060405180830381865afa158015611d2b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d4f9190614e4b565b611d6c57604051632678482f60e21b815260040160405180910390fd5b82818114611d8d57604051631df89e8b60e01b815260040160405180910390fd5b60005b81811015611f28576000848483818110611dac57611dac614f94565b905060200201359050600081118015611e07575060a36000888885818110611dd657611dd6614f94565b9050602002016020810190611deb9190613fc2565b6001600160a01b03168152602081019190915260400160002054155b15611e685760a4878784818110611e2057611e20614f94565b9050602002016020810190611e359190613fc2565b81546001810183556000928352602090922090910180546001600160a01b0319166001600160a01b039092169190911790555b8060a36000898986818110611e7f57611e7f614f94565b9050602002016020810190611e949190613fc2565b6001600160a01b03168152602081019190915260400160002055868683818110611ec057611ec0614f94565b9050602002016020810190611ed59190613fc2565b6001600160a01b03167f3a5e6418e38cae10bf66eaf3e68c4e9c6b14df195e24fec169ab3a5b123c96e582604051611f0f91815260200190565b60405180910390a250611f21816151c0565b9050611d90565b505050505050565b60975460405163521d4de960e01b81526001600160a01b039091169063521d4de990611f609033906004016148dc565b602060405180830381865afa158015611f7d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fa19190614e4b565b611fbe57604051632678482f60e21b815260040160405180910390fd5b6001600160a01b038116600090815260a26020526040812054611fe290600161519a565b6001600160a01b038316600081815260a260205260409081902083905551919250907f9c759941da0b7ce56c059c1497218796e62035024afb77a00ff49a980a62078f90610aec9084815260200190565b60606000806120418661267c565b90506120548782610e78610e1082614f77565b925092505094509492505050565b6060600061206f8361267c565b90506120828482611024610e1082614f77565b50949350505050565b33600090815260a260205260408120541580156120b95750609c5433600090815260a1602052604090205414155b80156120d2575032600090815260a26020526040902054155b80156120ef5750609c5432600090815260a1602052604090205414155b1561210d576040516314e52a5b60e31b815260040160405180910390fd5b61211682612e25565b92915050565b609d818154811061212c57600080fd5b600091825260209091206009909102018054600182015460028301546003840154600685015460078601546008870180549698506001600160a01b039586169794861696939563ffffffff80851696600160201b8604821696600160401b8704831696600160601b8104841696600160801b8204851696600160a01b8304861696600160c01b90930490951694911692916121c69061505b565b80601f01602080910402602001604051908101604052809291908181526020018280546121f29061505b565b801561223f5780601f106122145761010080835404028352916020019161223f565b820191906000526020600020905b81548152906001019060200180831161222257829003601f168201915b505050505090508d565b6000612253613d6c565b600080306001600160a01b0316630db3825260e01b8660405160240161227991906151d9565b60408051601f198184030181529181526020820180516001600160e01b03166001600160e01b03199094169390931790925290516122b791906151ec565b600060405180830381855af49150503d80600081146122f2576040519150601f19603f3d011682016040523d82523d6000602084013e6122f7565b606091505b5091509150819350831561231c578080602001905181019061231991906155a3565b92505b5050915091565b60606000612334876116498861267c565b915091509550959350505050565b60606118bd83610e3e8461267c565b6060600061235e8361267c565b9050611797600082611024610e1082614f77565b609b805461237f9061505b565b80601f01602080910402602001604051908101604052809291908181526020018280546123ab9061505b565b80156123f85780601f106123cd576101008083540402835291602001916123f8565b820191906000526020600020905b8154815290600101906020018083116123db57829003601f168201915b505050505081565b60975460405163521d4de960e01b81526001600160a01b039091169063521d4de9906124309033906004016148dc565b602060405180830381865afa15801561244d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124719190614e4b565b61248e57604051632678482f60e21b815260040160405180910390fd5b609980546001600160a01b0319166001600160a01b0383169081179091556040517f7a7b5a0a132f9e0581eb8527f66eae9ee89c2a3e79d4ac7e41a1f1f4d48a7fc290600090a250565b606060006124ea60006114b68761267c565b91509150935093915050565b6060612082846118b48561267c565b6001600160a01b03163b151590565b61251c613e22565b6001600160a01b0383168082526040805163313ce56760e01b8152905163313ce567916004808201926020929091908290030181865afa158015612564573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125889190614f46565b60ff166020820152604080516395d89b4160e01b815290516001600160a01b038516916395d89b419160048083019260009291908290030181865afa1580156125d5573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526125fd9190810190614f01565b604080830191909152516370a0823160e01b81526001600160a01b038416906370a08231906126309085906004016148dc565b602060405180830381865afa15801561264d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126719190614faa565b606082015292915050565b6000610e1061268b81846155ed565b6121169190615610565b609d5460609060009081908163ffffffff861682106126ba578563ffffffff166126bc565b815b90506000816001600160401b038111156126d8576126d8613fdf565b60405190808252806020026020018201604052801561271157816020015b6126fe613d6c565b8152602001906001900390816126f65790505b509050875b838163ffffffff161015612a82576000609d8263ffffffff168154811061273f5761273f614f94565b6000918252602091829020604080516101e08101825260099093029091018054835260018101546001600160a01b03908116848601526002820154168383015260038101546060840152600481018054835181870281018701909452808452939491936080860193928301828280156127e157602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116127c3575b505050505081526020016005820180548060200260200160405190810160405280929190818152602001828054801561286557602002820191906000526020600020906000905b82829054906101000a900463ffffffff1663ffffffff16815260200190600401906020826003010492830192600103820291508084116128285790505b5050509183525050600682015463ffffffff8082166020840152600160201b820481166040840152600160401b820481166060840152600160601b820481166080840152600160801b8204811660a0840152600160a01b8204811660c0840152600160c01b9091041660e082015260078201546001600160a01b0316610100820152600882018054610120909201916128fd9061505b565b80601f01602080910402602001604051908101604052809291908181526020018280546129299061505b565b80156129765780601f1061294b57610100808354040283529160200191612976565b820191906000526020600020905b81548152906001019060200180831161295957829003601f168201915b505050505081525050905061298c818d8d613465565b80156129be57506001600160a01b038d1615806129be57508c6001600160a01b031681602001516001600160a01b0316145b15612a695760405163060a003d60e51b81526000908190309063c14007a0906129eb9086906004016151d9565b600060405180830381865afa158015612a08573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052612a309190810190615638565b915091508115612a665780858981518110612a4d57612a4d614f94565b6020908102919091010152612a636001896151ad565b97505b50505b816001019150838603612a7c5750612a82565b50612716565b9381529a63ffffffff909316995091975050505050505050565b6040516001600160a01b038316602482015260448101829052612aff90849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526134bb565b505050565b600080516020615718833981519152546001600160a01b031690565b6097546001600160a01b03168015801590612ba5575060405163521d4de960e01b81526001600160a01b0382169063521d4de990612b629033906004016148dc565b602060405180830381865afa158015612b7f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612ba39190614e4b565b155b1561158557604051632678482f60e21b815260040160405180910390fd5b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff1615612bf657612aff8361358d565b826001600160a01b03166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa925050508015612c50575060408051601f3d908101601f19168201909252612c4d91810190614faa565b60015b612cb35760405162461bcd60e51b815260206004820152602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201526d6f6e206973206e6f74205555505360901b60648201526084016110d0565b6000805160206157188339815191528114612d225760405162461bcd60e51b815260206004820152602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f786044820152681a58589b195555525160ba1b60648201526084016110d0565b50612aff838383613627565b6000612d3a825161364c565b82604051602001612d4c92919061567b565b604051602081830303815290604052805190602001209050919050565b609c54604080516020601f85018190048102820181019092528381523391612dad91849187908790819084018382808284376000920191909152506136de92505050565b6001600160a01b031614612dd457604051638baa579f60e01b815260040160405180910390fd5b33600081815260a1602052604090819020839055517fc48bbd4f009ad78a336beb65bf44688651e9aa52ac98d9054f0fce0573fefbc390612e189084815260200190565b60405180910390a2505050565b6000612e2f6136fa565b6000612e3f83610120015161267c565b6040808501516001600160a01b0316600090815260a3602052205463ffffffff821661012086015290915042612e77610e1084614f77565b63ffffffff161080612e92575061014084015163ffffffff16155b80612ec857508360e001518460c00151856101000151612eb29190614f77565b612ebc9190614f77565b63ffffffff1661271014155b80612ef757506101a08401516001600160a01b031615801590612ef7575061271084610180015163ffffffff16105b80612f0c57508360a001515184608001515114155b80612f15575080155b80612f3957508084610140015163ffffffff168560600151612f3791906156d6565b105b15612f57576040516314414f4160e11b815260040160405180910390fd5b6060840151336000908152609e6020526040902054909350633b9aca00811080156130035750609f600086602001516001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa158015612fc3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612fe79190614e9f565b6001600160a01b03168152602081019190915260400160002054155b80156130905750609f600086602001516001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa158015613050573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906130749190614e9f565b6001600160a01b03168152602081019190915260400160002054155b15613134576000633b9aca006130a6838261519a565b609a546130b391906156ea565b6130bd91906156d6565b90506000633b9aca006130d0838261519a565b6130da90886156ea565b6130e491906156d6565b6099549091506001600160a01b031680156130ff5780613101565b305b90506131283382613112858b61519a565b60408c01516001600160a01b0316929190613753565b50606087018190529450505b6098546040860151613155916001600160a01b039182169133911687613753565b33600090815260a060205260409020546131708160016151ad565b33600081815260a0602090815260409182902093909355516131b19284910160609290921b6bffffffffffffffffffffffff19168252601482015260340190565b60408051808303601f1901815291815281516020928301208852609d805460018101825560009190915288517fd26e832454299e9fabb89e0e5fffdc046d4e14431bc1bf607ffb2e8a1ddecf7b6009909202918201908155898401517fd26e832454299e9fabb89e0e5fffdc046d4e14431bc1bf607ffb2e8a1ddecf7c830180546001600160a01b03199081166001600160a01b0393841617909155938b01517fd26e832454299e9fabb89e0e5fffdc046d4e14431bc1bf607ffb2e8a1ddecf7d8401805490951691161790925560608901517fd26e832454299e9fabb89e0e5fffdc046d4e14431bc1bf607ffb2e8a1ddecf7e820155608089015180518a946132df937fd26e832454299e9fabb89e0e5fffdc046d4e14431bc1bf607ffb2e8a1ddecf7f01920190613e56565b5060a082015180516132fb916005840191602090910190613ebb565b5060c082015160068201805460e08501516101008601516101208701516101408801516101608901516101808a015163ffffffff98891667ffffffffffffffff1990971696909617600160201b958916959095029490941767ffffffffffffffff60401b1916600160401b9388169390930263ffffffff60601b191692909217600160601b918716919091021767ffffffffffffffff60801b1916600160801b9186169190910263ffffffff60a01b191617600160a01b918516919091021763ffffffff60c01b1916600160c01b93909116929092029190911790556101a08201516007820180546001600160a01b0319166001600160a01b039092169190911790556101c0820151600882019061341390826150db565b505050336001600160a01b03167f5280c74029ecceb35e4fecf34adee487fd5a9a3d6c8e70b7374a1c133370e83a8760405161344f91906151d9565b60405180910390a25050505061179c6001606555565b60008084610120015163ffffffff1690508363ffffffff16610e108661014001516134909190615610565b6134a09063ffffffff16836151ad565b1180156134b257508263ffffffff1681105b95945050505050565b6000613510826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661378b9092919063ffffffff16565b805190915015612aff578080602001905181019061352e9190614e4b565b612aff5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016110d0565b61359681612505565b6135f85760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b60648201526084016110d0565b60008051602061571883398151915280546001600160a01b0319166001600160a01b0392909216919091179055565b6136308361379a565b60008251118061363d5750805b15612aff576111d683836137da565b60606000613659836138c3565b60010190506000816001600160401b0381111561367857613678613fdf565b6040519080825280601f01601f1916602001820160405280156136a2576020820181803683370190505b5090508181016020015b600019016f181899199a1a9b1b9c1cb0b131b232b360811b600a86061a8153600a85049450846136ac57509392505050565b60008060006136ed858561399b565b915091506118bd816139dd565b60026065540361374c5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016110d0565b6002606555565b6040516001600160a01b03808516602483015283166044820152606481018290526111d69085906323b872dd60e01b90608401612ac8565b606061166e8484600085613b22565b6137a38161358d565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b60606137e583612505565b6138405760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b60648201526084016110d0565b600080846001600160a01b03168460405161385b91906151ec565b600060405180830381855af49150503d8060008114613896576040519150601f19603f3d011682016040523d82523d6000602084013e61389b565b606091505b50915091506134b2828260405180606001604052806027815260200161573860279139613bff565b60008072184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b83106139025772184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b830492506040015b6d04ee2d6d415b85acef8100000000831061392e576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc10000831061394c57662386f26fc10000830492506010015b6305f5e1008310613964576305f5e100830492506008015b612710831061397857612710830492506004015b6064831061398a576064830492506002015b600a83106121165760010192915050565b60008082516041036139d15760208301516040840151606085015160001a6139c587828585613c18565b94509450505050611204565b50600090506002611204565b60008160048111156139f1576139f1615701565b036139f95750565b6001816004811115613a0d57613a0d615701565b03613a555760405162461bcd60e51b815260206004820152601860248201527745434453413a20696e76616c6964207369676e617475726560401b60448201526064016110d0565b6002816004811115613a6957613a69615701565b03613ab65760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e6774680060448201526064016110d0565b6003816004811115613aca57613aca615701565b036112d05760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b60648201526084016110d0565b606082471015613b835760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016110d0565b600080866001600160a01b03168587604051613b9f91906151ec565b60006040518083038185875af1925050503d8060008114613bdc576040519150601f19603f3d011682016040523d82523d6000602084013e613be1565b606091505b5091509150613bf287838387613ccf565b925050505b949350505050565b60608315613c0e575081611671565b6116718383613d42565b6000806fa2a8918ca85bafe22016d0b997e4df60600160ff1b03831115613c4557506000905060036114c7565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015613c99573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116613cc2576000600192509250506114c7565b9660009650945050505050565b60608315613d3c578251600003613d3557613ce985612505565b613d355760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016110d0565b5081613bf7565b613bf783835b815115613d525781518083602001fd5b8060405162461bcd60e51b81526004016110d09190614e28565b604080516102a081018252600060c0820181815260e083018290526101008301829052610120830182905260606101408401819052610160840181905261018084018390526101a084018390526101c084018390526101e08401839052610200840183905261022084018390526102408401839052610260840183905261028084015282526020820152908101613e01613e22565b8152602001613e0e613e22565b815260606020820152600060409091015290565b604051806080016040528060006001600160a01b03168152602001600060ff16815260200160608152602001600081525090565b828054828255906000526020600020908101928215613eab579160200282015b82811115613eab57825182546001600160a01b0319166001600160a01b03909116178255602090920191600190910190613e76565b50613eb7929150613f61565b5090565b82805482825590600052602060002090600701600890048101928215613eab5791602002820160005b83821115613f2857835183826101000a81548163ffffffff021916908363ffffffff1602179055509260200192600401602081600301049283019260010302613ee4565b8015613f585782816101000a81549063ffffffff0219169055600401602081600301049283019260010302613f28565b5050613eb79291505b5b80821115613eb75760008155600101613f62565b6001600160a01b03811681146112d057600080fd5b803561179c81613f76565b60008060408385031215613fa957600080fd5b8235613fb481613f76565b946020939093013593505050565b600060208284031215613fd457600080fd5b813561167181613f76565b634e487b7160e01b600052604160045260246000fd5b6040516101e081016001600160401b038111828210171561401857614018613fdf565b60405290565b60405160c081016001600160401b038111828210171561401857614018613fdf565b604051601f8201601f191681016001600160401b038111828210171561406857614068613fdf565b604052919050565b60006001600160401b0382111561408957614089613fdf565b5060051b60200190565b600082601f8301126140a457600080fd5b813560206140b96140b483614070565b614040565b82815260059290921b840181019181810190868411156140d857600080fd5b8286015b848110156140fc5780356140ef81613f76565b83529183019183016140dc565b509695505050505050565b63ffffffff811681146112d057600080fd5b803561179c81614107565b600082601f83011261413557600080fd5b813560206141456140b483614070565b82815260059290921b8401810191818101908684111561416457600080fd5b8286015b848110156140fc57803561417b81614107565b8352918301918301614168565b60006001600160401b038211156141a1576141a1613fdf565b50601f01601f191660200190565b60006141bd6140b484614188565b90508281528383830111156141d157600080fd5b828260208301376000602084830101529392505050565b600082601f8301126141f957600080fd5b611671838335602085016141af565b60006101e0828403121561421b57600080fd5b614223613ff5565b90508135815261423560208301613f8b565b602082015261424660408301613f8b565b60408201526060820135606082015260808201356001600160401b038082111561426f57600080fd5b61427b85838601614093565b608084015260a084013591508082111561429457600080fd5b6142a085838601614124565b60a08401526142b160c08501614119565b60c08401526142c260e08501614119565b60e084015261010091506142d7828501614119565b8284015261012091506142eb828501614119565b8284015261014091506142ff828501614119565b828401526101609150614313828501614119565b828401526101809150614327828501614119565b828401526101a0915061433b828501613f8b565b828401526101c09150818401358181111561435557600080fd5b614361868287016141e8565b8385015250505092915050565b60006020828403121561438057600080fd5b81356001600160401b0381111561439657600080fd5b613bf784828501614208565b600081518084526020808501945080840160005b838110156143db5781516001600160a01b0316875295820195908201906001016143b6565b509495945050505050565b600081518084526020808501945080840160005b838110156143db57815163ffffffff16875295820195908201906001016143fa565b60005b8381101561443757818101518382015260200161441f565b50506000910152565b6000815180845261445881602086016020860161441c565b601f01601f19169290920160200192915050565b60006101e082518452602083015161448f60208601826001600160a01b03169052565b5060408301516144aa60408601826001600160a01b03169052565b506060830151606085015260808301518160808601526144cc828601826143a2565b91505060a083015184820360a08601526144e682826143e6565b91505060c083015161450060c086018263ffffffff169052565b5060e083015161451860e086018263ffffffff169052565b506101008381015163ffffffff9081169186019190915261012080850151821690860152610140808501518216908601526101608085015182169086015261018080850151909116908501526101a0808401516001600160a01b0316908501526101c080840151858303828701526145908382614440565b9695505050505050565b60018060a01b03815116825260ff602082015116602083015260006040820151608060408501526145ce6080850182614440565b606093840151949093019390935250919050565b6000815160c084526145f760c085018261446c565b905062ffffff60208401511660208501526040830151848203604086015261461f828261459a565b91505060608301518482036060860152614639828261459a565b915050608083015184820360808601526146538282614440565b91505060ff60a08401511660a08501528091505092915050565b60208152600061167160208301846145e2565b60006020828403121561469257600080fd5b813561167181614107565b600081518084526020808501808196508360051b8101915082860160005b858110156146e55782840389526146d38483516145e2565b988501989350908401906001016146bb565b5091979650505050505050565b602081526000611671602083018461469d565b60008060006060848603121561471a57600080fd5b833561472581614107565b9250602084013561473581614107565b9150604084013561474581614107565b809150509250925092565b604081526000614763604083018561469d565b90508260208301529392505050565b60008083601f84011261478457600080fd5b5081356001600160401b0381111561479b57600080fd5b6020830191508360208260051b850101111561120457600080fd5b6000806000604084860312156147cb57600080fd5b83356001600160401b038111156147e157600080fd5b6147ed86828701614772565b909450925050602084013561474581613f76565b60008060006060848603121561481657600080fd5b833561482181613f76565b9250602084013561483181613f76565b929592945050506040919091013590565b6000806040838503121561485557600080fd5b823561486081614107565b9150602083013561487081614107565b809150509250929050565b60006020828403121561488d57600080fd5b81356001600160401b038111156148a357600080fd5b8201601f810184136148b457600080fd5b613bf7848235602084016141af565b6000602082840312156148d557600080fd5b5035919050565b6001600160a01b0391909116815260200190565b6000806000806080858703121561490657600080fd5b843561491181613f76565b9350602085013561492181614107565b9250604085013561493181614107565b9150606085013561494181614107565b939692955090935050565b6000806040838503121561495f57600080fd5b823561496a81613f76565b915060208301356001600160401b0381111561498557600080fd5b614991858286016141e8565b9150509250929050565b600080600080608085870312156149b157600080fd5b843561491181614107565b60008083601f8401126149ce57600080fd5b5081356001600160401b038111156149e557600080fd5b60208301915083602082850101111561120457600080fd5b600080600060408486031215614a1257600080fd5b83356001600160401b0380821115614a2957600080fd5b614a3587838801614208565b94506020860135915080821115614a4b57600080fd5b50614a58868287016149bc565b9497909650939450505050565b60006020808385031215614a7857600080fd5b82356001600160401b0380821115614a8f57600080fd5b818501915085601f830112614aa357600080fd5b8135614ab16140b482614070565b81815260059190911b83018401908481019088831115614ad057600080fd5b8585015b83811015614b0857803585811115614aec5760008081fd5b614afa8b89838a0101614208565b845250918601918601614ad4565b5098975050505050505050565b6020808252825182820181905260009190848201906040850190845b81811015614b4d57835183529284019291840191600101614b31565b50909695505050505050565b60008060208385031215614b6c57600080fd5b82356001600160401b03811115614b8257600080fd5b614b8e858286016149bc565b90969095509350505050565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b82811015614bef57603f19888603018452614bdd85835161446c565b94509285019290850190600101614bc1565b5092979650505050505050565b600080600060608486031215614c1157600080fd5b833561472581613f76565b602080825282518282018190526000919060409081850190868401855b828110156146e557815180516001600160a01b03168552860151868501529284019290850190600101614c39565b60008060008060408587031215614c7d57600080fd5b84356001600160401b0380821115614c9457600080fd5b614ca088838901614772565b90965094506020870135915080821115614cb957600080fd5b50614cc687828801614772565b95989497509550505050565b60008060408385031215614ce557600080fd5b823561486081613f76565b8d81526001600160a01b038d811660208301528c166040820152606081018b905263ffffffff8a8116608083015289811660a0830152881660c0820152600063ffffffff881660e083015263ffffffff871661010083015263ffffffff861661012083015263ffffffff85166101408301526001600160a01b0384166101608301526101a0610180830152614d896101a0830184614440565b9f9e505050505050505050505050505050565b821515815260406020820152600061166e60408301846145e2565b600080600080600060a08688031215614dcf57600080fd5b8535614dda81613f76565b94506020860135614dea81614107565b93506040860135614dfa81614107565b92506060860135614e0a81614107565b91506080860135614e1a81614107565b809150509295509295909350565b6020815260006116716020830184614440565b8051801515811461179c57600080fd5b600060208284031215614e5d57600080fd5b61167182614e3b565b805162ffffff8116811461179c57600080fd5b600060208284031215614e8b57600080fd5b61167182614e66565b805161179c81613f76565b600060208284031215614eb157600080fd5b815161167181613f76565b600082601f830112614ecd57600080fd5b8151614edb6140b482614188565b818152846020838601011115614ef057600080fd5b613bf782602083016020870161441c565b600060208284031215614f1357600080fd5b81516001600160401b03811115614f2957600080fd5b613bf784828501614ebc565b805160ff8116811461179c57600080fd5b600060208284031215614f5857600080fd5b61167182614f35565b634e487b7160e01b600052601160045260246000fd5b63ffffffff818116838216019080821115610e4f57610e4f614f61565b634e487b7160e01b600052603260045260246000fd5b600060208284031215614fbc57600080fd5b5051919050565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b19195b1959d85d1958d85b1b60a21b606082015260800190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b6163746976652070726f787960a01b606082015260800190565b600181811c9082168061506f57607f821691505b60208210810361508f57634e487b7160e01b600052602260045260246000fd5b50919050565b601f821115612aff57600081815260208120601f850160051c810160208610156150bc5750805b601f850160051c820191505b81811015611f28578281556001016150c8565b81516001600160401b038111156150f4576150f4613fdf565b61510881615102845461505b565b84615095565b602080601f83116001811461513d57600084156151255750858301515b600019600386901b1c1916600185901b178555611f28565b600085815260208120601f198616915b8281101561516c5788860151825594840194600190910190840161514d565b508582101561518a5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b8181038181111561211657612116614f61565b8082018082111561211657612116614f61565b6000600182016151d2576151d2614f61565b5060010190565b602081526000611671602083018461446c565b600082516151fe81846020870161441c565b9190910192915050565b600082601f83011261521957600080fd5b815160206152296140b483614070565b82815260059290921b8401810191818101908684111561524857600080fd5b8286015b848110156140fc57805161525f81613f76565b835291830191830161524c565b805161179c81614107565b600082601f83011261528857600080fd5b815160206152986140b483614070565b82815260059290921b840181019181810190868411156152b757600080fd5b8286015b848110156140fc5780516152ce81614107565b83529183019183016152bb565b60006101e082840312156152ee57600080fd5b6152f6613ff5565b90508151815261530860208301614e94565b602082015261531960408301614e94565b60408201526060820151606082015260808201516001600160401b038082111561534257600080fd5b61534e85838601615208565b608084015260a084015191508082111561536757600080fd5b61537385838601615277565b60a084015261538460c0850161526c565b60c084015261539560e0850161526c565b60e084015261010091506153aa82850161526c565b8284015261012091506153be82850161526c565b8284015261014091506153d282850161526c565b8284015261016091506153e682850161526c565b8284015261018091506153fa82850161526c565b828401526101a0915061540e828501614e94565b828401526101c09150818401518181111561542857600080fd5b61436186828701614ebc565b60006080828403121561544657600080fd5b604051608081016001600160401b03828210818311171561546957615469613fdf565b816040528293508451915061547d82613f76565b81835261548c60208601614f35565b602084015260408501519150808211156154a557600080fd5b506154b285828601614ebc565b604083015250606083015160608201525092915050565b600060c082840312156154db57600080fd5b6154e361401e565b905081516001600160401b03808211156154fc57600080fd5b615508858386016152db565b835261551660208501614e66565b6020840152604084015191508082111561552f57600080fd5b61553b85838601615434565b6040840152606084015191508082111561555457600080fd5b61556085838601615434565b6060840152608084015191508082111561557957600080fd5b5061558684828501614ebc565b60808301525061559860a08301614f35565b60a082015292915050565b6000602082840312156155b557600080fd5b81516001600160401b038111156155cb57600080fd5b613bf7848285016154c9565b634e487b7160e01b600052601260045260246000fd5b600063ffffffff80841680615604576156046155d7565b92169190910492915050565b63ffffffff81811683821602808216919082811461563057615630614f61565b505092915050565b6000806040838503121561564b57600080fd5b61565483614e3b565b915060208301516001600160401b0381111561566f57600080fd5b614991858286016154c9565b7f19457468657265756d205369676e6564204d6573736167653a0a0000000000008152600083516156b381601a85016020880161441c565b8351908301906156ca81601a84016020880161441c565b01601a01949350505050565b6000826156e5576156e56155d7565b500490565b808202811582820484141761211657612116614f61565b634e487b7160e01b600052602160045260246000fdfe360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220623545b3dab397b31826b23d976cdd61294c2b5d63977c281b5bba2b46d587ee64736f6c63430008110033496e697469616c697a61626c653a20636f6e747261637420697320616c7265617f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498", + "deployedBytecode": "0x6080604052600436106102ca5760003560e01c80637bb7bed11161017b578063b9d81abc116100d7578063e1394f7d11610085578063e1394f7d14610922578063e21f37ce14610942578063e74b981b14610964578063f2f4eb2614610984578063f6e6bb62146109a4578063fb1d2329146109c4578063feba1ed2146109e457600080fd5b8063b9d81abc1461080e578063ba5c3a9d1461082e578063bfe1092814610867578063c14007a014610887578063c53e7dab146108b5578063d0ff94b2146108d5578063d7fa5625146108f557600080fd5b80639af1d35a116101345780639af1d35a14610720578063a218404014610736578063a2686e2314610756578063a70b9f0c14610776578063aa529617146107a1578063ab37f486146107c1578063ae23bf28146107ee57600080fd5b80637bb7bed1146106445780637ecebe00146106645780638a4bd4b21461069157806392ccb581146106b157806395d3d5d8146106d157806396b3ce54146106f357600080fd5b80633d18678e1161022a57806358beb884116101e357806358beb8841461055d5780636c1550b11461057d5780636cca84bd146105aa578063734e7fb9146105ca578063752e8749146105ea57806376cd7cbc146106025780637b74691e1461062257600080fd5b80633d18678e146104a857806346904840146104c85780634d5aedbf146104f55780634f1ef2861461051557806352d1902d14610528578063586db1f51461053d57600080fd5b806317418a221161028757806317418a22146103c25780631794bb3c146103d75780632acd7ec4146103f7578063304440171461043257806334f150b7146104485780633659cfe614610468578063368b87721461048857600080fd5b80630241d8f9146102cf57806303d2944c146102f15780630db38252146103115780630f44380d146103475780631136b89514610374578063141df503146103a2575b600080fd5b3480156102db57600080fd5b506102ef6102ea366004613f96565b610a11565b005b3480156102fd57600080fd5b506102ef61030c366004613fc2565b610af8565b34801561031d57600080fd5b5061033161032c36600461436e565b610bf7565b60405161033e919061466d565b60405180910390f35b34801561035357600080fd5b50610367610362366004614680565b610e2e565b60405161033e91906146f2565b34801561038057600080fd5b5061039461038f366004614705565b610e56565b60405161033e929190614750565b3480156103ae57600080fd5b506102ef6103bd3660046147b6565b610e8c565b3480156103ce57600080fd5b50610367611003565b3480156103e357600080fd5b506102ef6103f2366004614801565b611030565b34801561040357600080fd5b50610424610412366004613fc2565b60a36020526000908152604090205481565b60405190815260200161033e565b34801561043e57600080fd5b50610424609c5481565b34801561045457600080fd5b50610394610463366004614842565b6111dc565b34801561047457600080fd5b506102ef610483366004613fc2565b61120b565b34801561049457600080fd5b506102ef6104a336600461487b565b6112d3565b3480156104b457600080fd5b506102ef6104c33660046148c3565b6113b8565b3480156104d457600080fd5b506099546104e8906001600160a01b031681565b60405161033e91906148dc565b34801561050157600080fd5b506103946105103660046148f0565b6114a5565b6102ef61052336600461494c565b6114d0565b34801561053457600080fd5b50610424611589565b34801561054957600080fd5b5061039461055836600461499b565b611637565b34801561056957600080fd5b506104246105783660046149fd565b611659565b34801561058957600080fd5b5061059d610598366004614a65565b611678565b60405161033e9190614b15565b3480156105b657600080fd5b506102ef6105c5366004613fc2565b6117a1565b3480156105d657600080fd5b506103676105e5366004614842565b6118a4565b3480156105f657600080fd5b50610424633b9aca0081565b34801561060e57600080fd5b506102ef61061d366004614b59565b6118c5565b34801561062e57600080fd5b506106376118cf565b60405161033e9190614b9a565b34801561065057600080fd5b506104e861065f3660046148c3565b611b52565b34801561067057600080fd5b5061042461067f366004613fc2565b60a06020526000908152604090205481565b34801561069d57600080fd5b506103676106ac366004613fc2565b611b7c565b3480156106bd57600080fd5b506103946106cc366004614bfc565b611b9c565b3480156106dd57600080fd5b506106e6611bbd565b60405161033e9190614c1c565b3480156106ff57600080fd5b5061042461070e366004613fc2565b60a16020526000908152604090205481565b34801561072c57600080fd5b50610424609a5481565b34801561074257600080fd5b506102ef610751366004614c67565b611cde565b34801561076257600080fd5b506102ef610771366004613fc2565b611f30565b34801561078257600080fd5b5061078c610e1081565b60405163ffffffff909116815260200161033e565b3480156107ad57600080fd5b506103946107bc3660046148f0565b612033565b3480156107cd57600080fd5b506104246107dc366004613fc2565b609f6020526000908152604090205481565b3480156107fa57600080fd5b50610367610809366004614cd2565b612062565b34801561081a57600080fd5b5061042461082936600461436e565b61208b565b34801561083a57600080fd5b5061084e6108493660046148c3565b61211c565b60405161033e9d9c9b9a99989796959493929190614cf0565b34801561087357600080fd5b506098546104e8906001600160a01b031681565b34801561089357600080fd5b506108a76108a236600461436e565b612249565b60405161033e929190614d9c565b3480156108c157600080fd5b506103946108d0366004614db7565b612323565b3480156108e157600080fd5b506103676108f0366004614cd2565b612342565b34801561090157600080fd5b50610424610910366004613fc2565b60a26020526000908152604090205481565b34801561092e57600080fd5b5061036761093d366004614680565b612351565b34801561094e57600080fd5b50610957612372565b60405161033e9190614e28565b34801561097057600080fd5b506102ef61097f366004613fc2565b612400565b34801561099057600080fd5b506097546104e8906001600160a01b031681565b3480156109b057600080fd5b506103946109bf366004614705565b6124d8565b3480156109d057600080fd5b506103676109df366004614bfc565b6124f6565b3480156109f057600080fd5b506104246109ff366004613fc2565b609e6020526000908152604090205481565b60975460405163521d4de960e01b81526001600160a01b039091169063521d4de990610a419033906004016148dc565b602060405180830381865afa158015610a5e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a829190614e4b565b610a9f57604051632678482f60e21b815260040160405180910390fd5b6001600160a01b0382166000818152609e602052604090819020839055517fab1d37d0b21937f334fc4164d147abbfdbfd7ef37ab9ea0ae73f2a58ffb7f1cc90610aec9084815260200190565b60405180910390a25050565b60975460405163521d4de960e01b81526001600160a01b039091169063521d4de990610b289033906004016148dc565b602060405180830381865afa158015610b45573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b699190614e4b565b610b8657604051632678482f60e21b815260040160405180910390fd5b6001600160a01b038116610bad57604051633494a40d60e21b815260040160405180910390fd5b609880546001600160a01b0319166001600160a01b0383169081179091556040517fc0ebb188f905d128bcd7e4282dd1f9cf24cd331b69071002e488349aca6a867b90600090a250565b610bff613d6c565b81816000018190525081602001516001600160a01b031663ddca3f436040518163ffffffff1660e01b8152600401602060405180830381865afa925050508015610c66575060408051601f3d908101601f19168201909252610c6391810190614e79565b60015b610c765760006020820152610c81565b62ffffff1660208201525b610cf482602001516001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa158015610cc6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cea9190614e9f565b8360200151612514565b8160400181905250610d4182602001516001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa158015610cc6573d6000803e3d6000fd5b816060018190525081604001516001600160a01b03166395d89b416040518163ffffffff1660e01b8152600401600060405180830381865afa158015610d8b573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610db39190810190614f01565b816080018190525081604001516001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015610dfd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e219190614f46565b60ff1660a0820152919050565b6060610e4f6000610e3e8461267c565b63ffffffff600063ffffffff612695565b5092915050565b6060600080610e648661267c565b9050610e7f600082610e78610e1082614f77565b8888612695565b9250925050935093915050565b60975460405163521d4de960e01b81526001600160a01b039091169063521d4de990610ebc9033906004016148dc565b602060405180830381865afa158015610ed9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610efd9190614e4b565b610f1a57604051632678482f60e21b815260040160405180910390fd5b8160005b81811015610ffc57610ff483868684818110610f3c57610f3c614f94565b9050602002016020810190610f519190613fc2565b6001600160a01b03166370a08231306040518263ffffffff1660e01b8152600401610f7c91906148dc565b602060405180830381865afa158015610f99573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fbd9190614faa565b878785818110610fcf57610fcf614f94565b9050602002016020810190610fe49190613fc2565b6001600160a01b03169190612a9c565b600101610f1e565b5050505050565b606060006110104261267c565b9050610e4f600082611024610e1082614f77565b600063ffffffff612695565b600054610100900460ff16158080156110505750600054600160ff909116105b80611071575061105f30612505565b158015611071575060005460ff166001145b6110d95760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084015b60405180910390fd5b6000805460ff1916600117905580156110fc576000805461ff0019166101001790555b6001600160a01b038416158061111957506001600160a01b038316155b156111375760405163d92e233d60e01b815260040160405180910390fd5b633b9aca00821061115b57604051633494a40d60e21b815260040160405180910390fd5b609880546001600160a01b038086166001600160a01b0319928316179092556097805492871692909116919091179055609a82905580156111d6576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50505050565b60606000806111ea4261267c565b90506111fe600082610e78610e1082614f77565b92509250505b9250929050565b6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001630036112535760405162461bcd60e51b81526004016110d090614fc3565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316611285612b04565b6001600160a01b0316146112ab5760405162461bcd60e51b81526004016110d09061500f565b6112b481612b20565b604080516000808252602082019092526112d091839190612bc3565b50565b60975460405163521d4de960e01b81526001600160a01b039091169063521d4de9906113039033906004016148dc565b602060405180830381865afa158015611320573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113449190614e4b565b61136157604051632678482f60e21b815260040160405180910390fd5b609b61136d82826150db565b50600061137982612d2e565b609c8190556040518181529091507fde3dc3335dea4d1a1060ef6cefcfcc109eb0a1e78ce151818d3f17a01e1f8a059060200160405180910390a15050565b60975460405163521d4de960e01b81526001600160a01b039091169063521d4de9906113e89033906004016148dc565b602060405180830381865afa158015611405573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114299190614e4b565b61144657604051632678482f60e21b815260040160405180910390fd5b633b9aca00811061146a57604051633494a40d60e21b815260040160405180910390fd5b609a8190556040518181527f3346af6da1932164d501f2ec28f8c5d686db5828a36b77f2da4332d89184fe7b9060200160405180910390a150565b606060006114c2866114b68761267c565b63ffffffff8787612695565b915091505b94509492505050565b6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001630036115185760405162461bcd60e51b81526004016110d090614fc3565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031661154a612b04565b6001600160a01b0316146115705760405162461bcd60e51b81526004016110d09061500f565b61157982612b20565b61158582826001612bc3565b5050565b6000306001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146116245760405162461bcd60e51b815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c6044820152771b1959081d1a1c9bdd59da0819195b1959d85d1958d85b1b60421b60648201526084016110d0565b5060008051602061571883398151915290565b606060006114c260006116498861267c565b6116528861267c565b8787612695565b60006116658383612d69565b61166e84612e25565b90505b9392505050565b33600090815260a260205260409020546060901580156116a95750609c5433600090815260a1602052604090205414155b80156116c2575032600090815260a26020526040902054155b80156116df5750609c5432600090815260a1602052604090205414155b156116fd576040516314e52a5b60e31b815260040160405180910390fd5b81516000816001600160401b0381111561171957611719613fdf565b604051908082528060200260200182016040528015611742578160200160208202803683370190505b50905060005b828110156117975761177285828151811061176557611765614f94565b6020026020010151612e25565b82828151811061178457611784614f94565b6020908102919091010152600101611748565b509150505b919050565b60975460405163521d4de960e01b81526001600160a01b039091169063521d4de9906117d19033906004016148dc565b602060405180830381865afa1580156117ee573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118129190614e4b565b61182f57604051632678482f60e21b815260040160405180910390fd5b6001600160a01b0381166000908152609f602052604081205461185390600161519a565b6001600160a01b0383166000818152609f60205260409081902083905551919250907fc6cd32b1acffa550abf886a9b443ff3ce485bfdb05e35ef5b26e745739a1eac190610aec9084815260200190565b60606118bd60006118b48561267c565b6110248561267c565b509392505050565b6115858282612d69565b6060609d805480602002602001604051908101604052809291908181526020016000905b82821015611b49576000848152602090819020604080516101e081018252600986029092018054835260018101546001600160a01b039081168486015260028201541683830152600381015460608401526004810180548351818702810187019094528084529394919360808601939283018282801561199c57602002820191906000526020600020905b81546001600160a01b0316815260019091019060200180831161197e575b5050505050815260200160058201805480602002602001604051908101604052809291908181526020018280548015611a2057602002820191906000526020600020906000905b82829054906101000a900463ffffffff1663ffffffff16815260200190600401906020826003010492830192600103820291508084116119e35790505b5050509183525050600682015463ffffffff8082166020840152600160201b820481166040840152600160401b820481166060840152600160601b820481166080840152600160801b8204811660a0840152600160a01b8204811660c0840152600160c01b9091041660e082015260078201546001600160a01b031661010082015260088201805461012090920191611ab89061505b565b80601f0160208091040260200160405190810160405280929190818152602001828054611ae49061505b565b8015611b315780601f10611b0657610100808354040283529160200191611b31565b820191906000526020600020905b815481529060010190602001808311611b1457829003601f168201915b505050505081525050815260200190600101906118f3565b50505050905090565b60a48181548110611b6257600080fd5b6000918252602090912001546001600160a01b0316905081565b60606000611b894261267c565b90506117978382611024610e1082614f77565b6060600080611baa4261267c565b9050610e7f8682610e78610e1082614f77565b60a45460609060009081816001600160401b03811115611bdf57611bdf613fdf565b604051908082528060200260200182016040528015611c2457816020015b6040805180820190915260008082526020820152815260200190600190039081611bfd5790505b50905060005b828163ffffffff161015611cd457600060a48263ffffffff1681548110611c5357611c53614f94565b60009182526020808320909101546001600160a01b031680835260a39091526040909120549091508015611cca576040518060400160405280836001600160a01b0316815260200182815250848781518110611cb157611cb1614f94565b6020908102919091010152611cc76001876151ad565b95505b5050600101611c2a565b5091825250919050565b60975460405163521d4de960e01b81526001600160a01b039091169063521d4de990611d0e9033906004016148dc565b602060405180830381865afa158015611d2b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d4f9190614e4b565b611d6c57604051632678482f60e21b815260040160405180910390fd5b82818114611d8d57604051631df89e8b60e01b815260040160405180910390fd5b60005b81811015611f28576000848483818110611dac57611dac614f94565b905060200201359050600081118015611e07575060a36000888885818110611dd657611dd6614f94565b9050602002016020810190611deb9190613fc2565b6001600160a01b03168152602081019190915260400160002054155b15611e685760a4878784818110611e2057611e20614f94565b9050602002016020810190611e359190613fc2565b81546001810183556000928352602090922090910180546001600160a01b0319166001600160a01b039092169190911790555b8060a36000898986818110611e7f57611e7f614f94565b9050602002016020810190611e949190613fc2565b6001600160a01b03168152602081019190915260400160002055868683818110611ec057611ec0614f94565b9050602002016020810190611ed59190613fc2565b6001600160a01b03167f3a5e6418e38cae10bf66eaf3e68c4e9c6b14df195e24fec169ab3a5b123c96e582604051611f0f91815260200190565b60405180910390a250611f21816151c0565b9050611d90565b505050505050565b60975460405163521d4de960e01b81526001600160a01b039091169063521d4de990611f609033906004016148dc565b602060405180830381865afa158015611f7d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fa19190614e4b565b611fbe57604051632678482f60e21b815260040160405180910390fd5b6001600160a01b038116600090815260a26020526040812054611fe290600161519a565b6001600160a01b038316600081815260a260205260409081902083905551919250907f9c759941da0b7ce56c059c1497218796e62035024afb77a00ff49a980a62078f90610aec9084815260200190565b60606000806120418661267c565b90506120548782610e78610e1082614f77565b925092505094509492505050565b6060600061206f8361267c565b90506120828482611024610e1082614f77565b50949350505050565b33600090815260a260205260408120541580156120b95750609c5433600090815260a1602052604090205414155b80156120d2575032600090815260a26020526040902054155b80156120ef5750609c5432600090815260a1602052604090205414155b1561210d576040516314e52a5b60e31b815260040160405180910390fd5b61211682612e25565b92915050565b609d818154811061212c57600080fd5b600091825260209091206009909102018054600182015460028301546003840154600685015460078601546008870180549698506001600160a01b039586169794861696939563ffffffff80851696600160201b8604821696600160401b8704831696600160601b8104841696600160801b8204851696600160a01b8304861696600160c01b90930490951694911692916121c69061505b565b80601f01602080910402602001604051908101604052809291908181526020018280546121f29061505b565b801561223f5780601f106122145761010080835404028352916020019161223f565b820191906000526020600020905b81548152906001019060200180831161222257829003601f168201915b505050505090508d565b6000612253613d6c565b600080306001600160a01b0316630db3825260e01b8660405160240161227991906151d9565b60408051601f198184030181529181526020820180516001600160e01b03166001600160e01b03199094169390931790925290516122b791906151ec565b600060405180830381855af49150503d80600081146122f2576040519150601f19603f3d011682016040523d82523d6000602084013e6122f7565b606091505b5091509150819350831561231c578080602001905181019061231991906155a3565b92505b5050915091565b60606000612334876116498861267c565b915091509550959350505050565b60606118bd83610e3e8461267c565b6060600061235e8361267c565b9050611797600082611024610e1082614f77565b609b805461237f9061505b565b80601f01602080910402602001604051908101604052809291908181526020018280546123ab9061505b565b80156123f85780601f106123cd576101008083540402835291602001916123f8565b820191906000526020600020905b8154815290600101906020018083116123db57829003601f168201915b505050505081565b60975460405163521d4de960e01b81526001600160a01b039091169063521d4de9906124309033906004016148dc565b602060405180830381865afa15801561244d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124719190614e4b565b61248e57604051632678482f60e21b815260040160405180910390fd5b609980546001600160a01b0319166001600160a01b0383169081179091556040517f7a7b5a0a132f9e0581eb8527f66eae9ee89c2a3e79d4ac7e41a1f1f4d48a7fc290600090a250565b606060006124ea60006114b68761267c565b91509150935093915050565b6060612082846118b48561267c565b6001600160a01b03163b151590565b61251c613e22565b6001600160a01b0383168082526040805163313ce56760e01b8152905163313ce567916004808201926020929091908290030181865afa158015612564573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125889190614f46565b60ff166020820152604080516395d89b4160e01b815290516001600160a01b038516916395d89b419160048083019260009291908290030181865afa1580156125d5573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526125fd9190810190614f01565b604080830191909152516370a0823160e01b81526001600160a01b038416906370a08231906126309085906004016148dc565b602060405180830381865afa15801561264d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126719190614faa565b606082015292915050565b6000610e1061268b81846155ed565b6121169190615610565b609d5460609060009081908163ffffffff861682106126ba578563ffffffff166126bc565b815b90506000816001600160401b038111156126d8576126d8613fdf565b60405190808252806020026020018201604052801561271157816020015b6126fe613d6c565b8152602001906001900390816126f65790505b509050875b838163ffffffff161015612a82576000609d8263ffffffff168154811061273f5761273f614f94565b6000918252602091829020604080516101e08101825260099093029091018054835260018101546001600160a01b03908116848601526002820154168383015260038101546060840152600481018054835181870281018701909452808452939491936080860193928301828280156127e157602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116127c3575b505050505081526020016005820180548060200260200160405190810160405280929190818152602001828054801561286557602002820191906000526020600020906000905b82829054906101000a900463ffffffff1663ffffffff16815260200190600401906020826003010492830192600103820291508084116128285790505b5050509183525050600682015463ffffffff8082166020840152600160201b820481166040840152600160401b820481166060840152600160601b820481166080840152600160801b8204811660a0840152600160a01b8204811660c0840152600160c01b9091041660e082015260078201546001600160a01b0316610100820152600882018054610120909201916128fd9061505b565b80601f01602080910402602001604051908101604052809291908181526020018280546129299061505b565b80156129765780601f1061294b57610100808354040283529160200191612976565b820191906000526020600020905b81548152906001019060200180831161295957829003601f168201915b505050505081525050905061298c818d8d613465565b80156129be57506001600160a01b038d1615806129be57508c6001600160a01b031681602001516001600160a01b0316145b15612a695760405163060a003d60e51b81526000908190309063c14007a0906129eb9086906004016151d9565b600060405180830381865afa158015612a08573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052612a309190810190615638565b915091508115612a665780858981518110612a4d57612a4d614f94565b6020908102919091010152612a636001896151ad565b97505b50505b816001019150838603612a7c5750612a82565b50612716565b9381529a63ffffffff909316995091975050505050505050565b6040516001600160a01b038316602482015260448101829052612aff90849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526134bb565b505050565b600080516020615718833981519152546001600160a01b031690565b6097546001600160a01b03168015801590612ba5575060405163521d4de960e01b81526001600160a01b0382169063521d4de990612b629033906004016148dc565b602060405180830381865afa158015612b7f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612ba39190614e4b565b155b1561158557604051632678482f60e21b815260040160405180910390fd5b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff1615612bf657612aff8361358d565b826001600160a01b03166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa925050508015612c50575060408051601f3d908101601f19168201909252612c4d91810190614faa565b60015b612cb35760405162461bcd60e51b815260206004820152602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201526d6f6e206973206e6f74205555505360901b60648201526084016110d0565b6000805160206157188339815191528114612d225760405162461bcd60e51b815260206004820152602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f786044820152681a58589b195555525160ba1b60648201526084016110d0565b50612aff838383613627565b6000612d3a825161364c565b82604051602001612d4c92919061567b565b604051602081830303815290604052805190602001209050919050565b609c54604080516020601f85018190048102820181019092528381523391612dad91849187908790819084018382808284376000920191909152506136de92505050565b6001600160a01b031614612dd457604051638baa579f60e01b815260040160405180910390fd5b33600081815260a1602052604090819020839055517fc48bbd4f009ad78a336beb65bf44688651e9aa52ac98d9054f0fce0573fefbc390612e189084815260200190565b60405180910390a2505050565b6000612e2f6136fa565b6000612e3f83610120015161267c565b6040808501516001600160a01b0316600090815260a3602052205463ffffffff821661012086015290915042612e77610e1084614f77565b63ffffffff161080612e92575061014084015163ffffffff16155b80612ec857508360e001518460c00151856101000151612eb29190614f77565b612ebc9190614f77565b63ffffffff1661271014155b80612ef757506101a08401516001600160a01b031615801590612ef7575061271084610180015163ffffffff16105b80612f0c57508360a001515184608001515114155b80612f15575080155b80612f3957508084610140015163ffffffff168560600151612f3791906156d6565b105b15612f57576040516314414f4160e11b815260040160405180910390fd5b6060840151336000908152609e6020526040902054909350633b9aca00811080156130035750609f600086602001516001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa158015612fc3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612fe79190614e9f565b6001600160a01b03168152602081019190915260400160002054155b80156130905750609f600086602001516001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa158015613050573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906130749190614e9f565b6001600160a01b03168152602081019190915260400160002054155b15613134576000633b9aca006130a6838261519a565b609a546130b391906156ea565b6130bd91906156d6565b90506000633b9aca006130d0838261519a565b6130da90886156ea565b6130e491906156d6565b6099549091506001600160a01b031680156130ff5780613101565b305b90506131283382613112858b61519a565b60408c01516001600160a01b0316929190613753565b50606087018190529450505b6098546040860151613155916001600160a01b039182169133911687613753565b33600090815260a060205260409020546131708160016151ad565b33600081815260a0602090815260409182902093909355516131b19284910160609290921b6bffffffffffffffffffffffff19168252601482015260340190565b60408051808303601f1901815291815281516020928301208852609d805460018101825560009190915288517fd26e832454299e9fabb89e0e5fffdc046d4e14431bc1bf607ffb2e8a1ddecf7b6009909202918201908155898401517fd26e832454299e9fabb89e0e5fffdc046d4e14431bc1bf607ffb2e8a1ddecf7c830180546001600160a01b03199081166001600160a01b0393841617909155938b01517fd26e832454299e9fabb89e0e5fffdc046d4e14431bc1bf607ffb2e8a1ddecf7d8401805490951691161790925560608901517fd26e832454299e9fabb89e0e5fffdc046d4e14431bc1bf607ffb2e8a1ddecf7e820155608089015180518a946132df937fd26e832454299e9fabb89e0e5fffdc046d4e14431bc1bf607ffb2e8a1ddecf7f01920190613e56565b5060a082015180516132fb916005840191602090910190613ebb565b5060c082015160068201805460e08501516101008601516101208701516101408801516101608901516101808a015163ffffffff98891667ffffffffffffffff1990971696909617600160201b958916959095029490941767ffffffffffffffff60401b1916600160401b9388169390930263ffffffff60601b191692909217600160601b918716919091021767ffffffffffffffff60801b1916600160801b9186169190910263ffffffff60a01b191617600160a01b918516919091021763ffffffff60c01b1916600160c01b93909116929092029190911790556101a08201516007820180546001600160a01b0319166001600160a01b039092169190911790556101c0820151600882019061341390826150db565b505050336001600160a01b03167f5280c74029ecceb35e4fecf34adee487fd5a9a3d6c8e70b7374a1c133370e83a8760405161344f91906151d9565b60405180910390a25050505061179c6001606555565b60008084610120015163ffffffff1690508363ffffffff16610e108661014001516134909190615610565b6134a09063ffffffff16836151ad565b1180156134b257508263ffffffff1681105b95945050505050565b6000613510826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661378b9092919063ffffffff16565b805190915015612aff578080602001905181019061352e9190614e4b565b612aff5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016110d0565b61359681612505565b6135f85760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b60648201526084016110d0565b60008051602061571883398151915280546001600160a01b0319166001600160a01b0392909216919091179055565b6136308361379a565b60008251118061363d5750805b15612aff576111d683836137da565b60606000613659836138c3565b60010190506000816001600160401b0381111561367857613678613fdf565b6040519080825280601f01601f1916602001820160405280156136a2576020820181803683370190505b5090508181016020015b600019016f181899199a1a9b1b9c1cb0b131b232b360811b600a86061a8153600a85049450846136ac57509392505050565b60008060006136ed858561399b565b915091506118bd816139dd565b60026065540361374c5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016110d0565b6002606555565b6040516001600160a01b03808516602483015283166044820152606481018290526111d69085906323b872dd60e01b90608401612ac8565b606061166e8484600085613b22565b6137a38161358d565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b60606137e583612505565b6138405760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b60648201526084016110d0565b600080846001600160a01b03168460405161385b91906151ec565b600060405180830381855af49150503d8060008114613896576040519150601f19603f3d011682016040523d82523d6000602084013e61389b565b606091505b50915091506134b2828260405180606001604052806027815260200161573860279139613bff565b60008072184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b83106139025772184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b830492506040015b6d04ee2d6d415b85acef8100000000831061392e576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc10000831061394c57662386f26fc10000830492506010015b6305f5e1008310613964576305f5e100830492506008015b612710831061397857612710830492506004015b6064831061398a576064830492506002015b600a83106121165760010192915050565b60008082516041036139d15760208301516040840151606085015160001a6139c587828585613c18565b94509450505050611204565b50600090506002611204565b60008160048111156139f1576139f1615701565b036139f95750565b6001816004811115613a0d57613a0d615701565b03613a555760405162461bcd60e51b815260206004820152601860248201527745434453413a20696e76616c6964207369676e617475726560401b60448201526064016110d0565b6002816004811115613a6957613a69615701565b03613ab65760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e6774680060448201526064016110d0565b6003816004811115613aca57613aca615701565b036112d05760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b60648201526084016110d0565b606082471015613b835760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016110d0565b600080866001600160a01b03168587604051613b9f91906151ec565b60006040518083038185875af1925050503d8060008114613bdc576040519150601f19603f3d011682016040523d82523d6000602084013e613be1565b606091505b5091509150613bf287838387613ccf565b925050505b949350505050565b60608315613c0e575081611671565b6116718383613d42565b6000806fa2a8918ca85bafe22016d0b997e4df60600160ff1b03831115613c4557506000905060036114c7565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015613c99573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116613cc2576000600192509250506114c7565b9660009650945050505050565b60608315613d3c578251600003613d3557613ce985612505565b613d355760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016110d0565b5081613bf7565b613bf783835b815115613d525781518083602001fd5b8060405162461bcd60e51b81526004016110d09190614e28565b604080516102a081018252600060c0820181815260e083018290526101008301829052610120830182905260606101408401819052610160840181905261018084018390526101a084018390526101c084018390526101e08401839052610200840183905261022084018390526102408401839052610260840183905261028084015282526020820152908101613e01613e22565b8152602001613e0e613e22565b815260606020820152600060409091015290565b604051806080016040528060006001600160a01b03168152602001600060ff16815260200160608152602001600081525090565b828054828255906000526020600020908101928215613eab579160200282015b82811115613eab57825182546001600160a01b0319166001600160a01b03909116178255602090920191600190910190613e76565b50613eb7929150613f61565b5090565b82805482825590600052602060002090600701600890048101928215613eab5791602002820160005b83821115613f2857835183826101000a81548163ffffffff021916908363ffffffff1602179055509260200192600401602081600301049283019260010302613ee4565b8015613f585782816101000a81549063ffffffff0219169055600401602081600301049283019260010302613f28565b5050613eb79291505b5b80821115613eb75760008155600101613f62565b6001600160a01b03811681146112d057600080fd5b803561179c81613f76565b60008060408385031215613fa957600080fd5b8235613fb481613f76565b946020939093013593505050565b600060208284031215613fd457600080fd5b813561167181613f76565b634e487b7160e01b600052604160045260246000fd5b6040516101e081016001600160401b038111828210171561401857614018613fdf565b60405290565b60405160c081016001600160401b038111828210171561401857614018613fdf565b604051601f8201601f191681016001600160401b038111828210171561406857614068613fdf565b604052919050565b60006001600160401b0382111561408957614089613fdf565b5060051b60200190565b600082601f8301126140a457600080fd5b813560206140b96140b483614070565b614040565b82815260059290921b840181019181810190868411156140d857600080fd5b8286015b848110156140fc5780356140ef81613f76565b83529183019183016140dc565b509695505050505050565b63ffffffff811681146112d057600080fd5b803561179c81614107565b600082601f83011261413557600080fd5b813560206141456140b483614070565b82815260059290921b8401810191818101908684111561416457600080fd5b8286015b848110156140fc57803561417b81614107565b8352918301918301614168565b60006001600160401b038211156141a1576141a1613fdf565b50601f01601f191660200190565b60006141bd6140b484614188565b90508281528383830111156141d157600080fd5b828260208301376000602084830101529392505050565b600082601f8301126141f957600080fd5b611671838335602085016141af565b60006101e0828403121561421b57600080fd5b614223613ff5565b90508135815261423560208301613f8b565b602082015261424660408301613f8b565b60408201526060820135606082015260808201356001600160401b038082111561426f57600080fd5b61427b85838601614093565b608084015260a084013591508082111561429457600080fd5b6142a085838601614124565b60a08401526142b160c08501614119565b60c08401526142c260e08501614119565b60e084015261010091506142d7828501614119565b8284015261012091506142eb828501614119565b8284015261014091506142ff828501614119565b828401526101609150614313828501614119565b828401526101809150614327828501614119565b828401526101a0915061433b828501613f8b565b828401526101c09150818401358181111561435557600080fd5b614361868287016141e8565b8385015250505092915050565b60006020828403121561438057600080fd5b81356001600160401b0381111561439657600080fd5b613bf784828501614208565b600081518084526020808501945080840160005b838110156143db5781516001600160a01b0316875295820195908201906001016143b6565b509495945050505050565b600081518084526020808501945080840160005b838110156143db57815163ffffffff16875295820195908201906001016143fa565b60005b8381101561443757818101518382015260200161441f565b50506000910152565b6000815180845261445881602086016020860161441c565b601f01601f19169290920160200192915050565b60006101e082518452602083015161448f60208601826001600160a01b03169052565b5060408301516144aa60408601826001600160a01b03169052565b506060830151606085015260808301518160808601526144cc828601826143a2565b91505060a083015184820360a08601526144e682826143e6565b91505060c083015161450060c086018263ffffffff169052565b5060e083015161451860e086018263ffffffff169052565b506101008381015163ffffffff9081169186019190915261012080850151821690860152610140808501518216908601526101608085015182169086015261018080850151909116908501526101a0808401516001600160a01b0316908501526101c080840151858303828701526145908382614440565b9695505050505050565b60018060a01b03815116825260ff602082015116602083015260006040820151608060408501526145ce6080850182614440565b606093840151949093019390935250919050565b6000815160c084526145f760c085018261446c565b905062ffffff60208401511660208501526040830151848203604086015261461f828261459a565b91505060608301518482036060860152614639828261459a565b915050608083015184820360808601526146538282614440565b91505060ff60a08401511660a08501528091505092915050565b60208152600061167160208301846145e2565b60006020828403121561469257600080fd5b813561167181614107565b600081518084526020808501808196508360051b8101915082860160005b858110156146e55782840389526146d38483516145e2565b988501989350908401906001016146bb565b5091979650505050505050565b602081526000611671602083018461469d565b60008060006060848603121561471a57600080fd5b833561472581614107565b9250602084013561473581614107565b9150604084013561474581614107565b809150509250925092565b604081526000614763604083018561469d565b90508260208301529392505050565b60008083601f84011261478457600080fd5b5081356001600160401b0381111561479b57600080fd5b6020830191508360208260051b850101111561120457600080fd5b6000806000604084860312156147cb57600080fd5b83356001600160401b038111156147e157600080fd5b6147ed86828701614772565b909450925050602084013561474581613f76565b60008060006060848603121561481657600080fd5b833561482181613f76565b9250602084013561483181613f76565b929592945050506040919091013590565b6000806040838503121561485557600080fd5b823561486081614107565b9150602083013561487081614107565b809150509250929050565b60006020828403121561488d57600080fd5b81356001600160401b038111156148a357600080fd5b8201601f810184136148b457600080fd5b613bf7848235602084016141af565b6000602082840312156148d557600080fd5b5035919050565b6001600160a01b0391909116815260200190565b6000806000806080858703121561490657600080fd5b843561491181613f76565b9350602085013561492181614107565b9250604085013561493181614107565b9150606085013561494181614107565b939692955090935050565b6000806040838503121561495f57600080fd5b823561496a81613f76565b915060208301356001600160401b0381111561498557600080fd5b614991858286016141e8565b9150509250929050565b600080600080608085870312156149b157600080fd5b843561491181614107565b60008083601f8401126149ce57600080fd5b5081356001600160401b038111156149e557600080fd5b60208301915083602082850101111561120457600080fd5b600080600060408486031215614a1257600080fd5b83356001600160401b0380821115614a2957600080fd5b614a3587838801614208565b94506020860135915080821115614a4b57600080fd5b50614a58868287016149bc565b9497909650939450505050565b60006020808385031215614a7857600080fd5b82356001600160401b0380821115614a8f57600080fd5b818501915085601f830112614aa357600080fd5b8135614ab16140b482614070565b81815260059190911b83018401908481019088831115614ad057600080fd5b8585015b83811015614b0857803585811115614aec5760008081fd5b614afa8b89838a0101614208565b845250918601918601614ad4565b5098975050505050505050565b6020808252825182820181905260009190848201906040850190845b81811015614b4d57835183529284019291840191600101614b31565b50909695505050505050565b60008060208385031215614b6c57600080fd5b82356001600160401b03811115614b8257600080fd5b614b8e858286016149bc565b90969095509350505050565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b82811015614bef57603f19888603018452614bdd85835161446c565b94509285019290850190600101614bc1565b5092979650505050505050565b600080600060608486031215614c1157600080fd5b833561472581613f76565b602080825282518282018190526000919060409081850190868401855b828110156146e557815180516001600160a01b03168552860151868501529284019290850190600101614c39565b60008060008060408587031215614c7d57600080fd5b84356001600160401b0380821115614c9457600080fd5b614ca088838901614772565b90965094506020870135915080821115614cb957600080fd5b50614cc687828801614772565b95989497509550505050565b60008060408385031215614ce557600080fd5b823561486081613f76565b8d81526001600160a01b038d811660208301528c166040820152606081018b905263ffffffff8a8116608083015289811660a0830152881660c0820152600063ffffffff881660e083015263ffffffff871661010083015263ffffffff861661012083015263ffffffff85166101408301526001600160a01b0384166101608301526101a0610180830152614d896101a0830184614440565b9f9e505050505050505050505050505050565b821515815260406020820152600061166e60408301846145e2565b600080600080600060a08688031215614dcf57600080fd5b8535614dda81613f76565b94506020860135614dea81614107565b93506040860135614dfa81614107565b92506060860135614e0a81614107565b91506080860135614e1a81614107565b809150509295509295909350565b6020815260006116716020830184614440565b8051801515811461179c57600080fd5b600060208284031215614e5d57600080fd5b61167182614e3b565b805162ffffff8116811461179c57600080fd5b600060208284031215614e8b57600080fd5b61167182614e66565b805161179c81613f76565b600060208284031215614eb157600080fd5b815161167181613f76565b600082601f830112614ecd57600080fd5b8151614edb6140b482614188565b818152846020838601011115614ef057600080fd5b613bf782602083016020870161441c565b600060208284031215614f1357600080fd5b81516001600160401b03811115614f2957600080fd5b613bf784828501614ebc565b805160ff8116811461179c57600080fd5b600060208284031215614f5857600080fd5b61167182614f35565b634e487b7160e01b600052601160045260246000fd5b63ffffffff818116838216019080821115610e4f57610e4f614f61565b634e487b7160e01b600052603260045260246000fd5b600060208284031215614fbc57600080fd5b5051919050565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b19195b1959d85d1958d85b1b60a21b606082015260800190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b6163746976652070726f787960a01b606082015260800190565b600181811c9082168061506f57607f821691505b60208210810361508f57634e487b7160e01b600052602260045260246000fd5b50919050565b601f821115612aff57600081815260208120601f850160051c810160208610156150bc5750805b601f850160051c820191505b81811015611f28578281556001016150c8565b81516001600160401b038111156150f4576150f4613fdf565b61510881615102845461505b565b84615095565b602080601f83116001811461513d57600084156151255750858301515b600019600386901b1c1916600185901b178555611f28565b600085815260208120601f198616915b8281101561516c5788860151825594840194600190910190840161514d565b508582101561518a5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b8181038181111561211657612116614f61565b8082018082111561211657612116614f61565b6000600182016151d2576151d2614f61565b5060010190565b602081526000611671602083018461446c565b600082516151fe81846020870161441c565b9190910192915050565b600082601f83011261521957600080fd5b815160206152296140b483614070565b82815260059290921b8401810191818101908684111561524857600080fd5b8286015b848110156140fc57805161525f81613f76565b835291830191830161524c565b805161179c81614107565b600082601f83011261528857600080fd5b815160206152986140b483614070565b82815260059290921b840181019181810190868411156152b757600080fd5b8286015b848110156140fc5780516152ce81614107565b83529183019183016152bb565b60006101e082840312156152ee57600080fd5b6152f6613ff5565b90508151815261530860208301614e94565b602082015261531960408301614e94565b60408201526060820151606082015260808201516001600160401b038082111561534257600080fd5b61534e85838601615208565b608084015260a084015191508082111561536757600080fd5b61537385838601615277565b60a084015261538460c0850161526c565b60c084015261539560e0850161526c565b60e084015261010091506153aa82850161526c565b8284015261012091506153be82850161526c565b8284015261014091506153d282850161526c565b8284015261016091506153e682850161526c565b8284015261018091506153fa82850161526c565b828401526101a0915061540e828501614e94565b828401526101c09150818401518181111561542857600080fd5b61436186828701614ebc565b60006080828403121561544657600080fd5b604051608081016001600160401b03828210818311171561546957615469613fdf565b816040528293508451915061547d82613f76565b81835261548c60208601614f35565b602084015260408501519150808211156154a557600080fd5b506154b285828601614ebc565b604083015250606083015160608201525092915050565b600060c082840312156154db57600080fd5b6154e361401e565b905081516001600160401b03808211156154fc57600080fd5b615508858386016152db565b835261551660208501614e66565b6020840152604084015191508082111561552f57600080fd5b61553b85838601615434565b6040840152606084015191508082111561555457600080fd5b61556085838601615434565b6060840152608084015191508082111561557957600080fd5b5061558684828501614ebc565b60808301525061559860a08301614f35565b60a082015292915050565b6000602082840312156155b557600080fd5b81516001600160401b038111156155cb57600080fd5b613bf7848285016154c9565b634e487b7160e01b600052601260045260246000fd5b600063ffffffff80841680615604576156046155d7565b92169190910492915050565b63ffffffff81811683821602808216919082811461563057615630614f61565b505092915050565b6000806040838503121561564b57600080fd5b61565483614e3b565b915060208301516001600160401b0381111561566f57600080fd5b614991858286016154c9565b7f19457468657265756d205369676e6564204d6573736167653a0a0000000000008152600083516156b381601a85016020880161441c565b8351908301906156ca81601a84016020880161441c565b01601a01949350505050565b6000826156e5576156e56155d7565b500490565b808202811582820484141761211657612116614f61565b634e487b7160e01b600052602160045260246000fdfe360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220623545b3dab397b31826b23d976cdd61294c2b5d63977c281b5bba2b46d587ee64736f6c63430008110033" +} \ No newline at end of file diff --git a/deployments/thundercore/Distributor.json b/deployments/thundercore/Distributor.json new file mode 100644 index 0000000..3bee383 --- /dev/null +++ b/deployments/thundercore/Distributor.json @@ -0,0 +1,132 @@ +{ + "address": "0x3Ef3D8bA38EBe18DB133cEc108f4D14CE00Dd9Ae", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_logic", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "stateMutability": "payable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "previousAdmin", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "AdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "beacon", + "type": "address" + } + ], + "name": "BeaconUpgraded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "stateMutability": "payable", + "type": "receive" + } + ], + "transactionHash": "0x5ad21d01e616eadb7e90f4e821d571cb7a2824a60352b9e7046df8f52b2e7957", + "receipt": { + "to": null, + "from": "0x9f76a95AA7535bb0893cf88A146396e00ed21A12", + "contractAddress": "0x3Ef3D8bA38EBe18DB133cEc108f4D14CE00Dd9Ae", + "transactionIndex": 3, + "gasUsed": "306987", + "logsBloom": "0x00000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080002000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000800000004000000000000000000000004000000000000000000000000000000000000", + "blockHash": "0xc79949b10719c734a7b115da2971a6b8ab7fdca207cbb5f3295d1a36339bea73", + "transactionHash": "0x5ad21d01e616eadb7e90f4e821d571cb7a2824a60352b9e7046df8f52b2e7957", + "logs": [ + { + "transactionIndex": 3, + "blockNumber": 147784008, + "transactionHash": "0x5ad21d01e616eadb7e90f4e821d571cb7a2824a60352b9e7046df8f52b2e7957", + "address": "0x3Ef3D8bA38EBe18DB133cEc108f4D14CE00Dd9Ae", + "topics": [ + "0xbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b", + "0x000000000000000000000000918261fa5dd9c3b1358ca911792e9bdf3c5cca35" + ], + "data": "0x", + "logIndex": 0, + "blockHash": "0xc79949b10719c734a7b115da2971a6b8ab7fdca207cbb5f3295d1a36339bea73" + } + ], + "blockNumber": 147784008, + "cumulativeGasUsed": "437011", + "status": 1, + "byzantium": true + }, + "args": [ + "0x918261fa5Dd9C3b1358cA911792E9bDF3c5CCa35", + "0x" + ], + "numDeployments": 1, + "solcInputHash": "e77f17fbb4334e4df730b35bdfde2517", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_logic\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"previousAdmin\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"AdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"beacon\",\"type\":\"address\"}],\"name\":\"BeaconUpgraded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"implementation\",\"type\":\"address\"}],\"name\":\"Upgraded\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"details\":\"This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an implementation address that can be changed. This address is stored in storage in the location specified by https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the implementation behind the proxy.\",\"kind\":\"dev\",\"methods\":{\"constructor\":{\"details\":\"Initializes the upgradeable proxy with an initial implementation specified by `_logic`. If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded function call, and allows initializing the storage of the proxy like a Solidity constructor.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol\":\"ERC1967Proxy\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":100000},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/interfaces/draft-IERC1822.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\\n * proxy whose upgrades are fully controlled by the current implementation.\\n */\\ninterface IERC1822Proxiable {\\n /**\\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\\n * address.\\n *\\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\\n * function revert if invoked through a proxy.\\n */\\n function proxiableUUID() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0x1d4afe6cb24200cc4545eed814ecf5847277dfe5d613a1707aad5fceecebcfff\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/ERC1967/ERC1967Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../Proxy.sol\\\";\\nimport \\\"./ERC1967Upgrade.sol\\\";\\n\\n/**\\n * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an\\n * implementation address that can be changed. This address is stored in storage in the location specified by\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the\\n * implementation behind the proxy.\\n */\\ncontract ERC1967Proxy is Proxy, ERC1967Upgrade {\\n /**\\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.\\n *\\n * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded\\n * function call, and allows initializing the storage of the proxy like a Solidity constructor.\\n */\\n constructor(address _logic, bytes memory _data) payable {\\n _upgradeToAndCall(_logic, _data, false);\\n }\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _implementation() internal view virtual override returns (address impl) {\\n return ERC1967Upgrade._getImplementation();\\n }\\n}\\n\",\"keccak256\":\"0xa2b22da3032e50b55f95ec1d13336102d675f341167aa76db571ef7f8bb7975d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/ERC1967/ERC1967Upgrade.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (proxy/ERC1967/ERC1967Upgrade.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../beacon/IBeacon.sol\\\";\\nimport \\\"../../interfaces/draft-IERC1822.sol\\\";\\nimport \\\"../../utils/Address.sol\\\";\\nimport \\\"../../utils/StorageSlot.sol\\\";\\n\\n/**\\n * @dev This abstract contract provides getters and event emitting update functions for\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\\n *\\n * _Available since v4.1._\\n *\\n * @custom:oz-upgrades-unsafe-allow delegatecall\\n */\\nabstract contract ERC1967Upgrade {\\n // This is the keccak-256 hash of \\\"eip1967.proxy.rollback\\\" subtracted by 1\\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\\n\\n /**\\n * @dev Storage slot with the address of the current implementation.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n /**\\n * @dev Emitted when the implementation is upgraded.\\n */\\n event Upgraded(address indexed implementation);\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _getImplementation() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 implementation slot.\\n */\\n function _setImplementation(address newImplementation) private {\\n require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n }\\n\\n /**\\n * @dev Perform implementation upgrade\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeTo(address newImplementation) internal {\\n _setImplementation(newImplementation);\\n emit Upgraded(newImplementation);\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCall(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _upgradeTo(newImplementation);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(newImplementation, data);\\n }\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCallUUPS(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n // Upgrades from old implementations will perform a rollback test. This test requires the new\\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\\n // this special case will break upgrade paths from old UUPS implementation to new ones.\\n if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) {\\n _setImplementation(newImplementation);\\n } else {\\n try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {\\n require(slot == _IMPLEMENTATION_SLOT, \\\"ERC1967Upgrade: unsupported proxiableUUID\\\");\\n } catch {\\n revert(\\\"ERC1967Upgrade: new implementation is not UUPS\\\");\\n }\\n _upgradeToAndCall(newImplementation, data, forceCall);\\n }\\n }\\n\\n /**\\n * @dev Storage slot with the admin of the contract.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.admin\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n /**\\n * @dev Emitted when the admin account has changed.\\n */\\n event AdminChanged(address previousAdmin, address newAdmin);\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _getAdmin() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 admin slot.\\n */\\n function _setAdmin(address newAdmin) private {\\n require(newAdmin != address(0), \\\"ERC1967: new admin is the zero address\\\");\\n StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n */\\n function _changeAdmin(address newAdmin) internal {\\n emit AdminChanged(_getAdmin(), newAdmin);\\n _setAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\\n */\\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\\n\\n /**\\n * @dev Emitted when the beacon is upgraded.\\n */\\n event BeaconUpgraded(address indexed beacon);\\n\\n /**\\n * @dev Returns the current beacon.\\n */\\n function _getBeacon() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_BEACON_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new beacon in the EIP1967 beacon slot.\\n */\\n function _setBeacon(address newBeacon) private {\\n require(Address.isContract(newBeacon), \\\"ERC1967: new beacon is not a contract\\\");\\n require(\\n Address.isContract(IBeacon(newBeacon).implementation()),\\n \\\"ERC1967: beacon implementation is not a contract\\\"\\n );\\n StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon;\\n }\\n\\n /**\\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\\n *\\n * Emits a {BeaconUpgraded} event.\\n */\\n function _upgradeBeaconToAndCall(\\n address newBeacon,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _setBeacon(newBeacon);\\n emit BeaconUpgraded(newBeacon);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xabf3f59bc0e5423eae45e459dbe92e7052c6983628d39008590edc852a62f94a\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (proxy/Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\\n * be specified by overriding the virtual {_implementation} function.\\n *\\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\\n * different contract through the {_delegate} function.\\n *\\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\\n */\\nabstract contract Proxy {\\n /**\\n * @dev Delegates the current call to `implementation`.\\n *\\n * This function does not return to its internal call site, it will return directly to the external caller.\\n */\\n function _delegate(address implementation) internal virtual {\\n assembly {\\n // Copy msg.data. We take full control of memory in this inline assembly\\n // block because it will not return to Solidity code. We overwrite the\\n // Solidity scratch pad at memory position 0.\\n calldatacopy(0, 0, calldatasize())\\n\\n // Call the implementation.\\n // out and outsize are 0 because we don't know the size yet.\\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\\n\\n // Copy the returned data.\\n returndatacopy(0, 0, returndatasize())\\n\\n switch result\\n // delegatecall returns 0 on error.\\n case 0 {\\n revert(0, returndatasize())\\n }\\n default {\\n return(0, returndatasize())\\n }\\n }\\n }\\n\\n /**\\n * @dev This is a virtual function that should be overridden so it returns the address to which the fallback function\\n * and {_fallback} should delegate.\\n */\\n function _implementation() internal view virtual returns (address);\\n\\n /**\\n * @dev Delegates the current call to the address returned by `_implementation()`.\\n *\\n * This function does not return to its internal call site, it will return directly to the external caller.\\n */\\n function _fallback() internal virtual {\\n _beforeFallback();\\n _delegate(_implementation());\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\\n * function in the contract matches the call data.\\n */\\n fallback() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data\\n * is empty.\\n */\\n receive() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`\\n * call, or as part of the Solidity `fallback` or `receive` functions.\\n *\\n * If overridden should call `super._beforeFallback()`.\\n */\\n function _beforeFallback() internal virtual {}\\n}\\n\",\"keccak256\":\"0xc130fe33f1b2132158531a87734153293f6d07bc263ff4ac90e85da9c82c0e27\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/beacon/IBeacon.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\\n */\\ninterface IBeacon {\\n /**\\n * @dev Must return an address that can be used as a delegate call target.\\n *\\n * {BeaconProxy} will check that this address is a contract.\\n */\\n function implementation() external view returns (address);\\n}\\n\",\"keccak256\":\"0xd50a3421ac379ccb1be435fa646d66a65c986b4924f0849839f08692f39dde61\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\n *\\n * _Available since v4.8._\\n */\\n function verifyCallResultFromTarget(\\n address target,\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n if (success) {\\n if (returndata.length == 0) {\\n // only check isContract if the call was successful and the return data is empty\\n // otherwise we already know that it was a contract\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n }\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason or using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xf96f969e24029d43d0df89e59d365f277021dac62b48e1c1e3ebe0acdd7f1ca1\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/StorageSlot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/StorageSlot.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for reading and writing primitive types to specific storage slots.\\n *\\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\\n * This library helps with reading and writing to such slots without the need for inline assembly.\\n *\\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\\n *\\n * Example usage to set ERC1967 implementation slot:\\n * ```\\n * contract ERC1967 {\\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n *\\n * function _getImplementation() internal view returns (address) {\\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n * }\\n *\\n * function _setImplementation(address newImplementation) internal {\\n * require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n * }\\n * }\\n * ```\\n *\\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\\n */\\nlibrary StorageSlot {\\n struct AddressSlot {\\n address value;\\n }\\n\\n struct BooleanSlot {\\n bool value;\\n }\\n\\n struct Bytes32Slot {\\n bytes32 value;\\n }\\n\\n struct Uint256Slot {\\n uint256 value;\\n }\\n\\n /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\\n */\\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\\n */\\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\\n */\\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd5c50c54bf02740ebd122ff06832546cb5fa84486d52695a9ccfd11666e0c81d\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x60806040526040516107ad3803806107ad83398101604081905261002291610319565b61002e82826000610035565b5050610436565b61003e8361006b565b60008251118061004b5750805b156100665761006483836100ab60201b6100291760201c565b505b505050565b610074816100d7565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b60606100d08383604051806060016040528060278152602001610786602791396101a9565b9392505050565b6100ea8161022260201b6100551760201c565b6101515760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b60648201526084015b60405180910390fd5b806101887f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc60001b61023160201b6100711760201c565b80546001600160a01b0319166001600160a01b039290921691909117905550565b6060600080856001600160a01b0316856040516101c691906103e7565b600060405180830381855af49150503d8060008114610201576040519150601f19603f3d011682016040523d82523d6000602084013e610206565b606091505b50909250905061021886838387610234565b9695505050505050565b6001600160a01b03163b151590565b90565b606083156102a357825160000361029c576001600160a01b0385163b61029c5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610148565b50816102ad565b6102ad83836102b5565b949350505050565b8151156102c55781518083602001fd5b8060405162461bcd60e51b81526004016101489190610403565b634e487b7160e01b600052604160045260246000fd5b60005b838110156103105781810151838201526020016102f8565b50506000910152565b6000806040838503121561032c57600080fd5b82516001600160a01b038116811461034357600080fd5b60208401519092506001600160401b038082111561036057600080fd5b818501915085601f83011261037457600080fd5b815181811115610386576103866102df565b604051601f8201601f19908116603f011681019083821181831017156103ae576103ae6102df565b816040528281528860208487010111156103c757600080fd5b6103d88360208301602088016102f5565b80955050505050509250929050565b600082516103f98184602087016102f5565b9190910192915050565b60208152600082518060208401526104228160408501602087016102f5565b601f01601f19169190910160400192915050565b610341806104456000396000f3fe60806040523661001357610011610017565b005b6100115b610027610022610074565b6100b9565b565b606061004e83836040518060600160405280602781526020016102e5602791396100dd565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b90565b60006100b47f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5473ffffffffffffffffffffffffffffffffffffffff1690565b905090565b3660008037600080366000845af43d6000803e8080156100d8573d6000f35b3d6000fd5b60606000808573ffffffffffffffffffffffffffffffffffffffff16856040516101079190610277565b600060405180830381855af49150503d8060008114610142576040519150601f19603f3d011682016040523d82523d6000602084013e610147565b606091505b509150915061015886838387610162565b9695505050505050565b606083156101fd5782516000036101f65773ffffffffffffffffffffffffffffffffffffffff85163b6101f6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064015b60405180910390fd5b5081610207565b610207838361020f565b949350505050565b81511561021f5781518083602001fd5b806040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016101ed9190610293565b60005b8381101561026e578181015183820152602001610256565b50506000910152565b60008251610289818460208701610253565b9190910192915050565b60208152600082518060208401526102b2816040850160208701610253565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a26469706673582212208d6f628b23c1e021c9b2ae38fc6a126b22b03b9629f5dfe1de8fc7f044229aec64736f6c63430008110033416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564", + "deployedBytecode": "0x60806040523661001357610011610017565b005b6100115b610027610022610074565b6100b9565b565b606061004e83836040518060600160405280602781526020016102e5602791396100dd565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b90565b60006100b47f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5473ffffffffffffffffffffffffffffffffffffffff1690565b905090565b3660008037600080366000845af43d6000803e8080156100d8573d6000f35b3d6000fd5b60606000808573ffffffffffffffffffffffffffffffffffffffff16856040516101079190610277565b600060405180830381855af49150503d8060008114610142576040519150601f19603f3d011682016040523d82523d6000602084013e610147565b606091505b509150915061015886838387610162565b9695505050505050565b606083156101fd5782516000036101f65773ffffffffffffffffffffffffffffffffffffffff85163b6101f6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064015b60405180910390fd5b5081610207565b610207838361020f565b949350505050565b81511561021f5781518083602001fd5b806040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016101ed9190610293565b60005b8381101561026e578181015183820152602001610256565b50506000910152565b60008251610289818460208701610253565b9190910192915050565b60208152600082518060208401526102b2816040850160208701610253565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a26469706673582212208d6f628b23c1e021c9b2ae38fc6a126b22b03b9629f5dfe1de8fc7f044229aec64736f6c63430008110033", + "devdoc": { + "details": "This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an implementation address that can be changed. This address is stored in storage in the location specified by https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the implementation behind the proxy.", + "kind": "dev", + "methods": { + "constructor": { + "details": "Initializes the upgradeable proxy with an initial implementation specified by `_logic`. If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded function call, and allows initializing the storage of the proxy like a Solidity constructor." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/deployments/thundercore/Distributor_Implementation_2.json b/deployments/thundercore/Distributor_Implementation_2.json new file mode 100644 index 0000000..954406e --- /dev/null +++ b/deployments/thundercore/Distributor_Implementation_2.json @@ -0,0 +1,1248 @@ +{ + "address": "0x918261fa5Dd9C3b1358cA911792E9bDF3c5CCa35", + "abi": [ + { + "inputs": [], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "InvalidDispute", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidLengths", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidProof", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidUninitializedRoot", + "type": "error" + }, + { + "inputs": [], + "name": "NoDispute", + "type": "error" + }, + { + "inputs": [], + "name": "NotGovernorOrGuardian", + "type": "error" + }, + { + "inputs": [], + "name": "NotTrusted", + "type": "error" + }, + { + "inputs": [], + "name": "NotWhitelisted", + "type": "error" + }, + { + "inputs": [], + "name": "UnresolvedDispute", + "type": "error" + }, + { + "inputs": [], + "name": "ZeroAddress", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "previousAdmin", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "AdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "beacon", + "type": "address" + } + ], + "name": "BeaconUpgraded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Claimed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "_disputeAmount", + "type": "uint256" + } + ], + "name": "DisputeAmountUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint48", + "name": "_disputePeriod", + "type": "uint48" + } + ], + "name": "DisputePeriodUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "bool", + "name": "valid", + "type": "bool" + } + ], + "name": "DisputeResolved", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "_disputeToken", + "type": "address" + } + ], + "name": "DisputeTokenUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "string", + "name": "reason", + "type": "string" + } + ], + "name": "Disputed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "isEnabled", + "type": "bool" + } + ], + "name": "OperatorClaimingToggled", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "isWhitelisted", + "type": "bool" + } + ], + "name": "OperatorToggled", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Recovered", + "type": "event" + }, + { + "anonymous": false, + "inputs": [], + "name": "Revoked", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "bytes32", + "name": "merkleRoot", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "ipfsHash", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "uint48", + "name": "endOfDisputePeriod", + "type": "uint48" + } + ], + "name": "TreeUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "eoa", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "trust", + "type": "bool" + } + ], + "name": "TrustedToggled", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "canUpdateMerkleRoot", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "users", + "type": "address[]" + }, + { + "internalType": "address[]", + "name": "tokens", + "type": "address[]" + }, + { + "internalType": "uint256[]", + "name": "amounts", + "type": "uint256[]" + }, + { + "internalType": "bytes32[][]", + "name": "proofs", + "type": "bytes32[][]" + } + ], + "name": "claim", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "claimed", + "outputs": [ + { + "internalType": "uint208", + "name": "amount", + "type": "uint208" + }, + { + "internalType": "uint48", + "name": "timestamp", + "type": "uint48" + }, + { + "internalType": "bytes32", + "name": "merkleRoot", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "core", + "outputs": [ + { + "internalType": "contract ICore", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "disputeAmount", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "disputePeriod", + "outputs": [ + { + "internalType": "uint48", + "name": "", + "type": "uint48" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "disputeToken", + "outputs": [ + { + "internalType": "contract IERC20", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "reason", + "type": "string" + } + ], + "name": "disputeTree", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "disputer", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "endOfDisputePeriod", + "outputs": [ + { + "internalType": "uint48", + "name": "", + "type": "uint48" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getMerkleRoot", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract ICore", + "name": "_core", + "type": "address" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "lastTree", + "outputs": [ + { + "internalType": "bytes32", + "name": "merkleRoot", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "ipfsHash", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "onlyOperatorCanClaim", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "operators", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "proxiableUUID", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "tokenAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amountToRecover", + "type": "uint256" + } + ], + "name": "recoverERC20", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bool", + "name": "valid", + "type": "bool" + } + ], + "name": "resolveDispute", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "revokeTree", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_disputeAmount", + "type": "uint256" + } + ], + "name": "setDisputeAmount", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint48", + "name": "_disputePeriod", + "type": "uint48" + } + ], + "name": "setDisputePeriod", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IERC20", + "name": "_disputeToken", + "type": "address" + } + ], + "name": "setDisputeToken", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "user", + "type": "address" + } + ], + "name": "toggleOnlyOperatorCanClaim", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "internalType": "address", + "name": "operator", + "type": "address" + } + ], + "name": "toggleOperator", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "eoa", + "type": "address" + } + ], + "name": "toggleTrusted", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "tree", + "outputs": [ + { + "internalType": "bytes32", + "name": "merkleRoot", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "ipfsHash", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "bytes32", + "name": "merkleRoot", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "ipfsHash", + "type": "bytes32" + } + ], + "internalType": "struct MerkleTree", + "name": "_tree", + "type": "tuple" + } + ], + "name": "updateTree", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "upgradeTo", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "upgradeToAndCall", + "outputs": [], + "stateMutability": "payable", + "type": "function" + } + ], + "transactionHash": "0x04079b3e463ece6aae322b4d042ede75a82b523a74b8cff54ff62c08c929499e", + "receipt": { + "to": null, + "from": "0x9f76a95AA7535bb0893cf88A146396e00ed21A12", + "contractAddress": "0x918261fa5Dd9C3b1358cA911792E9bDF3c5CCa35", + "transactionIndex": 0, + "gasUsed": "3276315", + "logsBloom": "0x00000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000800000000000000000200000400000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xace7e861c6327123dbec574c1d1cc0f7e7d6f3d36c882b9b07e01f115f9dead6", + "transactionHash": "0x04079b3e463ece6aae322b4d042ede75a82b523a74b8cff54ff62c08c929499e", + "logs": [ + { + "transactionIndex": 0, + "blockNumber": 147784003, + "transactionHash": "0x04079b3e463ece6aae322b4d042ede75a82b523a74b8cff54ff62c08c929499e", + "address": "0x918261fa5Dd9C3b1358cA911792E9bDF3c5CCa35", + "topics": [ + "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000000001", + "logIndex": 0, + "blockHash": "0xace7e861c6327123dbec574c1d1cc0f7e7d6f3d36c882b9b07e01f115f9dead6" + }, + { + "transactionIndex": 0, + "blockNumber": 147784003, + "transactionHash": "0x04079b3e463ece6aae322b4d042ede75a82b523a74b8cff54ff62c08c929499e", + "address": "0x918261fa5Dd9C3b1358cA911792E9bDF3c5CCa35", + "topics": [ + "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000000001", + "logIndex": 1, + "blockHash": "0xace7e861c6327123dbec574c1d1cc0f7e7d6f3d36c882b9b07e01f115f9dead6" + } + ], + "blockNumber": 147784003, + "cumulativeGasUsed": "3276315", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 1, + "solcInputHash": "1d17a992f70400315a977c7229541e31", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"InvalidDispute\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidLengths\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidProof\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidUninitializedRoot\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NoDispute\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotGovernorOrGuardian\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotTrusted\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotWhitelisted\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"UnresolvedDispute\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ZeroAddress\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"previousAdmin\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"AdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"beacon\",\"type\":\"address\"}],\"name\":\"BeaconUpgraded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"Claimed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_disputeAmount\",\"type\":\"uint256\"}],\"name\":\"DisputeAmountUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint48\",\"name\":\"_disputePeriod\",\"type\":\"uint48\"}],\"name\":\"DisputePeriodUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"valid\",\"type\":\"bool\"}],\"name\":\"DisputeResolved\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_disputeToken\",\"type\":\"address\"}],\"name\":\"DisputeTokenUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"string\",\"name\":\"reason\",\"type\":\"string\"}],\"name\":\"Disputed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"isEnabled\",\"type\":\"bool\"}],\"name\":\"OperatorClaimingToggled\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"isWhitelisted\",\"type\":\"bool\"}],\"name\":\"OperatorToggled\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"Recovered\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[],\"name\":\"Revoked\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"merkleRoot\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"ipfsHash\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint48\",\"name\":\"endOfDisputePeriod\",\"type\":\"uint48\"}],\"name\":\"TreeUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"eoa\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"trust\",\"type\":\"bool\"}],\"name\":\"TrustedToggled\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"implementation\",\"type\":\"address\"}],\"name\":\"Upgraded\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"canUpdateMerkleRoot\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"users\",\"type\":\"address[]\"},{\"internalType\":\"address[]\",\"name\":\"tokens\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"},{\"internalType\":\"bytes32[][]\",\"name\":\"proofs\",\"type\":\"bytes32[][]\"}],\"name\":\"claim\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"claimed\",\"outputs\":[{\"internalType\":\"uint208\",\"name\":\"amount\",\"type\":\"uint208\"},{\"internalType\":\"uint48\",\"name\":\"timestamp\",\"type\":\"uint48\"},{\"internalType\":\"bytes32\",\"name\":\"merkleRoot\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"core\",\"outputs\":[{\"internalType\":\"contract ICore\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"disputeAmount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"disputePeriod\",\"outputs\":[{\"internalType\":\"uint48\",\"name\":\"\",\"type\":\"uint48\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"disputeToken\",\"outputs\":[{\"internalType\":\"contract IERC20\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"reason\",\"type\":\"string\"}],\"name\":\"disputeTree\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"disputer\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"endOfDisputePeriod\",\"outputs\":[{\"internalType\":\"uint48\",\"name\":\"\",\"type\":\"uint48\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getMerkleRoot\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract ICore\",\"name\":\"_core\",\"type\":\"address\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"lastTree\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"merkleRoot\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"ipfsHash\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"onlyOperatorCanClaim\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"operators\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"proxiableUUID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"tokenAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amountToRecover\",\"type\":\"uint256\"}],\"name\":\"recoverERC20\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bool\",\"name\":\"valid\",\"type\":\"bool\"}],\"name\":\"resolveDispute\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"revokeTree\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_disputeAmount\",\"type\":\"uint256\"}],\"name\":\"setDisputeAmount\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint48\",\"name\":\"_disputePeriod\",\"type\":\"uint48\"}],\"name\":\"setDisputePeriod\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract IERC20\",\"name\":\"_disputeToken\",\"type\":\"address\"}],\"name\":\"setDisputeToken\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"}],\"name\":\"toggleOnlyOperatorCanClaim\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"}],\"name\":\"toggleOperator\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"eoa\",\"type\":\"address\"}],\"name\":\"toggleTrusted\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"tree\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"merkleRoot\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"ipfsHash\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"merkleRoot\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"ipfsHash\",\"type\":\"bytes32\"}],\"internalType\":\"struct MerkleTree\",\"name\":\"_tree\",\"type\":\"tuple\"}],\"name\":\"updateTree\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"}],\"name\":\"upgradeTo\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"upgradeToAndCall\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"}],\"devdoc\":{\"author\":\"Angle Labs. Inc\",\"kind\":\"dev\",\"methods\":{\"claim(address[],address[],uint256[],bytes32[][])\":{\"details\":\"Anyone may call this function for anyone else, funds go to destination regardless, it's just a question of who provides the proof and pays the gas: `msg.sender` is used only for addresses that require a trusted operator\",\"params\":{\"amounts\":\"Amount of tokens that will be sent to the corresponding users\",\"proofs\":\"Array of hashes bridging from a leaf `(hash of user | token | amount)` to the Merkle root\",\"tokens\":\"ERC20 claimed\",\"users\":\"Recipient of tokens\"}},\"disputeTree(string)\":{\"details\":\"Requires a deposit of `disputeToken` that'll be slashed if the dispute is not acceptedIt is only possible to create a dispute within `disputePeriod` after each tree update\"},\"proxiableUUID()\":{\"details\":\"Implementation of the ERC1822 {proxiableUUID} function. This returns the storage slot used by the implementation. It is used to validate the implementation's compatibility when performing an upgrade. IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this function revert if invoked through a proxy. This is guaranteed by the `notDelegated` modifier.\"},\"resolveDispute(bool)\":{\"params\":{\"valid\":\"Whether the dispute was valid\"}},\"upgradeTo(address)\":{\"details\":\"Upgrade the implementation of the proxy to `newImplementation`. Calls {_authorizeUpgrade}. Emits an {Upgraded} event.\"},\"upgradeToAndCall(address,bytes)\":{\"details\":\"Upgrade the implementation of the proxy to `newImplementation`, and subsequently execute the function call encoded in `data`. Calls {_authorizeUpgrade}. Emits an {Upgraded} event.\"}},\"stateVariables\":{\"disputer\":{\"details\":\"Used to store if there is an ongoing dispute\"}},\"title\":\"Distributor\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"canUpdateMerkleRoot(address)\":{\"notice\":\"Trusted EOAs to update the Merkle root\"},\"claim(address[],address[],uint256[],bytes32[][])\":{\"notice\":\"Claims rewards for a given set of users\"},\"claimed(address,address)\":{\"notice\":\"Mapping user -> token -> amount to track claimed amounts\"},\"core()\":{\"notice\":\"`Core` contract handling access control\"},\"disputeAmount()\":{\"notice\":\"Amount to deposit to freeze the roots update\"},\"disputePeriod()\":{\"notice\":\"Time after which a change in a tree becomes effective, in EPOCH_DURATION\"},\"disputeToken()\":{\"notice\":\"Token to deposit to freeze the roots update\"},\"disputeTree(string)\":{\"notice\":\"Freezes the Merkle tree update until the dispute is resolved\"},\"disputer()\":{\"notice\":\"Address which created the dispute\"},\"endOfDisputePeriod()\":{\"notice\":\"When the current tree will become valid\"},\"getMerkleRoot()\":{\"notice\":\"Returns the MerkleRoot that is currently live for the contract\"},\"lastTree()\":{\"notice\":\"Tree that was in place in the contract before the last `tree` update\"},\"onlyOperatorCanClaim(address)\":{\"notice\":\"Whether or not to disable permissionless claiming\"},\"operators(address,address)\":{\"notice\":\"user -> operator -> authorisation to claim\"},\"recoverERC20(address,address,uint256)\":{\"notice\":\"Recovers any ERC20 token\"},\"resolveDispute(bool)\":{\"notice\":\"Resolve the ongoing dispute, if any\"},\"revokeTree()\":{\"notice\":\"Allows the governor or the guardian of this contract to fallback to the last version of the tree immediately\"},\"setDisputeAmount(uint256)\":{\"notice\":\"Sets the amount of `disputeToken` used as a caution during disputes\"},\"setDisputePeriod(uint48)\":{\"notice\":\"Sets the dispute period after which a tree update becomes effective\"},\"setDisputeToken(address)\":{\"notice\":\"Sets the token used as a caution during disputes\"},\"toggleOnlyOperatorCanClaim(address)\":{\"notice\":\"Toggles permissioned claiming for a given user\"},\"toggleOperator(address,address)\":{\"notice\":\"Toggles whitelisting for a given user and a given operator\"},\"toggleTrusted(address)\":{\"notice\":\"Adds or removes EOAs which are trusted to update the Merkle root\"},\"tree()\":{\"notice\":\"Tree of claimable tokens through this contract\"},\"updateTree((bytes32,bytes32))\":{\"notice\":\"Updates Merkle Tree\"}},\"notice\":\"Allows LPs on AMMs with concentrated liquidity to claim the rewards that were distributed to them\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/Distributor.sol\":\"Distributor\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":100000},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts-upgradeable/interfaces/draft-IERC1822Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\\n * proxy whose upgrades are fully controlled by the current implementation.\\n */\\ninterface IERC1822ProxiableUpgradeable {\\n /**\\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\\n * address.\\n *\\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\\n * function revert if invoked through a proxy.\\n */\\n function proxiableUUID() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0x77c89f893e403efc6929ba842b7ccf6534d4ffe03afe31670b4a528c0ad78c0f\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/proxy/ERC1967/ERC1967UpgradeUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (proxy/ERC1967/ERC1967Upgrade.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../beacon/IBeaconUpgradeable.sol\\\";\\nimport \\\"../../interfaces/draft-IERC1822Upgradeable.sol\\\";\\nimport \\\"../../utils/AddressUpgradeable.sol\\\";\\nimport \\\"../../utils/StorageSlotUpgradeable.sol\\\";\\nimport \\\"../utils/Initializable.sol\\\";\\n\\n/**\\n * @dev This abstract contract provides getters and event emitting update functions for\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\\n *\\n * _Available since v4.1._\\n *\\n * @custom:oz-upgrades-unsafe-allow delegatecall\\n */\\nabstract contract ERC1967UpgradeUpgradeable is Initializable {\\n function __ERC1967Upgrade_init() internal onlyInitializing {\\n }\\n\\n function __ERC1967Upgrade_init_unchained() internal onlyInitializing {\\n }\\n // This is the keccak-256 hash of \\\"eip1967.proxy.rollback\\\" subtracted by 1\\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\\n\\n /**\\n * @dev Storage slot with the address of the current implementation.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n /**\\n * @dev Emitted when the implementation is upgraded.\\n */\\n event Upgraded(address indexed implementation);\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _getImplementation() internal view returns (address) {\\n return StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 implementation slot.\\n */\\n function _setImplementation(address newImplementation) private {\\n require(AddressUpgradeable.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n }\\n\\n /**\\n * @dev Perform implementation upgrade\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeTo(address newImplementation) internal {\\n _setImplementation(newImplementation);\\n emit Upgraded(newImplementation);\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCall(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _upgradeTo(newImplementation);\\n if (data.length > 0 || forceCall) {\\n _functionDelegateCall(newImplementation, data);\\n }\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCallUUPS(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n // Upgrades from old implementations will perform a rollback test. This test requires the new\\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\\n // this special case will break upgrade paths from old UUPS implementation to new ones.\\n if (StorageSlotUpgradeable.getBooleanSlot(_ROLLBACK_SLOT).value) {\\n _setImplementation(newImplementation);\\n } else {\\n try IERC1822ProxiableUpgradeable(newImplementation).proxiableUUID() returns (bytes32 slot) {\\n require(slot == _IMPLEMENTATION_SLOT, \\\"ERC1967Upgrade: unsupported proxiableUUID\\\");\\n } catch {\\n revert(\\\"ERC1967Upgrade: new implementation is not UUPS\\\");\\n }\\n _upgradeToAndCall(newImplementation, data, forceCall);\\n }\\n }\\n\\n /**\\n * @dev Storage slot with the admin of the contract.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.admin\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n /**\\n * @dev Emitted when the admin account has changed.\\n */\\n event AdminChanged(address previousAdmin, address newAdmin);\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _getAdmin() internal view returns (address) {\\n return StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 admin slot.\\n */\\n function _setAdmin(address newAdmin) private {\\n require(newAdmin != address(0), \\\"ERC1967: new admin is the zero address\\\");\\n StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n */\\n function _changeAdmin(address newAdmin) internal {\\n emit AdminChanged(_getAdmin(), newAdmin);\\n _setAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\\n */\\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\\n\\n /**\\n * @dev Emitted when the beacon is upgraded.\\n */\\n event BeaconUpgraded(address indexed beacon);\\n\\n /**\\n * @dev Returns the current beacon.\\n */\\n function _getBeacon() internal view returns (address) {\\n return StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new beacon in the EIP1967 beacon slot.\\n */\\n function _setBeacon(address newBeacon) private {\\n require(AddressUpgradeable.isContract(newBeacon), \\\"ERC1967: new beacon is not a contract\\\");\\n require(\\n AddressUpgradeable.isContract(IBeaconUpgradeable(newBeacon).implementation()),\\n \\\"ERC1967: beacon implementation is not a contract\\\"\\n );\\n StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value = newBeacon;\\n }\\n\\n /**\\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\\n *\\n * Emits a {BeaconUpgraded} event.\\n */\\n function _upgradeBeaconToAndCall(\\n address newBeacon,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _setBeacon(newBeacon);\\n emit BeaconUpgraded(newBeacon);\\n if (data.length > 0 || forceCall) {\\n _functionDelegateCall(IBeaconUpgradeable(newBeacon).implementation(), data);\\n }\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function _functionDelegateCall(address target, bytes memory data) private returns (bytes memory) {\\n require(AddressUpgradeable.isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n // solhint-disable-next-line avoid-low-level-calls\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return AddressUpgradeable.verifyCallResult(success, returndata, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[50] private __gap;\\n}\\n\",\"keccak256\":\"0x315887e846f1e5f8d8fa535a229d318bb9290aaa69485117f1ee8a9a6b3be823\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/proxy/beacon/IBeaconUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\\n */\\ninterface IBeaconUpgradeable {\\n /**\\n * @dev Must return an address that can be used as a delegate call target.\\n *\\n * {BeaconProxy} will check that this address is a contract.\\n */\\n function implementation() external view returns (address);\\n}\\n\",\"keccak256\":\"0x24b86ac8c005b8c654fbf6ac34a5a4f61580d7273541e83e013e89d66fbf0908\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.1) (proxy/utils/Initializable.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../../utils/AddressUpgradeable.sol\\\";\\n\\n/**\\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\\n *\\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\\n * reused. This mechanism prevents re-execution of each \\\"step\\\" but allows the creation of new initialization steps in\\n * case an upgrade adds a module that needs to be initialized.\\n *\\n * For example:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * contract MyToken is ERC20Upgradeable {\\n * function initialize() initializer public {\\n * __ERC20_init(\\\"MyToken\\\", \\\"MTK\\\");\\n * }\\n * }\\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\\n * function initializeV2() reinitializer(2) public {\\n * __ERC20Permit_init(\\\"MyToken\\\");\\n * }\\n * }\\n * ```\\n *\\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\\n *\\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\\n *\\n * [CAUTION]\\n * ====\\n * Avoid leaving a contract uninitialized.\\n *\\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * /// @custom:oz-upgrades-unsafe-allow constructor\\n * constructor() {\\n * _disableInitializers();\\n * }\\n * ```\\n * ====\\n */\\nabstract contract Initializable {\\n /**\\n * @dev Indicates that the contract has been initialized.\\n * @custom:oz-retyped-from bool\\n */\\n uint8 private _initialized;\\n\\n /**\\n * @dev Indicates that the contract is in the process of being initialized.\\n */\\n bool private _initializing;\\n\\n /**\\n * @dev Triggered when the contract has been initialized or reinitialized.\\n */\\n event Initialized(uint8 version);\\n\\n /**\\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\\n * `onlyInitializing` functions can be used to initialize parent contracts.\\n *\\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\\n * constructor.\\n *\\n * Emits an {Initialized} event.\\n */\\n modifier initializer() {\\n bool isTopLevelCall = !_initializing;\\n require(\\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\\n \\\"Initializable: contract is already initialized\\\"\\n );\\n _initialized = 1;\\n if (isTopLevelCall) {\\n _initializing = true;\\n }\\n _;\\n if (isTopLevelCall) {\\n _initializing = false;\\n emit Initialized(1);\\n }\\n }\\n\\n /**\\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\\n * used to initialize parent contracts.\\n *\\n * A reinitializer may be used after the original initialization step. This is essential to configure modules that\\n * are added through upgrades and that require initialization.\\n *\\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\\n * cannot be nested. If one is invoked in the context of another, execution will revert.\\n *\\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\\n * a contract, executing them in the right order is up to the developer or operator.\\n *\\n * WARNING: setting the version to 255 will prevent any future reinitialization.\\n *\\n * Emits an {Initialized} event.\\n */\\n modifier reinitializer(uint8 version) {\\n require(!_initializing && _initialized < version, \\\"Initializable: contract is already initialized\\\");\\n _initialized = version;\\n _initializing = true;\\n _;\\n _initializing = false;\\n emit Initialized(version);\\n }\\n\\n /**\\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\\n */\\n modifier onlyInitializing() {\\n require(_initializing, \\\"Initializable: contract is not initializing\\\");\\n _;\\n }\\n\\n /**\\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\\n * through proxies.\\n *\\n * Emits an {Initialized} event the first time it is successfully executed.\\n */\\n function _disableInitializers() internal virtual {\\n require(!_initializing, \\\"Initializable: contract is initializing\\\");\\n if (_initialized < type(uint8).max) {\\n _initialized = type(uint8).max;\\n emit Initialized(type(uint8).max);\\n }\\n }\\n\\n /**\\n * @dev Returns the highest version that has been initialized. See {reinitializer}.\\n */\\n function _getInitializedVersion() internal view returns (uint8) {\\n return _initialized;\\n }\\n\\n /**\\n * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.\\n */\\n function _isInitializing() internal view returns (bool) {\\n return _initializing;\\n }\\n}\\n\",\"keccak256\":\"0x037c334add4b033ad3493038c25be1682d78c00992e1acb0e2795caff3925271\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (proxy/utils/UUPSUpgradeable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../interfaces/draft-IERC1822Upgradeable.sol\\\";\\nimport \\\"../ERC1967/ERC1967UpgradeUpgradeable.sol\\\";\\nimport \\\"./Initializable.sol\\\";\\n\\n/**\\n * @dev An upgradeability mechanism designed for UUPS proxies. The functions included here can perform an upgrade of an\\n * {ERC1967Proxy}, when this contract is set as the implementation behind such a proxy.\\n *\\n * A security mechanism ensures that an upgrade does not turn off upgradeability accidentally, although this risk is\\n * reinstated if the upgrade retains upgradeability but removes the security mechanism, e.g. by replacing\\n * `UUPSUpgradeable` with a custom implementation of upgrades.\\n *\\n * The {_authorizeUpgrade} function must be overridden to include access restriction to the upgrade mechanism.\\n *\\n * _Available since v4.1._\\n */\\nabstract contract UUPSUpgradeable is Initializable, IERC1822ProxiableUpgradeable, ERC1967UpgradeUpgradeable {\\n function __UUPSUpgradeable_init() internal onlyInitializing {\\n }\\n\\n function __UUPSUpgradeable_init_unchained() internal onlyInitializing {\\n }\\n /// @custom:oz-upgrades-unsafe-allow state-variable-immutable state-variable-assignment\\n address private immutable __self = address(this);\\n\\n /**\\n * @dev Check that the execution is being performed through a delegatecall call and that the execution context is\\n * a proxy contract with an implementation (as defined in ERC1967) pointing to self. This should only be the case\\n * for UUPS and transparent proxies that are using the current contract as their implementation. Execution of a\\n * function through ERC1167 minimal proxies (clones) would not normally pass this test, but is not guaranteed to\\n * fail.\\n */\\n modifier onlyProxy() {\\n require(address(this) != __self, \\\"Function must be called through delegatecall\\\");\\n require(_getImplementation() == __self, \\\"Function must be called through active proxy\\\");\\n _;\\n }\\n\\n /**\\n * @dev Check that the execution is not being performed through a delegate call. This allows a function to be\\n * callable on the implementing contract but not through proxies.\\n */\\n modifier notDelegated() {\\n require(address(this) == __self, \\\"UUPSUpgradeable: must not be called through delegatecall\\\");\\n _;\\n }\\n\\n /**\\n * @dev Implementation of the ERC1822 {proxiableUUID} function. This returns the storage slot used by the\\n * implementation. It is used to validate the implementation's compatibility when performing an upgrade.\\n *\\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\\n * function revert if invoked through a proxy. This is guaranteed by the `notDelegated` modifier.\\n */\\n function proxiableUUID() external view virtual override notDelegated returns (bytes32) {\\n return _IMPLEMENTATION_SLOT;\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy to `newImplementation`.\\n *\\n * Calls {_authorizeUpgrade}.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function upgradeTo(address newImplementation) external virtual onlyProxy {\\n _authorizeUpgrade(newImplementation);\\n _upgradeToAndCallUUPS(newImplementation, new bytes(0), false);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy to `newImplementation`, and subsequently execute the function call\\n * encoded in `data`.\\n *\\n * Calls {_authorizeUpgrade}.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function upgradeToAndCall(address newImplementation, bytes memory data) external payable virtual onlyProxy {\\n _authorizeUpgrade(newImplementation);\\n _upgradeToAndCallUUPS(newImplementation, data, true);\\n }\\n\\n /**\\n * @dev Function that should revert when `msg.sender` is not authorized to upgrade the contract. Called by\\n * {upgradeTo} and {upgradeToAndCall}.\\n *\\n * Normally, this function will use an xref:access.adoc[access control] modifier such as {Ownable-onlyOwner}.\\n *\\n * ```solidity\\n * function _authorizeUpgrade(address) internal override onlyOwner {}\\n * ```\\n */\\n function _authorizeUpgrade(address newImplementation) internal virtual;\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[50] private __gap;\\n}\\n\",\"keccak256\":\"0x7967d130887c4b40666cd88f8744691d4527039a1b2a38aa0de41481ef646778\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary AddressUpgradeable {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\n *\\n * _Available since v4.8._\\n */\\n function verifyCallResultFromTarget(\\n address target,\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n if (success) {\\n if (returndata.length == 0) {\\n // only check isContract if the call was successful and the return data is empty\\n // otherwise we already know that it was a contract\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n }\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason or using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x2edcb41c121abc510932e8d83ff8b82cf9cdde35e7c297622f5c29ef0af25183\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/StorageSlotUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/StorageSlot.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for reading and writing primitive types to specific storage slots.\\n *\\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\\n * This library helps with reading and writing to such slots without the need for inline assembly.\\n *\\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\\n *\\n * Example usage to set ERC1967 implementation slot:\\n * ```\\n * contract ERC1967 {\\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n *\\n * function _getImplementation() internal view returns (address) {\\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n * }\\n *\\n * function _setImplementation(address newImplementation) internal {\\n * require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n * }\\n * }\\n * ```\\n *\\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\\n */\\nlibrary StorageSlotUpgradeable {\\n struct AddressSlot {\\n address value;\\n }\\n\\n struct BooleanSlot {\\n bool value;\\n }\\n\\n struct Bytes32Slot {\\n bytes32 value;\\n }\\n\\n struct Uint256Slot {\\n uint256 value;\\n }\\n\\n /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\\n */\\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\\n */\\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\\n */\\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0x09864aea84f01e39313375b5610c73a3c1c68abbdc51e5ccdd25ff977fdadf9a\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 amount\\n ) external returns (bool);\\n}\\n\",\"keccak256\":\"0x9750c6b834f7b43000631af5cc30001c5f547b3ceb3635488f140f60e897ea6b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\\n *\\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\\n * need to send a transaction, and thus is not required to hold Ether at all.\\n */\\ninterface IERC20Permit {\\n /**\\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\\n * given ``owner``'s signed approval.\\n *\\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\\n * ordering also apply here.\\n *\\n * Emits an {Approval} event.\\n *\\n * Requirements:\\n *\\n * - `spender` cannot be the zero address.\\n * - `deadline` must be a timestamp in the future.\\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\\n * over the EIP712-formatted function arguments.\\n * - the signature must use ``owner``'s current nonce (see {nonces}).\\n *\\n * For more information on the signature format, see the\\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\\n * section].\\n */\\n function permit(\\n address owner,\\n address spender,\\n uint256 value,\\n uint256 deadline,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) external;\\n\\n /**\\n * @dev Returns the current nonce for `owner`. This value must be\\n * included whenever a signature is generated for {permit}.\\n *\\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\\n * prevents a signature from being used multiple times.\\n */\\n function nonces(address owner) external view returns (uint256);\\n\\n /**\\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\\n */\\n // solhint-disable-next-line func-name-mixedcase\\n function DOMAIN_SEPARATOR() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0xf41ca991f30855bf80ffd11e9347856a517b977f0a6c2d52e6421a99b7840329\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/utils/SafeERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC20.sol\\\";\\nimport \\\"../extensions/draft-IERC20Permit.sol\\\";\\nimport \\\"../../../utils/Address.sol\\\";\\n\\n/**\\n * @title SafeERC20\\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\\n * contract returns false). Tokens that return no value (and instead revert or\\n * throw on failure) are also supported, non-reverting calls are assumed to be\\n * successful.\\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\\n */\\nlibrary SafeERC20 {\\n using Address for address;\\n\\n function safeTransfer(\\n IERC20 token,\\n address to,\\n uint256 value\\n ) internal {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\\n }\\n\\n function safeTransferFrom(\\n IERC20 token,\\n address from,\\n address to,\\n uint256 value\\n ) internal {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\\n }\\n\\n /**\\n * @dev Deprecated. This function has issues similar to the ones found in\\n * {IERC20-approve}, and its usage is discouraged.\\n *\\n * Whenever possible, use {safeIncreaseAllowance} and\\n * {safeDecreaseAllowance} instead.\\n */\\n function safeApprove(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n // safeApprove should only be called when setting an initial allowance,\\n // or when resetting it to zero. To increase and decrease it, use\\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\\n require(\\n (value == 0) || (token.allowance(address(this), spender) == 0),\\n \\\"SafeERC20: approve from non-zero to non-zero allowance\\\"\\n );\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\\n }\\n\\n function safeIncreaseAllowance(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n uint256 newAllowance = token.allowance(address(this), spender) + value;\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\n }\\n\\n function safeDecreaseAllowance(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n unchecked {\\n uint256 oldAllowance = token.allowance(address(this), spender);\\n require(oldAllowance >= value, \\\"SafeERC20: decreased allowance below zero\\\");\\n uint256 newAllowance = oldAllowance - value;\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\n }\\n }\\n\\n function safePermit(\\n IERC20Permit token,\\n address owner,\\n address spender,\\n uint256 value,\\n uint256 deadline,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) internal {\\n uint256 nonceBefore = token.nonces(owner);\\n token.permit(owner, spender, value, deadline, v, r, s);\\n uint256 nonceAfter = token.nonces(owner);\\n require(nonceAfter == nonceBefore + 1, \\\"SafeERC20: permit did not succeed\\\");\\n }\\n\\n /**\\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\\n * on the return value: the return value is optional (but if data is returned, it must not be false).\\n * @param token The token targeted by the call.\\n * @param data The call data (encoded using abi.encode or one of its variants).\\n */\\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\\n // the target address contains contract code and also asserts for success in the low-level call.\\n\\n bytes memory returndata = address(token).functionCall(data, \\\"SafeERC20: low-level call failed\\\");\\n if (returndata.length > 0) {\\n // Return data is optional\\n require(abi.decode(returndata, (bool)), \\\"SafeERC20: ERC20 operation did not succeed\\\");\\n }\\n }\\n}\\n\",\"keccak256\":\"0x9b72f93be69ca894d8492c244259615c4a742afc8d63720dbc8bb81087d9b238\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\n *\\n * _Available since v4.8._\\n */\\n function verifyCallResultFromTarget(\\n address target,\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n if (success) {\\n if (returndata.length == 0) {\\n // only check isContract if the call was successful and the return data is empty\\n // otherwise we already know that it was a contract\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n }\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason or using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xf96f969e24029d43d0df89e59d365f277021dac62b48e1c1e3ebe0acdd7f1ca1\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/math/SafeCast.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SafeCast.sol)\\n// This file was procedurally generated from scripts/generate/templates/SafeCast.js.\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Wrappers over Solidity's uintXX/intXX casting operators with added overflow\\n * checks.\\n *\\n * Downcasting from uint256/int256 in Solidity does not revert on overflow. This can\\n * easily result in undesired exploitation or bugs, since developers usually\\n * assume that overflows raise errors. `SafeCast` restores this intuition by\\n * reverting the transaction when such an operation overflows.\\n *\\n * Using this library instead of the unchecked operations eliminates an entire\\n * class of bugs, so it's recommended to use it always.\\n *\\n * Can be combined with {SafeMath} and {SignedSafeMath} to extend it to smaller types, by performing\\n * all math on `uint256` and `int256` and then downcasting.\\n */\\nlibrary SafeCast {\\n /**\\n * @dev Returns the downcasted uint248 from uint256, reverting on\\n * overflow (when the input is greater than largest uint248).\\n *\\n * Counterpart to Solidity's `uint248` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 248 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint248(uint256 value) internal pure returns (uint248) {\\n require(value <= type(uint248).max, \\\"SafeCast: value doesn't fit in 248 bits\\\");\\n return uint248(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint240 from uint256, reverting on\\n * overflow (when the input is greater than largest uint240).\\n *\\n * Counterpart to Solidity's `uint240` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 240 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint240(uint256 value) internal pure returns (uint240) {\\n require(value <= type(uint240).max, \\\"SafeCast: value doesn't fit in 240 bits\\\");\\n return uint240(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint232 from uint256, reverting on\\n * overflow (when the input is greater than largest uint232).\\n *\\n * Counterpart to Solidity's `uint232` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 232 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint232(uint256 value) internal pure returns (uint232) {\\n require(value <= type(uint232).max, \\\"SafeCast: value doesn't fit in 232 bits\\\");\\n return uint232(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint224 from uint256, reverting on\\n * overflow (when the input is greater than largest uint224).\\n *\\n * Counterpart to Solidity's `uint224` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 224 bits\\n *\\n * _Available since v4.2._\\n */\\n function toUint224(uint256 value) internal pure returns (uint224) {\\n require(value <= type(uint224).max, \\\"SafeCast: value doesn't fit in 224 bits\\\");\\n return uint224(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint216 from uint256, reverting on\\n * overflow (when the input is greater than largest uint216).\\n *\\n * Counterpart to Solidity's `uint216` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 216 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint216(uint256 value) internal pure returns (uint216) {\\n require(value <= type(uint216).max, \\\"SafeCast: value doesn't fit in 216 bits\\\");\\n return uint216(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint208 from uint256, reverting on\\n * overflow (when the input is greater than largest uint208).\\n *\\n * Counterpart to Solidity's `uint208` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 208 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint208(uint256 value) internal pure returns (uint208) {\\n require(value <= type(uint208).max, \\\"SafeCast: value doesn't fit in 208 bits\\\");\\n return uint208(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint200 from uint256, reverting on\\n * overflow (when the input is greater than largest uint200).\\n *\\n * Counterpart to Solidity's `uint200` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 200 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint200(uint256 value) internal pure returns (uint200) {\\n require(value <= type(uint200).max, \\\"SafeCast: value doesn't fit in 200 bits\\\");\\n return uint200(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint192 from uint256, reverting on\\n * overflow (when the input is greater than largest uint192).\\n *\\n * Counterpart to Solidity's `uint192` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 192 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint192(uint256 value) internal pure returns (uint192) {\\n require(value <= type(uint192).max, \\\"SafeCast: value doesn't fit in 192 bits\\\");\\n return uint192(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint184 from uint256, reverting on\\n * overflow (when the input is greater than largest uint184).\\n *\\n * Counterpart to Solidity's `uint184` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 184 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint184(uint256 value) internal pure returns (uint184) {\\n require(value <= type(uint184).max, \\\"SafeCast: value doesn't fit in 184 bits\\\");\\n return uint184(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint176 from uint256, reverting on\\n * overflow (when the input is greater than largest uint176).\\n *\\n * Counterpart to Solidity's `uint176` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 176 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint176(uint256 value) internal pure returns (uint176) {\\n require(value <= type(uint176).max, \\\"SafeCast: value doesn't fit in 176 bits\\\");\\n return uint176(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint168 from uint256, reverting on\\n * overflow (when the input is greater than largest uint168).\\n *\\n * Counterpart to Solidity's `uint168` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 168 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint168(uint256 value) internal pure returns (uint168) {\\n require(value <= type(uint168).max, \\\"SafeCast: value doesn't fit in 168 bits\\\");\\n return uint168(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint160 from uint256, reverting on\\n * overflow (when the input is greater than largest uint160).\\n *\\n * Counterpart to Solidity's `uint160` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 160 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint160(uint256 value) internal pure returns (uint160) {\\n require(value <= type(uint160).max, \\\"SafeCast: value doesn't fit in 160 bits\\\");\\n return uint160(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint152 from uint256, reverting on\\n * overflow (when the input is greater than largest uint152).\\n *\\n * Counterpart to Solidity's `uint152` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 152 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint152(uint256 value) internal pure returns (uint152) {\\n require(value <= type(uint152).max, \\\"SafeCast: value doesn't fit in 152 bits\\\");\\n return uint152(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint144 from uint256, reverting on\\n * overflow (when the input is greater than largest uint144).\\n *\\n * Counterpart to Solidity's `uint144` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 144 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint144(uint256 value) internal pure returns (uint144) {\\n require(value <= type(uint144).max, \\\"SafeCast: value doesn't fit in 144 bits\\\");\\n return uint144(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint136 from uint256, reverting on\\n * overflow (when the input is greater than largest uint136).\\n *\\n * Counterpart to Solidity's `uint136` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 136 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint136(uint256 value) internal pure returns (uint136) {\\n require(value <= type(uint136).max, \\\"SafeCast: value doesn't fit in 136 bits\\\");\\n return uint136(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint128 from uint256, reverting on\\n * overflow (when the input is greater than largest uint128).\\n *\\n * Counterpart to Solidity's `uint128` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 128 bits\\n *\\n * _Available since v2.5._\\n */\\n function toUint128(uint256 value) internal pure returns (uint128) {\\n require(value <= type(uint128).max, \\\"SafeCast: value doesn't fit in 128 bits\\\");\\n return uint128(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint120 from uint256, reverting on\\n * overflow (when the input is greater than largest uint120).\\n *\\n * Counterpart to Solidity's `uint120` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 120 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint120(uint256 value) internal pure returns (uint120) {\\n require(value <= type(uint120).max, \\\"SafeCast: value doesn't fit in 120 bits\\\");\\n return uint120(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint112 from uint256, reverting on\\n * overflow (when the input is greater than largest uint112).\\n *\\n * Counterpart to Solidity's `uint112` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 112 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint112(uint256 value) internal pure returns (uint112) {\\n require(value <= type(uint112).max, \\\"SafeCast: value doesn't fit in 112 bits\\\");\\n return uint112(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint104 from uint256, reverting on\\n * overflow (when the input is greater than largest uint104).\\n *\\n * Counterpart to Solidity's `uint104` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 104 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint104(uint256 value) internal pure returns (uint104) {\\n require(value <= type(uint104).max, \\\"SafeCast: value doesn't fit in 104 bits\\\");\\n return uint104(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint96 from uint256, reverting on\\n * overflow (when the input is greater than largest uint96).\\n *\\n * Counterpart to Solidity's `uint96` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 96 bits\\n *\\n * _Available since v4.2._\\n */\\n function toUint96(uint256 value) internal pure returns (uint96) {\\n require(value <= type(uint96).max, \\\"SafeCast: value doesn't fit in 96 bits\\\");\\n return uint96(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint88 from uint256, reverting on\\n * overflow (when the input is greater than largest uint88).\\n *\\n * Counterpart to Solidity's `uint88` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 88 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint88(uint256 value) internal pure returns (uint88) {\\n require(value <= type(uint88).max, \\\"SafeCast: value doesn't fit in 88 bits\\\");\\n return uint88(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint80 from uint256, reverting on\\n * overflow (when the input is greater than largest uint80).\\n *\\n * Counterpart to Solidity's `uint80` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 80 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint80(uint256 value) internal pure returns (uint80) {\\n require(value <= type(uint80).max, \\\"SafeCast: value doesn't fit in 80 bits\\\");\\n return uint80(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint72 from uint256, reverting on\\n * overflow (when the input is greater than largest uint72).\\n *\\n * Counterpart to Solidity's `uint72` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 72 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint72(uint256 value) internal pure returns (uint72) {\\n require(value <= type(uint72).max, \\\"SafeCast: value doesn't fit in 72 bits\\\");\\n return uint72(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint64 from uint256, reverting on\\n * overflow (when the input is greater than largest uint64).\\n *\\n * Counterpart to Solidity's `uint64` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 64 bits\\n *\\n * _Available since v2.5._\\n */\\n function toUint64(uint256 value) internal pure returns (uint64) {\\n require(value <= type(uint64).max, \\\"SafeCast: value doesn't fit in 64 bits\\\");\\n return uint64(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint56 from uint256, reverting on\\n * overflow (when the input is greater than largest uint56).\\n *\\n * Counterpart to Solidity's `uint56` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 56 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint56(uint256 value) internal pure returns (uint56) {\\n require(value <= type(uint56).max, \\\"SafeCast: value doesn't fit in 56 bits\\\");\\n return uint56(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint48 from uint256, reverting on\\n * overflow (when the input is greater than largest uint48).\\n *\\n * Counterpart to Solidity's `uint48` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 48 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint48(uint256 value) internal pure returns (uint48) {\\n require(value <= type(uint48).max, \\\"SafeCast: value doesn't fit in 48 bits\\\");\\n return uint48(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint40 from uint256, reverting on\\n * overflow (when the input is greater than largest uint40).\\n *\\n * Counterpart to Solidity's `uint40` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 40 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint40(uint256 value) internal pure returns (uint40) {\\n require(value <= type(uint40).max, \\\"SafeCast: value doesn't fit in 40 bits\\\");\\n return uint40(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint32 from uint256, reverting on\\n * overflow (when the input is greater than largest uint32).\\n *\\n * Counterpart to Solidity's `uint32` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 32 bits\\n *\\n * _Available since v2.5._\\n */\\n function toUint32(uint256 value) internal pure returns (uint32) {\\n require(value <= type(uint32).max, \\\"SafeCast: value doesn't fit in 32 bits\\\");\\n return uint32(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint24 from uint256, reverting on\\n * overflow (when the input is greater than largest uint24).\\n *\\n * Counterpart to Solidity's `uint24` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 24 bits\\n *\\n * _Available since v4.7._\\n */\\n function toUint24(uint256 value) internal pure returns (uint24) {\\n require(value <= type(uint24).max, \\\"SafeCast: value doesn't fit in 24 bits\\\");\\n return uint24(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint16 from uint256, reverting on\\n * overflow (when the input is greater than largest uint16).\\n *\\n * Counterpart to Solidity's `uint16` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 16 bits\\n *\\n * _Available since v2.5._\\n */\\n function toUint16(uint256 value) internal pure returns (uint16) {\\n require(value <= type(uint16).max, \\\"SafeCast: value doesn't fit in 16 bits\\\");\\n return uint16(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint8 from uint256, reverting on\\n * overflow (when the input is greater than largest uint8).\\n *\\n * Counterpart to Solidity's `uint8` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 8 bits\\n *\\n * _Available since v2.5._\\n */\\n function toUint8(uint256 value) internal pure returns (uint8) {\\n require(value <= type(uint8).max, \\\"SafeCast: value doesn't fit in 8 bits\\\");\\n return uint8(value);\\n }\\n\\n /**\\n * @dev Converts a signed int256 into an unsigned uint256.\\n *\\n * Requirements:\\n *\\n * - input must be greater than or equal to 0.\\n *\\n * _Available since v3.0._\\n */\\n function toUint256(int256 value) internal pure returns (uint256) {\\n require(value >= 0, \\\"SafeCast: value must be positive\\\");\\n return uint256(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted int248 from int256, reverting on\\n * overflow (when the input is less than smallest int248 or\\n * greater than largest int248).\\n *\\n * Counterpart to Solidity's `int248` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 248 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt248(int256 value) internal pure returns (int248 downcasted) {\\n downcasted = int248(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 248 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int240 from int256, reverting on\\n * overflow (when the input is less than smallest int240 or\\n * greater than largest int240).\\n *\\n * Counterpart to Solidity's `int240` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 240 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt240(int256 value) internal pure returns (int240 downcasted) {\\n downcasted = int240(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 240 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int232 from int256, reverting on\\n * overflow (when the input is less than smallest int232 or\\n * greater than largest int232).\\n *\\n * Counterpart to Solidity's `int232` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 232 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt232(int256 value) internal pure returns (int232 downcasted) {\\n downcasted = int232(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 232 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int224 from int256, reverting on\\n * overflow (when the input is less than smallest int224 or\\n * greater than largest int224).\\n *\\n * Counterpart to Solidity's `int224` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 224 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt224(int256 value) internal pure returns (int224 downcasted) {\\n downcasted = int224(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 224 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int216 from int256, reverting on\\n * overflow (when the input is less than smallest int216 or\\n * greater than largest int216).\\n *\\n * Counterpart to Solidity's `int216` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 216 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt216(int256 value) internal pure returns (int216 downcasted) {\\n downcasted = int216(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 216 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int208 from int256, reverting on\\n * overflow (when the input is less than smallest int208 or\\n * greater than largest int208).\\n *\\n * Counterpart to Solidity's `int208` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 208 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt208(int256 value) internal pure returns (int208 downcasted) {\\n downcasted = int208(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 208 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int200 from int256, reverting on\\n * overflow (when the input is less than smallest int200 or\\n * greater than largest int200).\\n *\\n * Counterpart to Solidity's `int200` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 200 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt200(int256 value) internal pure returns (int200 downcasted) {\\n downcasted = int200(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 200 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int192 from int256, reverting on\\n * overflow (when the input is less than smallest int192 or\\n * greater than largest int192).\\n *\\n * Counterpart to Solidity's `int192` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 192 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt192(int256 value) internal pure returns (int192 downcasted) {\\n downcasted = int192(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 192 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int184 from int256, reverting on\\n * overflow (when the input is less than smallest int184 or\\n * greater than largest int184).\\n *\\n * Counterpart to Solidity's `int184` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 184 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt184(int256 value) internal pure returns (int184 downcasted) {\\n downcasted = int184(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 184 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int176 from int256, reverting on\\n * overflow (when the input is less than smallest int176 or\\n * greater than largest int176).\\n *\\n * Counterpart to Solidity's `int176` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 176 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt176(int256 value) internal pure returns (int176 downcasted) {\\n downcasted = int176(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 176 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int168 from int256, reverting on\\n * overflow (when the input is less than smallest int168 or\\n * greater than largest int168).\\n *\\n * Counterpart to Solidity's `int168` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 168 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt168(int256 value) internal pure returns (int168 downcasted) {\\n downcasted = int168(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 168 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int160 from int256, reverting on\\n * overflow (when the input is less than smallest int160 or\\n * greater than largest int160).\\n *\\n * Counterpart to Solidity's `int160` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 160 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt160(int256 value) internal pure returns (int160 downcasted) {\\n downcasted = int160(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 160 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int152 from int256, reverting on\\n * overflow (when the input is less than smallest int152 or\\n * greater than largest int152).\\n *\\n * Counterpart to Solidity's `int152` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 152 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt152(int256 value) internal pure returns (int152 downcasted) {\\n downcasted = int152(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 152 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int144 from int256, reverting on\\n * overflow (when the input is less than smallest int144 or\\n * greater than largest int144).\\n *\\n * Counterpart to Solidity's `int144` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 144 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt144(int256 value) internal pure returns (int144 downcasted) {\\n downcasted = int144(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 144 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int136 from int256, reverting on\\n * overflow (when the input is less than smallest int136 or\\n * greater than largest int136).\\n *\\n * Counterpart to Solidity's `int136` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 136 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt136(int256 value) internal pure returns (int136 downcasted) {\\n downcasted = int136(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 136 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int128 from int256, reverting on\\n * overflow (when the input is less than smallest int128 or\\n * greater than largest int128).\\n *\\n * Counterpart to Solidity's `int128` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 128 bits\\n *\\n * _Available since v3.1._\\n */\\n function toInt128(int256 value) internal pure returns (int128 downcasted) {\\n downcasted = int128(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 128 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int120 from int256, reverting on\\n * overflow (when the input is less than smallest int120 or\\n * greater than largest int120).\\n *\\n * Counterpart to Solidity's `int120` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 120 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt120(int256 value) internal pure returns (int120 downcasted) {\\n downcasted = int120(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 120 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int112 from int256, reverting on\\n * overflow (when the input is less than smallest int112 or\\n * greater than largest int112).\\n *\\n * Counterpart to Solidity's `int112` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 112 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt112(int256 value) internal pure returns (int112 downcasted) {\\n downcasted = int112(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 112 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int104 from int256, reverting on\\n * overflow (when the input is less than smallest int104 or\\n * greater than largest int104).\\n *\\n * Counterpart to Solidity's `int104` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 104 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt104(int256 value) internal pure returns (int104 downcasted) {\\n downcasted = int104(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 104 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int96 from int256, reverting on\\n * overflow (when the input is less than smallest int96 or\\n * greater than largest int96).\\n *\\n * Counterpart to Solidity's `int96` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 96 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt96(int256 value) internal pure returns (int96 downcasted) {\\n downcasted = int96(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 96 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int88 from int256, reverting on\\n * overflow (when the input is less than smallest int88 or\\n * greater than largest int88).\\n *\\n * Counterpart to Solidity's `int88` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 88 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt88(int256 value) internal pure returns (int88 downcasted) {\\n downcasted = int88(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 88 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int80 from int256, reverting on\\n * overflow (when the input is less than smallest int80 or\\n * greater than largest int80).\\n *\\n * Counterpart to Solidity's `int80` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 80 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt80(int256 value) internal pure returns (int80 downcasted) {\\n downcasted = int80(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 80 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int72 from int256, reverting on\\n * overflow (when the input is less than smallest int72 or\\n * greater than largest int72).\\n *\\n * Counterpart to Solidity's `int72` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 72 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt72(int256 value) internal pure returns (int72 downcasted) {\\n downcasted = int72(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 72 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int64 from int256, reverting on\\n * overflow (when the input is less than smallest int64 or\\n * greater than largest int64).\\n *\\n * Counterpart to Solidity's `int64` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 64 bits\\n *\\n * _Available since v3.1._\\n */\\n function toInt64(int256 value) internal pure returns (int64 downcasted) {\\n downcasted = int64(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 64 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int56 from int256, reverting on\\n * overflow (when the input is less than smallest int56 or\\n * greater than largest int56).\\n *\\n * Counterpart to Solidity's `int56` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 56 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt56(int256 value) internal pure returns (int56 downcasted) {\\n downcasted = int56(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 56 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int48 from int256, reverting on\\n * overflow (when the input is less than smallest int48 or\\n * greater than largest int48).\\n *\\n * Counterpart to Solidity's `int48` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 48 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt48(int256 value) internal pure returns (int48 downcasted) {\\n downcasted = int48(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 48 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int40 from int256, reverting on\\n * overflow (when the input is less than smallest int40 or\\n * greater than largest int40).\\n *\\n * Counterpart to Solidity's `int40` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 40 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt40(int256 value) internal pure returns (int40 downcasted) {\\n downcasted = int40(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 40 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int32 from int256, reverting on\\n * overflow (when the input is less than smallest int32 or\\n * greater than largest int32).\\n *\\n * Counterpart to Solidity's `int32` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 32 bits\\n *\\n * _Available since v3.1._\\n */\\n function toInt32(int256 value) internal pure returns (int32 downcasted) {\\n downcasted = int32(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 32 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int24 from int256, reverting on\\n * overflow (when the input is less than smallest int24 or\\n * greater than largest int24).\\n *\\n * Counterpart to Solidity's `int24` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 24 bits\\n *\\n * _Available since v4.7._\\n */\\n function toInt24(int256 value) internal pure returns (int24 downcasted) {\\n downcasted = int24(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 24 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int16 from int256, reverting on\\n * overflow (when the input is less than smallest int16 or\\n * greater than largest int16).\\n *\\n * Counterpart to Solidity's `int16` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 16 bits\\n *\\n * _Available since v3.1._\\n */\\n function toInt16(int256 value) internal pure returns (int16 downcasted) {\\n downcasted = int16(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 16 bits\\\");\\n }\\n\\n /**\\n * @dev Returns the downcasted int8 from int256, reverting on\\n * overflow (when the input is less than smallest int8 or\\n * greater than largest int8).\\n *\\n * Counterpart to Solidity's `int8` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 8 bits\\n *\\n * _Available since v3.1._\\n */\\n function toInt8(int256 value) internal pure returns (int8 downcasted) {\\n downcasted = int8(value);\\n require(downcasted == value, \\\"SafeCast: value doesn't fit in 8 bits\\\");\\n }\\n\\n /**\\n * @dev Converts an unsigned uint256 into a signed int256.\\n *\\n * Requirements:\\n *\\n * - input must be less than or equal to maxInt256.\\n *\\n * _Available since v3.0._\\n */\\n function toInt256(uint256 value) internal pure returns (int256) {\\n // Note: Unsafe cast below is okay because `type(int256).max` is guaranteed to be positive\\n require(value <= uint256(type(int256).max), \\\"SafeCast: value doesn't fit in an int256\\\");\\n return int256(value);\\n }\\n}\\n\",\"keccak256\":\"0x52a8cfb0f5239d11b457dcdd1b326992ef672714ca8da71a157255bddd13f3ad\",\"license\":\"MIT\"},\"contracts/Distributor.sol\":{\"content\":\"// SPDX-License-Identifier: BUSL-1.1\\n\\n/*\\n * \\u2588 \\n ***** \\u2593\\u2593\\u2593 \\n * \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\n * ///. \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\n ***** //////// \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\n * ///////////// \\u2593\\u2593\\u2593 \\n \\u2593\\u2593 ////////////////// \\u2588 \\u2593\\u2593 \\n \\u2593\\u2593 \\u2593\\u2593 /////////////////////// \\u2593\\u2593 \\u2593\\u2593 \\n \\u2593\\u2593 \\u2593\\u2593 //////////////////////////// \\u2593\\u2593 \\u2593\\u2593 \\n \\u2593\\u2593 \\u2593\\u2593 /////////\\u2593\\u2593\\u2593///////\\u2593\\u2593\\u2593///////// \\u2593\\u2593 \\u2593\\u2593 \\n \\u2593\\u2593 ,////////////////////////////////////// \\u2593\\u2593 \\u2593\\u2593 \\n \\u2593\\u2593 ////////////////////////////////////////// \\u2593\\u2593 \\n \\u2593\\u2593 //////////////////////\\u2593\\u2593\\u2593\\u2593///////////////////// \\n ,//////////////////////////////////////////////////// \\n .////////////////////////////////////////////////////////// \\n .//////////////////////////\\u2588\\u2588.,//////////////////////////\\u2588 \\n .//////////////////////\\u2588\\u2588\\u2588\\u2588..,./////////////////////\\u2588\\u2588 \\n ...////////////////\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588.....,.////////////////\\u2588\\u2588\\u2588 \\n ,.,////////////\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588 ........,///////////\\u2588\\u2588\\u2588\\u2588 \\n .,.,//////\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588 ,.......///////\\u2588\\u2588\\u2588\\u2588 \\n ,..//\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588 ........./\\u2588\\u2588\\u2588\\u2588 \\n ..,\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588 .....,\\u2588\\u2588\\u2588 \\n .\\u2588\\u2588 ,.,\\u2588 \\n \\n \\n \\n \\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\n \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593 \\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593 \\n \\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593 \\n \\u2593\\u2593\\u2593 \\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\n*/\\n\\npragma solidity ^0.8.17;\\n\\nimport { IERC20 } from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport { SafeERC20 } from \\\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\\\";\\nimport { SafeCast } from \\\"@openzeppelin/contracts/utils/math/SafeCast.sol\\\";\\n\\nimport \\\"./utils/UUPSHelper.sol\\\";\\n\\nstruct MerkleTree {\\n // Root of a Merkle tree which leaves are `(address user, address token, uint amount)`\\n // representing an amount of tokens accumulated by `user`.\\n // The Merkle tree is assumed to have only increasing amounts: that is to say if a user can claim 1,\\n // then after the amount associated in the Merkle tree for this token should be x > 1\\n bytes32 merkleRoot;\\n // Ipfs hash of the tree data\\n bytes32 ipfsHash;\\n}\\n\\nstruct Claim {\\n uint208 amount;\\n uint48 timestamp;\\n bytes32 merkleRoot;\\n}\\n\\n/// @title Distributor\\n/// @notice Allows LPs on AMMs with concentrated liquidity to claim the rewards that were distributed to them\\n/// @author Angle Labs. Inc\\ncontract Distributor is UUPSHelper {\\n using SafeERC20 for IERC20;\\n\\n /// @notice Epoch duration\\n uint32 internal constant _EPOCH_DURATION = 3600;\\n\\n // ================================= VARIABLES =================================\\n\\n /// @notice Tree of claimable tokens through this contract\\n MerkleTree public tree;\\n\\n /// @notice Tree that was in place in the contract before the last `tree` update\\n MerkleTree public lastTree;\\n\\n /// @notice Token to deposit to freeze the roots update\\n IERC20 public disputeToken;\\n\\n /// @notice `Core` contract handling access control\\n ICore public core;\\n\\n /// @notice Address which created the dispute\\n /// @dev Used to store if there is an ongoing dispute\\n address public disputer;\\n\\n /// @notice When the current tree will become valid\\n uint48 public endOfDisputePeriod;\\n\\n /// @notice Time after which a change in a tree becomes effective, in EPOCH_DURATION\\n uint48 public disputePeriod;\\n\\n /// @notice Amount to deposit to freeze the roots update\\n uint256 public disputeAmount;\\n\\n /// @notice Mapping user -> token -> amount to track claimed amounts\\n mapping(address => mapping(address => Claim)) public claimed;\\n\\n /// @notice Trusted EOAs to update the Merkle root\\n mapping(address => uint256) public canUpdateMerkleRoot;\\n\\n /// @notice Whether or not to disable permissionless claiming\\n mapping(address => uint256) public onlyOperatorCanClaim;\\n\\n /// @notice user -> operator -> authorisation to claim\\n mapping(address => mapping(address => uint256)) public operators;\\n\\n uint256[38] private __gap;\\n\\n // =================================== EVENTS ==================================\\n\\n event Claimed(address indexed user, address indexed token, uint256 amount);\\n event DisputeAmountUpdated(uint256 _disputeAmount);\\n event Disputed(string reason);\\n event DisputePeriodUpdated(uint48 _disputePeriod);\\n event DisputeResolved(bool valid);\\n event DisputeTokenUpdated(address indexed _disputeToken);\\n event OperatorClaimingToggled(address indexed user, bool isEnabled);\\n event OperatorToggled(address indexed user, address indexed operator, bool isWhitelisted);\\n event Recovered(address indexed token, address indexed to, uint256 amount);\\n event Revoked(); // With this event an indexer could maintain a table (timestamp, merkleRootUpdate)\\n event TreeUpdated(bytes32 merkleRoot, bytes32 ipfsHash, uint48 endOfDisputePeriod);\\n event TrustedToggled(address indexed eoa, bool trust);\\n\\n // ================================= MODIFIERS =================================\\n\\n /// @notice Checks whether the `msg.sender` has the governor role or the guardian role\\n modifier onlyGovernorOrGuardian() {\\n if (!core.isGovernorOrGuardian(msg.sender)) revert NotGovernorOrGuardian();\\n _;\\n }\\n\\n /// @notice Checks whether the `msg.sender` is the `user` address or is a trusted address\\n modifier onlyTrustedOrUser(address user) {\\n if (user != msg.sender && canUpdateMerkleRoot[msg.sender] != 1 && !core.isGovernorOrGuardian(msg.sender))\\n revert NotTrusted();\\n _;\\n }\\n\\n // ================================ CONSTRUCTOR ================================\\n\\n constructor() initializer {}\\n\\n function initialize(ICore _core) external initializer {\\n if (address(_core) == address(0)) revert ZeroAddress();\\n core = _core;\\n }\\n\\n /// @inheritdoc UUPSUpgradeable\\n function _authorizeUpgrade(address) internal view override onlyGuardianUpgrader(core) {}\\n\\n // =============================== MAIN FUNCTION ===============================\\n\\n /// @notice Claims rewards for a given set of users\\n /// @dev Anyone may call this function for anyone else, funds go to destination regardless, it's just a question of\\n /// who provides the proof and pays the gas: `msg.sender` is used only for addresses that require a trusted operator\\n /// @param users Recipient of tokens\\n /// @param tokens ERC20 claimed\\n /// @param amounts Amount of tokens that will be sent to the corresponding users\\n /// @param proofs Array of hashes bridging from a leaf `(hash of user | token | amount)` to the Merkle root\\n function claim(\\n address[] calldata users,\\n address[] calldata tokens,\\n uint256[] calldata amounts,\\n bytes32[][] calldata proofs\\n ) external {\\n uint256 usersLength = users.length;\\n if (\\n usersLength == 0 ||\\n usersLength != tokens.length ||\\n usersLength != amounts.length ||\\n usersLength != proofs.length\\n ) revert InvalidLengths();\\n\\n for (uint256 i; i < usersLength; ) {\\n address user = users[i];\\n address token = tokens[i];\\n uint256 amount = amounts[i];\\n\\n // Checking if only an approved operator can claim for `user`\\n if (onlyOperatorCanClaim[user] == 1 && operators[user][msg.sender] == 0) revert NotWhitelisted();\\n\\n // Verifying proof\\n bytes32 leaf = keccak256(abi.encode(user, token, amount));\\n if (!_verifyProof(leaf, proofs[i])) revert InvalidProof();\\n\\n // Closing reentrancy gate here\\n uint256 toSend = amount - claimed[user][token].amount;\\n claimed[user][token] = Claim(SafeCast.toUint208(amount), uint48(block.timestamp), getMerkleRoot());\\n\\n IERC20(token).safeTransfer(user, toSend);\\n emit Claimed(user, token, toSend);\\n unchecked {\\n ++i;\\n }\\n }\\n }\\n\\n /// @notice Returns the MerkleRoot that is currently live for the contract\\n function getMerkleRoot() public view returns (bytes32) {\\n if (block.timestamp >= endOfDisputePeriod && disputer == address(0)) return tree.merkleRoot;\\n else return lastTree.merkleRoot;\\n }\\n\\n // ============================ GOVERNANCE FUNCTIONS ===========================\\n\\n /// @notice Adds or removes EOAs which are trusted to update the Merkle root\\n function toggleTrusted(address eoa) external onlyGovernorOrGuardian {\\n uint256 trustedStatus = 1 - canUpdateMerkleRoot[eoa];\\n canUpdateMerkleRoot[eoa] = trustedStatus;\\n emit TrustedToggled(eoa, trustedStatus == 1);\\n }\\n\\n /// @notice Updates Merkle Tree\\n function updateTree(MerkleTree calldata _tree) external {\\n if (\\n disputer != address(0) ||\\n // A trusted address cannot update a tree right after a precedent tree update otherwise it can de facto\\n // validate a tree which has not passed the dispute period\\n ((canUpdateMerkleRoot[msg.sender] != 1 || block.timestamp < endOfDisputePeriod) &&\\n !core.isGovernorOrGuardian(msg.sender))\\n ) revert NotTrusted();\\n MerkleTree memory _lastTree = tree;\\n tree = _tree;\\n lastTree = _lastTree;\\n\\n uint48 _endOfPeriod = _endOfDisputePeriod(uint48(block.timestamp));\\n endOfDisputePeriod = _endOfPeriod;\\n emit TreeUpdated(_tree.merkleRoot, _tree.ipfsHash, _endOfPeriod);\\n }\\n\\n /// @notice Freezes the Merkle tree update until the dispute is resolved\\n /// @dev Requires a deposit of `disputeToken` that'll be slashed if the dispute is not accepted\\n /// @dev It is only possible to create a dispute within `disputePeriod` after each tree update\\n function disputeTree(string memory reason) external {\\n if (disputer != address(0)) revert UnresolvedDispute();\\n if (block.timestamp >= endOfDisputePeriod) revert InvalidDispute();\\n IERC20(disputeToken).safeTransferFrom(msg.sender, address(this), disputeAmount);\\n disputer = msg.sender;\\n emit Disputed(reason);\\n }\\n\\n /// @notice Resolve the ongoing dispute, if any\\n /// @param valid Whether the dispute was valid\\n function resolveDispute(bool valid) external onlyGovernorOrGuardian {\\n if (disputer == address(0)) revert NoDispute();\\n if (valid) {\\n IERC20(disputeToken).safeTransfer(disputer, disputeAmount);\\n // If a dispute is valid, the contract falls back to the last tree that was updated\\n _revokeTree();\\n } else {\\n IERC20(disputeToken).safeTransfer(msg.sender, disputeAmount);\\n endOfDisputePeriod = _endOfDisputePeriod(uint48(block.timestamp));\\n }\\n disputer = address(0);\\n emit DisputeResolved(valid);\\n }\\n\\n /// @notice Allows the governor or the guardian of this contract to fallback to the last version of the tree\\n /// immediately\\n function revokeTree() external onlyGovernorOrGuardian {\\n if (disputer != address(0)) revert UnresolvedDispute();\\n _revokeTree();\\n }\\n\\n /// @notice Toggles permissioned claiming for a given user\\n function toggleOnlyOperatorCanClaim(address user) external onlyTrustedOrUser(user) {\\n uint256 oldValue = onlyOperatorCanClaim[user];\\n onlyOperatorCanClaim[user] = 1 - oldValue;\\n emit OperatorClaimingToggled(user, oldValue == 0);\\n }\\n\\n /// @notice Toggles whitelisting for a given user and a given operator\\n function toggleOperator(address user, address operator) external onlyTrustedOrUser(user) {\\n uint256 oldValue = operators[user][operator];\\n operators[user][operator] = 1 - oldValue;\\n emit OperatorToggled(user, operator, oldValue == 0);\\n }\\n\\n /// @notice Recovers any ERC20 token\\n function recoverERC20(address tokenAddress, address to, uint256 amountToRecover) external onlyGovernorOrGuardian {\\n IERC20(tokenAddress).safeTransfer(to, amountToRecover);\\n emit Recovered(tokenAddress, to, amountToRecover);\\n }\\n\\n /// @notice Sets the dispute period after which a tree update becomes effective\\n function setDisputePeriod(uint48 _disputePeriod) external onlyGovernorOrGuardian {\\n disputePeriod = uint48(_disputePeriod);\\n emit DisputePeriodUpdated(_disputePeriod);\\n }\\n\\n /// @notice Sets the token used as a caution during disputes\\n function setDisputeToken(IERC20 _disputeToken) external onlyGovernorOrGuardian {\\n if (disputer != address(0)) revert UnresolvedDispute();\\n disputeToken = _disputeToken;\\n emit DisputeTokenUpdated(address(_disputeToken));\\n }\\n\\n /// @notice Sets the amount of `disputeToken` used as a caution during disputes\\n function setDisputeAmount(uint256 _disputeAmount) external onlyGovernorOrGuardian {\\n if (disputer != address(0)) revert UnresolvedDispute();\\n disputeAmount = _disputeAmount;\\n emit DisputeAmountUpdated(_disputeAmount);\\n }\\n\\n // ============================= INTERNAL FUNCTIONS ============================\\n\\n /// @notice Fallback to the last version of the tree\\n function _revokeTree() internal {\\n MerkleTree memory _tree = lastTree;\\n endOfDisputePeriod = 0;\\n tree = _tree;\\n emit Revoked();\\n emit TreeUpdated(\\n _tree.merkleRoot,\\n _tree.ipfsHash,\\n (uint48(block.timestamp) / _EPOCH_DURATION) * (_EPOCH_DURATION) // Last hour\\n );\\n }\\n\\n /// @notice Returns the end of the dispute period\\n /// @dev treeUpdate is rounded up to next hour and then `disputePeriod` hours are added\\n function _endOfDisputePeriod(uint48 treeUpdate) internal view returns (uint48) {\\n return ((treeUpdate - 1) / _EPOCH_DURATION + 1 + disputePeriod) * (_EPOCH_DURATION);\\n }\\n\\n /// @notice Checks the validity of a proof\\n /// @param leaf Hashed leaf data, the starting point of the proof\\n /// @param proof Array of hashes forming a hash chain from leaf to root\\n /// @return true If proof is correct, else false\\n function _verifyProof(bytes32 leaf, bytes32[] memory proof) internal view returns (bool) {\\n bytes32 currentHash = leaf;\\n uint256 proofLength = proof.length;\\n for (uint256 i; i < proofLength; ) {\\n if (currentHash < proof[i]) {\\n currentHash = keccak256(abi.encode(currentHash, proof[i]));\\n } else {\\n currentHash = keccak256(abi.encode(proof[i], currentHash));\\n }\\n unchecked {\\n ++i;\\n }\\n }\\n bytes32 root = getMerkleRoot();\\n if (root == bytes32(0)) revert InvalidUninitializedRoot();\\n return currentHash == root;\\n }\\n}\\n\",\"keccak256\":\"0xe59a10e2d62c9088ae8959ac6d839d995863832ea9fdb71485674264a21a9510\",\"license\":\"BUSL-1.1\"},\"contracts/interfaces/ICore.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\n\\npragma solidity ^0.8.17;\\n\\n/// @title ICore\\n/// @author Angle Labs, Inc.\\n/// @notice Interface for the `Core` contracts of smart contract modules used in Angle Labs contracts\\ninterface ICore {\\n /// @notice Checks whether an address is governor\\n /// @param admin Address to check\\n /// @return Whether the address has the `GOVERNOR_ROLE` or not\\n function isGovernor(address admin) external view returns (bool);\\n\\n /// @notice Checks whether an address is a governor or a guardian of a module\\n /// @param admin Address to check\\n /// @return Whether the address has the `GUARDIAN_ROLE` or not\\n /// @dev Governance should make sure when adding a governor to also give this governor the guardian\\n /// role by calling the `addGovernor` function\\n function isGovernorOrGuardian(address admin) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x11e92b745193d16934aaeb873c0388041dce2ef3e359a9c3315b668b05903100\",\"license\":\"GPL-3.0\"},\"contracts/utils/Errors.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\n\\npragma solidity ^0.8.17;\\n\\nerror InvalidDispute();\\nerror InvalidLengths();\\nerror InvalidParam();\\nerror InvalidParams();\\nerror InvalidProof();\\nerror InvalidUninitializedRoot();\\nerror InvalidReward();\\nerror InvalidSignature();\\nerror NoDispute();\\nerror NotGovernor();\\nerror NotGovernorOrGuardian();\\nerror NotSigned();\\nerror NotTrusted();\\nerror NotWhitelisted();\\nerror UnresolvedDispute();\\nerror ZeroAddress();\\n\",\"keccak256\":\"0x7cd16f5988dee579532a71ff4afd8668c75add546e7e4724c1aaadd888355139\",\"license\":\"GPL-3.0\"},\"contracts/utils/UUPSHelper.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\n\\n/*\\n * \\u2588 \\n ***** \\u2593\\u2593\\u2593 \\n * \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\n * ///. \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\n ***** //////// \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\n * ///////////// \\u2593\\u2593\\u2593 \\n \\u2593\\u2593 ////////////////// \\u2588 \\u2593\\u2593 \\n \\u2593\\u2593 \\u2593\\u2593 /////////////////////// \\u2593\\u2593 \\u2593\\u2593 \\n \\u2593\\u2593 \\u2593\\u2593 //////////////////////////// \\u2593\\u2593 \\u2593\\u2593 \\n \\u2593\\u2593 \\u2593\\u2593 /////////\\u2593\\u2593\\u2593///////\\u2593\\u2593\\u2593///////// \\u2593\\u2593 \\u2593\\u2593 \\n \\u2593\\u2593 ,////////////////////////////////////// \\u2593\\u2593 \\u2593\\u2593 \\n \\u2593\\u2593 ////////////////////////////////////////// \\u2593\\u2593 \\n \\u2593\\u2593 //////////////////////\\u2593\\u2593\\u2593\\u2593///////////////////// \\n ,//////////////////////////////////////////////////// \\n .////////////////////////////////////////////////////////// \\n .//////////////////////////\\u2588\\u2588.,//////////////////////////\\u2588 \\n .//////////////////////\\u2588\\u2588\\u2588\\u2588..,./////////////////////\\u2588\\u2588 \\n ...////////////////\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588.....,.////////////////\\u2588\\u2588\\u2588 \\n ,.,////////////\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588 ........,///////////\\u2588\\u2588\\u2588\\u2588 \\n .,.,//////\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588 ,.......///////\\u2588\\u2588\\u2588\\u2588 \\n ,..//\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588 ........./\\u2588\\u2588\\u2588\\u2588 \\n ..,\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588 .....,\\u2588\\u2588\\u2588 \\n .\\u2588\\u2588 ,.,\\u2588 \\n \\n \\n \\n \\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\n \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593 \\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593 \\n \\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593 \\n \\u2593\\u2593\\u2593 \\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\n*/\\n\\npragma solidity ^0.8.17;\\n\\nimport { UUPSUpgradeable } from \\\"@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol\\\";\\n\\nimport { ICore } from \\\"../interfaces/ICore.sol\\\";\\nimport \\\"../utils/Errors.sol\\\";\\n\\n/// @title UUPSHelper\\n/// @notice Helper contract for UUPSUpgradeable contracts where the upgradeability is controlled by a specific address\\n/// @author Angle Labs., Inc\\n/// @dev The 0 address check in the modifier allows the use of these modifiers during initialization\\nabstract contract UUPSHelper is UUPSUpgradeable {\\n modifier onlyGuardianUpgrader(ICore _core) {\\n if (address(_core) != address(0) && !_core.isGovernorOrGuardian(msg.sender)) revert NotGovernorOrGuardian();\\n _;\\n }\\n\\n modifier onlyGovernorUpgrader(ICore _core) {\\n if (address(_core) != address(0) && !_core.isGovernor(msg.sender)) revert NotGovernor();\\n _;\\n }\\n\\n constructor() initializer {}\\n}\\n\",\"keccak256\":\"0xb8011db6d148c8a111678c8074343c82114b923806aee0f60c48ed05f8bd6c40\",\"license\":\"GPL-3.0\"}},\"version\":1}", + "bytecode": "0x60a0604052306080523480156200001557600080fd5b50600054610100900460ff1615808015620000375750600054600160ff909116105b8062000067575062000054306200022060201b620022ed1760201c565b15801562000067575060005460ff166001145b620000bf5760405162461bcd60e51b815260206004820152602e60248201526000805160206200391683398151915260448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084015b60405180910390fd5b6000805460ff191660011790558015620000e3576000805461ff0019166101001790555b801562000119576000805461ff001916905560405160018152600080516020620039368339815191529060200160405180910390a15b50600054610100900460ff16158080156200013b5750600054600160ff909116105b806200016b575062000158306200022060201b620022ed1760201c565b1580156200016b575060005460ff166001145b620001bf5760405162461bcd60e51b815260206004820152602e60248201526000805160206200391683398151915260448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401620000b6565b6000805460ff191660011790558015620001e3576000805461ff0019166101001790555b801562000219576000805461ff001916905560405160018152600080516020620039368339815191529060200160405180910390a15b506200022f565b6001600160a01b03163b151590565b6080516136af6200026760003960008181610c4a01528181610cff01528181610ff9015281816110a901526111f201526136af6000f3fe6080604052600436106101c25760003560e01c80635cec892a116100f7578063bdac7ca311610095578063d9c9808711610064578063d9c9808714610626578063e57480e514610646578063f2f4eb2614610673578063fd54b228146106a057600080fd5b8063bdac7ca314610589578063c4d66de8146105a9578063c748d261146105c9578063cce80e7a146105f657600080fd5b806371ee95c0116100d157806371ee95c0146105145780637ee843491461053457806389e1e82a14610554578063957888351461057457600080fd5b80635cec892a1461046b578063623b9e9d146104a25780636ac56103146104c257600080fd5b80632a25dd4111610164578063495906571161013e57806349590657146103da5780634f1ef286146103ef57806352d1902d146104025780635bf31d4d1461041757600080fd5b80632a25dd411461037a5780633659cfe61461039a5780634641fdef146103ba57600080fd5b80631171bda9116101a05780631171bda9146102d557806314769142146102f55780632637588e14610322578063288278381461035a57600080fd5b806309454ba3146101c75780630c9cbf0e146101f05780630d10fca3146102b3575b600080fd5b3480156101d357600080fd5b506101dd606c5481565b6040519081526020015b60405180910390f35b3480156101fc57600080fd5b5061027461020b36600461305c565b606d6020908152600092835260408084209091529082529020805460019091015479ffffffffffffffffffffffffffffffffffffffffffffffffffff8216917a010000000000000000000000000000000000000000000000000000900465ffffffffffff169083565b6040805179ffffffffffffffffffffffffffffffffffffffffffffffffffff909416845265ffffffffffff9092166020840152908201526060016101e7565b3480156102bf57600080fd5b506102d36102ce366004613095565b6106bb565b005b3480156102e157600080fd5b506102d36102f03660046130ae565b61080f565b34801561030157600080fd5b506101dd6103103660046130ef565b606f6020526000908152604090205481565b34801561032e57600080fd5b506101dd61033d36600461305c565b607060209081526000928352604080842090915290825290205481565b34801561036657600080fd5b506102d36103753660046130ef565b610964565b34801561038657600080fd5b506102d36103953660046131cf565b610b02565b3480156103a657600080fd5b506102d36103b53660046130ef565b610c33565b3480156103c657600080fd5b506102d36103d5366004613218565b610e3d565b3480156103e657600080fd5b506101dd610f84565b6102d36103fd366004613240565b610fe2565b34801561040e57600080fd5b506101dd6111d8565b34801561042357600080fd5b50606b54610454907a010000000000000000000000000000000000000000000000000000900465ffffffffffff1681565b60405165ffffffffffff90911681526020016101e7565b34801561047757600080fd5b50606b546104549074010000000000000000000000000000000000000000900465ffffffffffff1681565b3480156104ae57600080fd5b506102d36104bd3660046130ef565b6112c4565b3480156104ce57600080fd5b50606b546104ef9073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016101e7565b34801561052057600080fd5b506102d361052f3660046132f0565b61144b565b34801561054057600080fd5b506102d361054f3660046130ef565b611885565b34801561056057600080fd5b506102d361056f3660046133c2565b6119e6565b34801561058057600080fd5b506102d3611bf0565b34801561059557600080fd5b506102d36105a436600461305c565b611d12565b3480156105b557600080fd5b506102d36105c43660046130ef565b611ecd565b3480156105d557600080fd5b506069546104ef9073ffffffffffffffffffffffffffffffffffffffff1681565b34801561060257600080fd5b50606754606854610611919082565b604080519283526020830191909152016101e7565b34801561063257600080fd5b506102d36106413660046133df565b6120e4565b34801561065257600080fd5b506101dd6106613660046130ef565b606e6020526000908152604090205481565b34801561067f57600080fd5b50606a546104ef9073ffffffffffffffffffffffffffffffffffffffff1681565b3480156106ac57600080fd5b50606554606654610611919082565b606a546040517f521d4de900000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff9091169063521d4de990602401602060405180830381865afa158015610729573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061074d91906133f7565b610783576040517f99e120bc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606b5473ffffffffffffffffffffffffffffffffffffffff16156107d3576040517f0583257400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606c8190556040518181527f39bb629f3d59f5eddf978050e1f5fabeca2b5d02dfc9c25e84f32e7da1069db4906020015b60405180910390a150565b606a546040517f521d4de900000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff9091169063521d4de990602401602060405180830381865afa15801561087d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108a191906133f7565b6108d7576040517f99e120bc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6108f873ffffffffffffffffffffffffffffffffffffffff84168383612309565b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167ffff3b3844276f57024e0b42afec1a37f75db36511e43819a4f2a63ab7862b6488360405161095791815260200190565b60405180910390a3505050565b8073ffffffffffffffffffffffffffffffffffffffff8116331480159061099b5750336000908152606e6020526040902054600114155b8015610a365750606a546040517f521d4de900000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff9091169063521d4de990602401602060405180830381865afa158015610a10573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a3491906133f7565b155b15610a6d576040517fc22a648e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff82166000908152606f6020526040902054610a9e816001613443565b73ffffffffffffffffffffffffffffffffffffffff84166000818152606f602090815260409182902093909355518315815290917f81d714ca01079a19c106993b49b2764df6bb6abe740164ef7b77ee9c100a024a910160405180910390a2505050565b606b5473ffffffffffffffffffffffffffffffffffffffff1615610b52576040517f0583257400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606b5474010000000000000000000000000000000000000000900465ffffffffffff164210610bad576040517f1a8f039500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606c54606954610bd99173ffffffffffffffffffffffffffffffffffffffff90911690339030906123e2565b606b80547fffffffffffffffffffffffff000000000000000000000000000000000000000016331790556040517f5eca00b8ed745eee61451333090bfa56aa1f2a9e696a2aebe5f1f5b6cef6f2ff9061080490839061347a565b73ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000163003610cfd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602c60248201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060448201527f64656c656761746563616c6c000000000000000000000000000000000000000060648201526084015b60405180910390fd5b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16610d727f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5473ffffffffffffffffffffffffffffffffffffffff1690565b73ffffffffffffffffffffffffffffffffffffffff1614610e15576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602c60248201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060448201527f6163746976652070726f787900000000000000000000000000000000000000006064820152608401610cf4565b610e1e81612446565b60408051600080825260208201909252610e3a91839190612530565b50565b606a546040517f521d4de900000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff9091169063521d4de990602401602060405180830381865afa158015610eab573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ecf91906133f7565b610f05576040517f99e120bc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606b805479ffffffffffffffffffffffffffffffffffffffffffffffffffff167a01000000000000000000000000000000000000000000000000000065ffffffffffff8416908102919091179091556040519081527ffdf22e84af74bd4ab6b9646f6370a02bc886ed6ac25882db14e4ebf4b8e3bc7e90602001610804565b606b5460009074010000000000000000000000000000000000000000900465ffffffffffff164210801590610fcf5750606b5473ffffffffffffffffffffffffffffffffffffffff16155b15610fdb575060655490565b5060675490565b73ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001630036110a7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602c60248201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060448201527f64656c656761746563616c6c00000000000000000000000000000000000000006064820152608401610cf4565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1661111c7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5473ffffffffffffffffffffffffffffffffffffffff1690565b73ffffffffffffffffffffffffffffffffffffffff16146111bf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602c60248201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060448201527f6163746976652070726f787900000000000000000000000000000000000000006064820152608401610cf4565b6111c882612446565b6111d482826001612530565b5050565b60003073ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000161461129f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c60448201527f6c6564207468726f7567682064656c656761746563616c6c00000000000000006064820152608401610cf4565b507f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc90565b606a546040517f521d4de900000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff9091169063521d4de990602401602060405180830381865afa158015611332573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061135691906133f7565b61138c576040517f99e120bc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606b5473ffffffffffffffffffffffffffffffffffffffff16156113dc576040517f0583257400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606980547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081179091556040517f1db8d6629941dcb63d5e0c927b89c174c714e139a4b9107a49de839d755f5d7490600090a250565b868015806114595750808614155b806114645750808414155b8061146f5750808214155b156114a6576040517f1df89e8b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60005b818110156118795760008a8a838181106114c5576114c56134cb565b90506020020160208101906114da91906130ef565b905060008989848181106114f0576114f06134cb565b905060200201602081019061150591906130ef565b9050600088888581811061151b5761151b6134cb565b905060200201359050606f60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205460011480156115a1575073ffffffffffffffffffffffffffffffffffffffff83166000908152607060209081526040808320338452909152902054155b156115d8576040517f584a793800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040805173ffffffffffffffffffffffffffffffffffffffff8086166020830152841691810191909152606081018290526000906080016040516020818303038152906040528051906020012090506116868189898881811061163d5761163d6134cb565b905060200281019061164f91906134fa565b8080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525061272f92505050565b6116bc576040517f09bde33900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff8085166000908152606d602090815260408083209387168352929052908120546117179079ffffffffffffffffffffffffffffffffffffffffffffffffffff1684613443565b9050604051806060016040528061172d8561285b565b79ffffffffffffffffffffffffffffffffffffffffffffffffffff1681526020014265ffffffffffff168152602001611764610f84565b905273ffffffffffffffffffffffffffffffffffffffff8087166000908152606d602090815260408083209389168084529382529182902084519185015165ffffffffffff167a0100000000000000000000000000000000000000000000000000000279ffffffffffffffffffffffffffffffffffffffffffffffffffff909216919091178155920151600190920191909155611802908683612309565b8373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167ff7a40077ff7a04c7e61f6f26fb13774259ddf1b6bce9ecf26a8276cdd39926838360405161186191815260200190565b60405180910390a385600101955050505050506114a9565b50505050505050505050565b606a546040517f521d4de900000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff9091169063521d4de990602401602060405180830381865afa1580156118f3573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061191791906133f7565b61194d576040517f99e120bc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff81166000908152606e602052604081205461197e906001613443565b73ffffffffffffffffffffffffffffffffffffffff83166000818152606e6020908152604091829020849055905160018414815292935090917f7628ea5f6112a16b36a8239aa208395a8e8f221688cfb3a5461faffb9700abcd910160405180910390a25050565b606a546040517f521d4de900000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff9091169063521d4de990602401602060405180830381865afa158015611a54573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a7891906133f7565b611aae576040517f99e120bc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606b5473ffffffffffffffffffffffffffffffffffffffff16611afd576040517f9375474800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8015611b3e57606b54606c54606954611b319273ffffffffffffffffffffffffffffffffffffffff91821692911690612309565b611b3961290b565b611b96565b606c54606954611b689173ffffffffffffffffffffffffffffffffffffffff909116903390612309565b611b71426129e1565b606b60146101000a81548165ffffffffffff021916908365ffffffffffff1602179055505b606b80547fffffffffffffffffffffffff000000000000000000000000000000000000000016905560405181151581527f8015c5005d9ad5d85ca80d3f894f08e0159277704c54166e5cff108800fa80cd90602001610804565b606a546040517f521d4de900000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff9091169063521d4de990602401602060405180830381865afa158015611c5e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c8291906133f7565b611cb8576040517f99e120bc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606b5473ffffffffffffffffffffffffffffffffffffffff1615611d08576040517f0583257400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b611d1061290b565b565b8173ffffffffffffffffffffffffffffffffffffffff81163314801590611d495750336000908152606e6020526040902054600114155b8015611de45750606a546040517f521d4de900000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff9091169063521d4de990602401602060405180830381865afa158015611dbe573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611de291906133f7565b155b15611e1b576040517fc22a648e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff808416600090815260706020908152604080832093861683529290522054611e59816001613443565b73ffffffffffffffffffffffffffffffffffffffff858116600081815260706020908152604080832094891680845294825291829020949094555184158152919290917f42343f44c66ea1eaffa334760d3da2cb731d2a0b3b3e30423df997faa36cc95c910160405180910390a350505050565b600054610100900460ff1615808015611eed5750600054600160ff909116105b80611f075750303b158015611f07575060005460ff166001145b611f93576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a65640000000000000000000000000000000000006064820152608401610cf4565b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790558015611ff157600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff166101001790555b73ffffffffffffffffffffffffffffffffffffffff821661203e576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606a80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff841617905580156111d457600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15050565b606b5473ffffffffffffffffffffffffffffffffffffffff161515806121e05750336000908152606e602052604090205460011415806121455750606b5474010000000000000000000000000000000000000000900465ffffffffffff1642105b80156121e05750606a546040517f521d4de900000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff9091169063521d4de990602401602060405180830381865afa1580156121ba573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121de91906133f7565b155b15612217576040517fc22a648e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b604080518082019091526065805480835260668054602080860182905286359094559285013590556067556068556000612250426129e1565b606b80547fffffffffffff000000000000ffffffffffffffffffffffffffffffffffffffff167401000000000000000000000000000000000000000065ffffffffffff841690810291909117909155604080518635815260208088013590820152908101919091529091507f23aa2e4f757a7bd974085d3e11439a843b137b30905e3ffd51b2097c34aef62e9060600160405180910390a1505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b60405173ffffffffffffffffffffffffffffffffffffffff83166024820152604481018290526123dd9084907fa9059cbb00000000000000000000000000000000000000000000000000000000906064015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152612a46565b505050565b60405173ffffffffffffffffffffffffffffffffffffffff808516602483015283166044820152606481018290526124409085907f23b872dd000000000000000000000000000000000000000000000000000000009060840161235b565b50505050565b606a5473ffffffffffffffffffffffffffffffffffffffff1680158015906124f957506040517f521d4de900000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff82169063521d4de990602401602060405180830381865afa1580156124d3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124f791906133f7565b155b156111d4576040517f99e120bc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff1615612563576123dd83612b52565b8273ffffffffffffffffffffffffffffffffffffffff166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa9250505080156125e8575060408051601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01682019092526125e591810190613562565b60015b612674576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201527f6f6e206973206e6f7420555550530000000000000000000000000000000000006064820152608401610cf4565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc8114612723576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f7860448201527f6961626c655555494400000000000000000000000000000000000000000000006064820152608401610cf4565b506123dd838383612c5c565b80516000908390825b8181101561280957848181518110612752576127526134cb565b60200260200101518310156127b35782858281518110612774576127746134cb565b6020026020010151604051602001612796929190918252602082015260400190565b604051602081830303815290604052805190602001209250612801565b8481815181106127c5576127c56134cb565b6020026020010151836040516020016127e8929190918252602082015260400190565b6040516020818303038152906040528051906020012092505b600101612738565b506000612814610f84565b90508061284d576040517f094ad65800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b919091149150505b92915050565b600079ffffffffffffffffffffffffffffffffffffffffffffffffffff821115612907576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602760248201527f53616665436173743a2076616c756520646f65736e27742066697420696e203260448201527f30382062697473000000000000000000000000000000000000000000000000006064820152608401610cf4565b5090565b60408051808201825260675480825260685460208301819052606b80547fffffffffffff000000000000ffffffffffffffffffffffffffffffffffffffff16905560659190915560665590517f44825a4b2df8acb19ce4e1afba9aa850c8b65cdb7942e2078f27d0b0960efee690600090a1805160208201517f23aa2e4f757a7bd974085d3e11439a843b137b30905e3ffd51b2097c34aef62e9190610e106129b4814261357b565b6129be91906135c7565b60408051938452602084019290925265ffffffffffff1690820152606001610804565b606b54600090610e10907a010000000000000000000000000000000000000000000000000000900465ffffffffffff1681612a1d6001866135f1565b612a27919061357b565b612a32906001613617565b612a3c9190613617565b61285591906135c7565b6000612aa8826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16612c819092919063ffffffff16565b8051909150156123dd5780806020019051810190612ac691906133f7565b6123dd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610cf4565b73ffffffffffffffffffffffffffffffffffffffff81163b612bf6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e7472616374000000000000000000000000000000000000006064820152608401610cf4565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b612c6583612c9a565b600082511180612c725750805b156123dd576124408383612ce7565b6060612c908484600085612e26565b90505b9392505050565b612ca381612b52565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b606073ffffffffffffffffffffffffffffffffffffffff83163b612d8d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e747261637400000000000000000000000000000000000000000000000000006064820152608401610cf4565b6000808473ffffffffffffffffffffffffffffffffffffffff1684604051612db59190613636565b600060405180830381855af49150503d8060008114612df0576040519150601f19603f3d011682016040523d82523d6000602084013e612df5565b606091505b5091509150612e1d828260405180606001604052806027815260200161365360279139612f41565b95945050505050565b606082471015612eb8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610cf4565b6000808673ffffffffffffffffffffffffffffffffffffffff168587604051612ee19190613636565b60006040518083038185875af1925050503d8060008114612f1e576040519150601f19603f3d011682016040523d82523d6000602084013e612f23565b606091505b5091509150612f3487838387612f5a565b925050505b949350505050565b60608315612f50575081612c93565b612c938383612ff6565b60608315612ff0578251600003612fe95773ffffffffffffffffffffffffffffffffffffffff85163b612fe9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610cf4565b5081612f39565b612f3983835b8151156130065781518083602001fd5b806040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cf4919061347a565b73ffffffffffffffffffffffffffffffffffffffff81168114610e3a57600080fd5b6000806040838503121561306f57600080fd5b823561307a8161303a565b9150602083013561308a8161303a565b809150509250929050565b6000602082840312156130a757600080fd5b5035919050565b6000806000606084860312156130c357600080fd5b83356130ce8161303a565b925060208401356130de8161303a565b929592945050506040919091013590565b60006020828403121561310157600080fd5b8135612c938161303a565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600067ffffffffffffffff808411156131565761315661310c565b604051601f85017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f0116810190828211818310171561319c5761319c61310c565b816040528093508581528686860111156131b557600080fd5b858560208301376000602087830101525050509392505050565b6000602082840312156131e157600080fd5b813567ffffffffffffffff8111156131f857600080fd5b8201601f8101841361320957600080fd5b612f398482356020840161313b565b60006020828403121561322a57600080fd5b813565ffffffffffff81168114612c9357600080fd5b6000806040838503121561325357600080fd5b823561325e8161303a565b9150602083013567ffffffffffffffff81111561327a57600080fd5b8301601f8101851361328b57600080fd5b61329a8582356020840161313b565b9150509250929050565b60008083601f8401126132b657600080fd5b50813567ffffffffffffffff8111156132ce57600080fd5b6020830191508360208260051b85010111156132e957600080fd5b9250929050565b6000806000806000806000806080898b03121561330c57600080fd5b883567ffffffffffffffff8082111561332457600080fd5b6133308c838d016132a4565b909a50985060208b013591508082111561334957600080fd5b6133558c838d016132a4565b909850965060408b013591508082111561336e57600080fd5b61337a8c838d016132a4565b909650945060608b013591508082111561339357600080fd5b506133a08b828c016132a4565b999c989b5096995094979396929594505050565b8015158114610e3a57600080fd5b6000602082840312156133d457600080fd5b8135612c93816133b4565b6000604082840312156133f157600080fd5b50919050565b60006020828403121561340957600080fd5b8151612c93816133b4565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b8181038181111561285557612855613414565b60005b83811015613471578181015183820152602001613459565b50506000910152565b6020815260008251806020840152613499816040850160208701613456565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169190910160400192915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe184360301811261352f57600080fd5b83018035915067ffffffffffffffff82111561354a57600080fd5b6020019150600581901b36038213156132e957600080fd5b60006020828403121561357457600080fd5b5051919050565b600065ffffffffffff808416806135bb577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b92169190910492915050565b65ffffffffffff8181168382160280821691908281146135e9576135e9613414565b505092915050565b65ffffffffffff82811682821603908082111561361057613610613414565b5092915050565b65ffffffffffff81811683821601908082111561361057613610613414565b60008251613648818460208701613456565b919091019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b34d02b1c5423a38ab6e0daaa965103d5485c504a385a0bee80f718a7c3fcce164736f6c63430008110033496e697469616c697a61626c653a20636f6e747261637420697320616c7265617f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498", + "deployedBytecode": "0x6080604052600436106101c25760003560e01c80635cec892a116100f7578063bdac7ca311610095578063d9c9808711610064578063d9c9808714610626578063e57480e514610646578063f2f4eb2614610673578063fd54b228146106a057600080fd5b8063bdac7ca314610589578063c4d66de8146105a9578063c748d261146105c9578063cce80e7a146105f657600080fd5b806371ee95c0116100d157806371ee95c0146105145780637ee843491461053457806389e1e82a14610554578063957888351461057457600080fd5b80635cec892a1461046b578063623b9e9d146104a25780636ac56103146104c257600080fd5b80632a25dd4111610164578063495906571161013e57806349590657146103da5780634f1ef286146103ef57806352d1902d146104025780635bf31d4d1461041757600080fd5b80632a25dd411461037a5780633659cfe61461039a5780634641fdef146103ba57600080fd5b80631171bda9116101a05780631171bda9146102d557806314769142146102f55780632637588e14610322578063288278381461035a57600080fd5b806309454ba3146101c75780630c9cbf0e146101f05780630d10fca3146102b3575b600080fd5b3480156101d357600080fd5b506101dd606c5481565b6040519081526020015b60405180910390f35b3480156101fc57600080fd5b5061027461020b36600461305c565b606d6020908152600092835260408084209091529082529020805460019091015479ffffffffffffffffffffffffffffffffffffffffffffffffffff8216917a010000000000000000000000000000000000000000000000000000900465ffffffffffff169083565b6040805179ffffffffffffffffffffffffffffffffffffffffffffffffffff909416845265ffffffffffff9092166020840152908201526060016101e7565b3480156102bf57600080fd5b506102d36102ce366004613095565b6106bb565b005b3480156102e157600080fd5b506102d36102f03660046130ae565b61080f565b34801561030157600080fd5b506101dd6103103660046130ef565b606f6020526000908152604090205481565b34801561032e57600080fd5b506101dd61033d36600461305c565b607060209081526000928352604080842090915290825290205481565b34801561036657600080fd5b506102d36103753660046130ef565b610964565b34801561038657600080fd5b506102d36103953660046131cf565b610b02565b3480156103a657600080fd5b506102d36103b53660046130ef565b610c33565b3480156103c657600080fd5b506102d36103d5366004613218565b610e3d565b3480156103e657600080fd5b506101dd610f84565b6102d36103fd366004613240565b610fe2565b34801561040e57600080fd5b506101dd6111d8565b34801561042357600080fd5b50606b54610454907a010000000000000000000000000000000000000000000000000000900465ffffffffffff1681565b60405165ffffffffffff90911681526020016101e7565b34801561047757600080fd5b50606b546104549074010000000000000000000000000000000000000000900465ffffffffffff1681565b3480156104ae57600080fd5b506102d36104bd3660046130ef565b6112c4565b3480156104ce57600080fd5b50606b546104ef9073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016101e7565b34801561052057600080fd5b506102d361052f3660046132f0565b61144b565b34801561054057600080fd5b506102d361054f3660046130ef565b611885565b34801561056057600080fd5b506102d361056f3660046133c2565b6119e6565b34801561058057600080fd5b506102d3611bf0565b34801561059557600080fd5b506102d36105a436600461305c565b611d12565b3480156105b557600080fd5b506102d36105c43660046130ef565b611ecd565b3480156105d557600080fd5b506069546104ef9073ffffffffffffffffffffffffffffffffffffffff1681565b34801561060257600080fd5b50606754606854610611919082565b604080519283526020830191909152016101e7565b34801561063257600080fd5b506102d36106413660046133df565b6120e4565b34801561065257600080fd5b506101dd6106613660046130ef565b606e6020526000908152604090205481565b34801561067f57600080fd5b50606a546104ef9073ffffffffffffffffffffffffffffffffffffffff1681565b3480156106ac57600080fd5b50606554606654610611919082565b606a546040517f521d4de900000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff9091169063521d4de990602401602060405180830381865afa158015610729573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061074d91906133f7565b610783576040517f99e120bc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606b5473ffffffffffffffffffffffffffffffffffffffff16156107d3576040517f0583257400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606c8190556040518181527f39bb629f3d59f5eddf978050e1f5fabeca2b5d02dfc9c25e84f32e7da1069db4906020015b60405180910390a150565b606a546040517f521d4de900000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff9091169063521d4de990602401602060405180830381865afa15801561087d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108a191906133f7565b6108d7576040517f99e120bc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6108f873ffffffffffffffffffffffffffffffffffffffff84168383612309565b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167ffff3b3844276f57024e0b42afec1a37f75db36511e43819a4f2a63ab7862b6488360405161095791815260200190565b60405180910390a3505050565b8073ffffffffffffffffffffffffffffffffffffffff8116331480159061099b5750336000908152606e6020526040902054600114155b8015610a365750606a546040517f521d4de900000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff9091169063521d4de990602401602060405180830381865afa158015610a10573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a3491906133f7565b155b15610a6d576040517fc22a648e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff82166000908152606f6020526040902054610a9e816001613443565b73ffffffffffffffffffffffffffffffffffffffff84166000818152606f602090815260409182902093909355518315815290917f81d714ca01079a19c106993b49b2764df6bb6abe740164ef7b77ee9c100a024a910160405180910390a2505050565b606b5473ffffffffffffffffffffffffffffffffffffffff1615610b52576040517f0583257400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606b5474010000000000000000000000000000000000000000900465ffffffffffff164210610bad576040517f1a8f039500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606c54606954610bd99173ffffffffffffffffffffffffffffffffffffffff90911690339030906123e2565b606b80547fffffffffffffffffffffffff000000000000000000000000000000000000000016331790556040517f5eca00b8ed745eee61451333090bfa56aa1f2a9e696a2aebe5f1f5b6cef6f2ff9061080490839061347a565b73ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000163003610cfd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602c60248201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060448201527f64656c656761746563616c6c000000000000000000000000000000000000000060648201526084015b60405180910390fd5b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16610d727f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5473ffffffffffffffffffffffffffffffffffffffff1690565b73ffffffffffffffffffffffffffffffffffffffff1614610e15576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602c60248201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060448201527f6163746976652070726f787900000000000000000000000000000000000000006064820152608401610cf4565b610e1e81612446565b60408051600080825260208201909252610e3a91839190612530565b50565b606a546040517f521d4de900000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff9091169063521d4de990602401602060405180830381865afa158015610eab573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ecf91906133f7565b610f05576040517f99e120bc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606b805479ffffffffffffffffffffffffffffffffffffffffffffffffffff167a01000000000000000000000000000000000000000000000000000065ffffffffffff8416908102919091179091556040519081527ffdf22e84af74bd4ab6b9646f6370a02bc886ed6ac25882db14e4ebf4b8e3bc7e90602001610804565b606b5460009074010000000000000000000000000000000000000000900465ffffffffffff164210801590610fcf5750606b5473ffffffffffffffffffffffffffffffffffffffff16155b15610fdb575060655490565b5060675490565b73ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001630036110a7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602c60248201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060448201527f64656c656761746563616c6c00000000000000000000000000000000000000006064820152608401610cf4565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1661111c7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5473ffffffffffffffffffffffffffffffffffffffff1690565b73ffffffffffffffffffffffffffffffffffffffff16146111bf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602c60248201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060448201527f6163746976652070726f787900000000000000000000000000000000000000006064820152608401610cf4565b6111c882612446565b6111d482826001612530565b5050565b60003073ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000161461129f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c60448201527f6c6564207468726f7567682064656c656761746563616c6c00000000000000006064820152608401610cf4565b507f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc90565b606a546040517f521d4de900000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff9091169063521d4de990602401602060405180830381865afa158015611332573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061135691906133f7565b61138c576040517f99e120bc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606b5473ffffffffffffffffffffffffffffffffffffffff16156113dc576040517f0583257400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606980547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081179091556040517f1db8d6629941dcb63d5e0c927b89c174c714e139a4b9107a49de839d755f5d7490600090a250565b868015806114595750808614155b806114645750808414155b8061146f5750808214155b156114a6576040517f1df89e8b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60005b818110156118795760008a8a838181106114c5576114c56134cb565b90506020020160208101906114da91906130ef565b905060008989848181106114f0576114f06134cb565b905060200201602081019061150591906130ef565b9050600088888581811061151b5761151b6134cb565b905060200201359050606f60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205460011480156115a1575073ffffffffffffffffffffffffffffffffffffffff83166000908152607060209081526040808320338452909152902054155b156115d8576040517f584a793800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040805173ffffffffffffffffffffffffffffffffffffffff8086166020830152841691810191909152606081018290526000906080016040516020818303038152906040528051906020012090506116868189898881811061163d5761163d6134cb565b905060200281019061164f91906134fa565b8080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525061272f92505050565b6116bc576040517f09bde33900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff8085166000908152606d602090815260408083209387168352929052908120546117179079ffffffffffffffffffffffffffffffffffffffffffffffffffff1684613443565b9050604051806060016040528061172d8561285b565b79ffffffffffffffffffffffffffffffffffffffffffffffffffff1681526020014265ffffffffffff168152602001611764610f84565b905273ffffffffffffffffffffffffffffffffffffffff8087166000908152606d602090815260408083209389168084529382529182902084519185015165ffffffffffff167a0100000000000000000000000000000000000000000000000000000279ffffffffffffffffffffffffffffffffffffffffffffffffffff909216919091178155920151600190920191909155611802908683612309565b8373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167ff7a40077ff7a04c7e61f6f26fb13774259ddf1b6bce9ecf26a8276cdd39926838360405161186191815260200190565b60405180910390a385600101955050505050506114a9565b50505050505050505050565b606a546040517f521d4de900000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff9091169063521d4de990602401602060405180830381865afa1580156118f3573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061191791906133f7565b61194d576040517f99e120bc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff81166000908152606e602052604081205461197e906001613443565b73ffffffffffffffffffffffffffffffffffffffff83166000818152606e6020908152604091829020849055905160018414815292935090917f7628ea5f6112a16b36a8239aa208395a8e8f221688cfb3a5461faffb9700abcd910160405180910390a25050565b606a546040517f521d4de900000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff9091169063521d4de990602401602060405180830381865afa158015611a54573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a7891906133f7565b611aae576040517f99e120bc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606b5473ffffffffffffffffffffffffffffffffffffffff16611afd576040517f9375474800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8015611b3e57606b54606c54606954611b319273ffffffffffffffffffffffffffffffffffffffff91821692911690612309565b611b3961290b565b611b96565b606c54606954611b689173ffffffffffffffffffffffffffffffffffffffff909116903390612309565b611b71426129e1565b606b60146101000a81548165ffffffffffff021916908365ffffffffffff1602179055505b606b80547fffffffffffffffffffffffff000000000000000000000000000000000000000016905560405181151581527f8015c5005d9ad5d85ca80d3f894f08e0159277704c54166e5cff108800fa80cd90602001610804565b606a546040517f521d4de900000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff9091169063521d4de990602401602060405180830381865afa158015611c5e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c8291906133f7565b611cb8576040517f99e120bc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606b5473ffffffffffffffffffffffffffffffffffffffff1615611d08576040517f0583257400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b611d1061290b565b565b8173ffffffffffffffffffffffffffffffffffffffff81163314801590611d495750336000908152606e6020526040902054600114155b8015611de45750606a546040517f521d4de900000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff9091169063521d4de990602401602060405180830381865afa158015611dbe573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611de291906133f7565b155b15611e1b576040517fc22a648e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff808416600090815260706020908152604080832093861683529290522054611e59816001613443565b73ffffffffffffffffffffffffffffffffffffffff858116600081815260706020908152604080832094891680845294825291829020949094555184158152919290917f42343f44c66ea1eaffa334760d3da2cb731d2a0b3b3e30423df997faa36cc95c910160405180910390a350505050565b600054610100900460ff1615808015611eed5750600054600160ff909116105b80611f075750303b158015611f07575060005460ff166001145b611f93576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a65640000000000000000000000000000000000006064820152608401610cf4565b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790558015611ff157600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff166101001790555b73ffffffffffffffffffffffffffffffffffffffff821661203e576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606a80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff841617905580156111d457600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15050565b606b5473ffffffffffffffffffffffffffffffffffffffff161515806121e05750336000908152606e602052604090205460011415806121455750606b5474010000000000000000000000000000000000000000900465ffffffffffff1642105b80156121e05750606a546040517f521d4de900000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff9091169063521d4de990602401602060405180830381865afa1580156121ba573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121de91906133f7565b155b15612217576040517fc22a648e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b604080518082019091526065805480835260668054602080860182905286359094559285013590556067556068556000612250426129e1565b606b80547fffffffffffff000000000000ffffffffffffffffffffffffffffffffffffffff167401000000000000000000000000000000000000000065ffffffffffff841690810291909117909155604080518635815260208088013590820152908101919091529091507f23aa2e4f757a7bd974085d3e11439a843b137b30905e3ffd51b2097c34aef62e9060600160405180910390a1505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b60405173ffffffffffffffffffffffffffffffffffffffff83166024820152604481018290526123dd9084907fa9059cbb00000000000000000000000000000000000000000000000000000000906064015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152612a46565b505050565b60405173ffffffffffffffffffffffffffffffffffffffff808516602483015283166044820152606481018290526124409085907f23b872dd000000000000000000000000000000000000000000000000000000009060840161235b565b50505050565b606a5473ffffffffffffffffffffffffffffffffffffffff1680158015906124f957506040517f521d4de900000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff82169063521d4de990602401602060405180830381865afa1580156124d3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124f791906133f7565b155b156111d4576040517f99e120bc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff1615612563576123dd83612b52565b8273ffffffffffffffffffffffffffffffffffffffff166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa9250505080156125e8575060408051601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01682019092526125e591810190613562565b60015b612674576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201527f6f6e206973206e6f7420555550530000000000000000000000000000000000006064820152608401610cf4565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc8114612723576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f7860448201527f6961626c655555494400000000000000000000000000000000000000000000006064820152608401610cf4565b506123dd838383612c5c565b80516000908390825b8181101561280957848181518110612752576127526134cb565b60200260200101518310156127b35782858281518110612774576127746134cb565b6020026020010151604051602001612796929190918252602082015260400190565b604051602081830303815290604052805190602001209250612801565b8481815181106127c5576127c56134cb565b6020026020010151836040516020016127e8929190918252602082015260400190565b6040516020818303038152906040528051906020012092505b600101612738565b506000612814610f84565b90508061284d576040517f094ad65800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b919091149150505b92915050565b600079ffffffffffffffffffffffffffffffffffffffffffffffffffff821115612907576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602760248201527f53616665436173743a2076616c756520646f65736e27742066697420696e203260448201527f30382062697473000000000000000000000000000000000000000000000000006064820152608401610cf4565b5090565b60408051808201825260675480825260685460208301819052606b80547fffffffffffff000000000000ffffffffffffffffffffffffffffffffffffffff16905560659190915560665590517f44825a4b2df8acb19ce4e1afba9aa850c8b65cdb7942e2078f27d0b0960efee690600090a1805160208201517f23aa2e4f757a7bd974085d3e11439a843b137b30905e3ffd51b2097c34aef62e9190610e106129b4814261357b565b6129be91906135c7565b60408051938452602084019290925265ffffffffffff1690820152606001610804565b606b54600090610e10907a010000000000000000000000000000000000000000000000000000900465ffffffffffff1681612a1d6001866135f1565b612a27919061357b565b612a32906001613617565b612a3c9190613617565b61285591906135c7565b6000612aa8826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16612c819092919063ffffffff16565b8051909150156123dd5780806020019051810190612ac691906133f7565b6123dd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610cf4565b73ffffffffffffffffffffffffffffffffffffffff81163b612bf6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e7472616374000000000000000000000000000000000000006064820152608401610cf4565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b612c6583612c9a565b600082511180612c725750805b156123dd576124408383612ce7565b6060612c908484600085612e26565b90505b9392505050565b612ca381612b52565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b606073ffffffffffffffffffffffffffffffffffffffff83163b612d8d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e747261637400000000000000000000000000000000000000000000000000006064820152608401610cf4565b6000808473ffffffffffffffffffffffffffffffffffffffff1684604051612db59190613636565b600060405180830381855af49150503d8060008114612df0576040519150601f19603f3d011682016040523d82523d6000602084013e612df5565b606091505b5091509150612e1d828260405180606001604052806027815260200161365360279139612f41565b95945050505050565b606082471015612eb8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610cf4565b6000808673ffffffffffffffffffffffffffffffffffffffff168587604051612ee19190613636565b60006040518083038185875af1925050503d8060008114612f1e576040519150601f19603f3d011682016040523d82523d6000602084013e612f23565b606091505b5091509150612f3487838387612f5a565b925050505b949350505050565b60608315612f50575081612c93565b612c938383612ff6565b60608315612ff0578251600003612fe95773ffffffffffffffffffffffffffffffffffffffff85163b612fe9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610cf4565b5081612f39565b612f3983835b8151156130065781518083602001fd5b806040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cf4919061347a565b73ffffffffffffffffffffffffffffffffffffffff81168114610e3a57600080fd5b6000806040838503121561306f57600080fd5b823561307a8161303a565b9150602083013561308a8161303a565b809150509250929050565b6000602082840312156130a757600080fd5b5035919050565b6000806000606084860312156130c357600080fd5b83356130ce8161303a565b925060208401356130de8161303a565b929592945050506040919091013590565b60006020828403121561310157600080fd5b8135612c938161303a565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600067ffffffffffffffff808411156131565761315661310c565b604051601f85017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f0116810190828211818310171561319c5761319c61310c565b816040528093508581528686860111156131b557600080fd5b858560208301376000602087830101525050509392505050565b6000602082840312156131e157600080fd5b813567ffffffffffffffff8111156131f857600080fd5b8201601f8101841361320957600080fd5b612f398482356020840161313b565b60006020828403121561322a57600080fd5b813565ffffffffffff81168114612c9357600080fd5b6000806040838503121561325357600080fd5b823561325e8161303a565b9150602083013567ffffffffffffffff81111561327a57600080fd5b8301601f8101851361328b57600080fd5b61329a8582356020840161313b565b9150509250929050565b60008083601f8401126132b657600080fd5b50813567ffffffffffffffff8111156132ce57600080fd5b6020830191508360208260051b85010111156132e957600080fd5b9250929050565b6000806000806000806000806080898b03121561330c57600080fd5b883567ffffffffffffffff8082111561332457600080fd5b6133308c838d016132a4565b909a50985060208b013591508082111561334957600080fd5b6133558c838d016132a4565b909850965060408b013591508082111561336e57600080fd5b61337a8c838d016132a4565b909650945060608b013591508082111561339357600080fd5b506133a08b828c016132a4565b999c989b5096995094979396929594505050565b8015158114610e3a57600080fd5b6000602082840312156133d457600080fd5b8135612c93816133b4565b6000604082840312156133f157600080fd5b50919050565b60006020828403121561340957600080fd5b8151612c93816133b4565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b8181038181111561285557612855613414565b60005b83811015613471578181015183820152602001613459565b50506000910152565b6020815260008251806020840152613499816040850160208701613456565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169190910160400192915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe184360301811261352f57600080fd5b83018035915067ffffffffffffffff82111561354a57600080fd5b6020019150600581901b36038213156132e957600080fd5b60006020828403121561357457600080fd5b5051919050565b600065ffffffffffff808416806135bb577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b92169190910492915050565b65ffffffffffff8181168382160280821691908281146135e9576135e9613414565b505092915050565b65ffffffffffff82811682821603908082111561361057613610613414565b5092915050565b65ffffffffffff81811683821601908082111561361057613610613414565b60008251613648818460208701613456565b919091019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b34d02b1c5423a38ab6e0daaa965103d5485c504a385a0bee80f718a7c3fcce164736f6c63430008110033", + "devdoc": { + "author": "Angle Labs. Inc", + "kind": "dev", + "methods": { + "claim(address[],address[],uint256[],bytes32[][])": { + "details": "Anyone may call this function for anyone else, funds go to destination regardless, it's just a question of who provides the proof and pays the gas: `msg.sender` is used only for addresses that require a trusted operator", + "params": { + "amounts": "Amount of tokens that will be sent to the corresponding users", + "proofs": "Array of hashes bridging from a leaf `(hash of user | token | amount)` to the Merkle root", + "tokens": "ERC20 claimed", + "users": "Recipient of tokens" + } + }, + "disputeTree(string)": { + "details": "Requires a deposit of `disputeToken` that'll be slashed if the dispute is not acceptedIt is only possible to create a dispute within `disputePeriod` after each tree update" + }, + "proxiableUUID()": { + "details": "Implementation of the ERC1822 {proxiableUUID} function. This returns the storage slot used by the implementation. It is used to validate the implementation's compatibility when performing an upgrade. IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this function revert if invoked through a proxy. This is guaranteed by the `notDelegated` modifier." + }, + "resolveDispute(bool)": { + "params": { + "valid": "Whether the dispute was valid" + } + }, + "upgradeTo(address)": { + "details": "Upgrade the implementation of the proxy to `newImplementation`. Calls {_authorizeUpgrade}. Emits an {Upgraded} event." + }, + "upgradeToAndCall(address,bytes)": { + "details": "Upgrade the implementation of the proxy to `newImplementation`, and subsequently execute the function call encoded in `data`. Calls {_authorizeUpgrade}. Emits an {Upgraded} event." + } + }, + "stateVariables": { + "disputer": { + "details": "Used to store if there is an ongoing dispute" + } + }, + "title": "Distributor", + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": { + "canUpdateMerkleRoot(address)": { + "notice": "Trusted EOAs to update the Merkle root" + }, + "claim(address[],address[],uint256[],bytes32[][])": { + "notice": "Claims rewards for a given set of users" + }, + "claimed(address,address)": { + "notice": "Mapping user -> token -> amount to track claimed amounts" + }, + "core()": { + "notice": "`Core` contract handling access control" + }, + "disputeAmount()": { + "notice": "Amount to deposit to freeze the roots update" + }, + "disputePeriod()": { + "notice": "Time after which a change in a tree becomes effective, in EPOCH_DURATION" + }, + "disputeToken()": { + "notice": "Token to deposit to freeze the roots update" + }, + "disputeTree(string)": { + "notice": "Freezes the Merkle tree update until the dispute is resolved" + }, + "disputer()": { + "notice": "Address which created the dispute" + }, + "endOfDisputePeriod()": { + "notice": "When the current tree will become valid" + }, + "getMerkleRoot()": { + "notice": "Returns the MerkleRoot that is currently live for the contract" + }, + "lastTree()": { + "notice": "Tree that was in place in the contract before the last `tree` update" + }, + "onlyOperatorCanClaim(address)": { + "notice": "Whether or not to disable permissionless claiming" + }, + "operators(address,address)": { + "notice": "user -> operator -> authorisation to claim" + }, + "recoverERC20(address,address,uint256)": { + "notice": "Recovers any ERC20 token" + }, + "resolveDispute(bool)": { + "notice": "Resolve the ongoing dispute, if any" + }, + "revokeTree()": { + "notice": "Allows the governor or the guardian of this contract to fallback to the last version of the tree immediately" + }, + "setDisputeAmount(uint256)": { + "notice": "Sets the amount of `disputeToken` used as a caution during disputes" + }, + "setDisputePeriod(uint48)": { + "notice": "Sets the dispute period after which a tree update becomes effective" + }, + "setDisputeToken(address)": { + "notice": "Sets the token used as a caution during disputes" + }, + "toggleOnlyOperatorCanClaim(address)": { + "notice": "Toggles permissioned claiming for a given user" + }, + "toggleOperator(address,address)": { + "notice": "Toggles whitelisting for a given user and a given operator" + }, + "toggleTrusted(address)": { + "notice": "Adds or removes EOAs which are trusted to update the Merkle root" + }, + "tree()": { + "notice": "Tree of claimable tokens through this contract" + }, + "updateTree((bytes32,bytes32))": { + "notice": "Updates Merkle Tree" + } + }, + "notice": "Allows LPs on AMMs with concentrated liquidity to claim the rewards that were distributed to them", + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 395, + "contract": "contracts/Distributor.sol:Distributor", + "label": "_initialized", + "offset": 0, + "slot": "0", + "type": "t_uint8" + }, + { + "astId": 398, + "contract": "contracts/Distributor.sol:Distributor", + "label": "_initializing", + "offset": 1, + "slot": "0", + "type": "t_bool" + }, + { + "astId": 377, + "contract": "contracts/Distributor.sol:Distributor", + "label": "__gap", + "offset": 0, + "slot": "1", + "type": "t_array(t_uint256)50_storage" + }, + { + "astId": 692, + "contract": "contracts/Distributor.sol:Distributor", + "label": "__gap", + "offset": 0, + "slot": "51", + "type": "t_array(t_uint256)50_storage" + }, + { + "astId": 6919, + "contract": "contracts/Distributor.sol:Distributor", + "label": "tree", + "offset": 0, + "slot": "101", + "type": "t_struct(MerkleTree)6897_storage" + }, + { + "astId": 6923, + "contract": "contracts/Distributor.sol:Distributor", + "label": "lastTree", + "offset": 0, + "slot": "103", + "type": "t_struct(MerkleTree)6897_storage" + }, + { + "astId": 6927, + "contract": "contracts/Distributor.sol:Distributor", + "label": "disputeToken", + "offset": 0, + "slot": "105", + "type": "t_contract(IERC20)1266" + }, + { + "astId": 6931, + "contract": "contracts/Distributor.sol:Distributor", + "label": "core", + "offset": 0, + "slot": "106", + "type": "t_contract(ICore)8866" + }, + { + "astId": 6934, + "contract": "contracts/Distributor.sol:Distributor", + "label": "disputer", + "offset": 0, + "slot": "107", + "type": "t_address" + }, + { + "astId": 6937, + "contract": "contracts/Distributor.sol:Distributor", + "label": "endOfDisputePeriod", + "offset": 20, + "slot": "107", + "type": "t_uint48" + }, + { + "astId": 6940, + "contract": "contracts/Distributor.sol:Distributor", + "label": "disputePeriod", + "offset": 26, + "slot": "107", + "type": "t_uint48" + }, + { + "astId": 6943, + "contract": "contracts/Distributor.sol:Distributor", + "label": "disputeAmount", + "offset": 0, + "slot": "108", + "type": "t_uint256" + }, + { + "astId": 6951, + "contract": "contracts/Distributor.sol:Distributor", + "label": "claimed", + "offset": 0, + "slot": "109", + "type": "t_mapping(t_address,t_mapping(t_address,t_struct(Claim)6904_storage))" + }, + { + "astId": 6956, + "contract": "contracts/Distributor.sol:Distributor", + "label": "canUpdateMerkleRoot", + "offset": 0, + "slot": "110", + "type": "t_mapping(t_address,t_uint256)" + }, + { + "astId": 6961, + "contract": "contracts/Distributor.sol:Distributor", + "label": "onlyOperatorCanClaim", + "offset": 0, + "slot": "111", + "type": "t_mapping(t_address,t_uint256)" + }, + { + "astId": 6968, + "contract": "contracts/Distributor.sol:Distributor", + "label": "operators", + "offset": 0, + "slot": "112", + "type": "t_mapping(t_address,t_mapping(t_address,t_uint256))" + }, + { + "astId": 6972, + "contract": "contracts/Distributor.sol:Distributor", + "label": "__gap", + "offset": 0, + "slot": "113", + "type": "t_array(t_uint256)38_storage" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_array(t_uint256)38_storage": { + "base": "t_uint256", + "encoding": "inplace", + "label": "uint256[38]", + "numberOfBytes": "1216" + }, + "t_array(t_uint256)50_storage": { + "base": "t_uint256", + "encoding": "inplace", + "label": "uint256[50]", + "numberOfBytes": "1600" + }, + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_bytes32": { + "encoding": "inplace", + "label": "bytes32", + "numberOfBytes": "32" + }, + "t_contract(ICore)8866": { + "encoding": "inplace", + "label": "contract ICore", + "numberOfBytes": "20" + }, + "t_contract(IERC20)1266": { + "encoding": "inplace", + "label": "contract IERC20", + "numberOfBytes": "20" + }, + "t_mapping(t_address,t_mapping(t_address,t_struct(Claim)6904_storage))": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => mapping(address => struct Claim))", + "numberOfBytes": "32", + "value": "t_mapping(t_address,t_struct(Claim)6904_storage)" + }, + "t_mapping(t_address,t_mapping(t_address,t_uint256))": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => mapping(address => uint256))", + "numberOfBytes": "32", + "value": "t_mapping(t_address,t_uint256)" + }, + "t_mapping(t_address,t_struct(Claim)6904_storage)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => struct Claim)", + "numberOfBytes": "32", + "value": "t_struct(Claim)6904_storage" + }, + "t_mapping(t_address,t_uint256)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => uint256)", + "numberOfBytes": "32", + "value": "t_uint256" + }, + "t_struct(Claim)6904_storage": { + "encoding": "inplace", + "label": "struct Claim", + "members": [ + { + "astId": 6899, + "contract": "contracts/Distributor.sol:Distributor", + "label": "amount", + "offset": 0, + "slot": "0", + "type": "t_uint208" + }, + { + "astId": 6901, + "contract": "contracts/Distributor.sol:Distributor", + "label": "timestamp", + "offset": 26, + "slot": "0", + "type": "t_uint48" + }, + { + "astId": 6903, + "contract": "contracts/Distributor.sol:Distributor", + "label": "merkleRoot", + "offset": 0, + "slot": "1", + "type": "t_bytes32" + } + ], + "numberOfBytes": "64" + }, + "t_struct(MerkleTree)6897_storage": { + "encoding": "inplace", + "label": "struct MerkleTree", + "members": [ + { + "astId": 6894, + "contract": "contracts/Distributor.sol:Distributor", + "label": "merkleRoot", + "offset": 0, + "slot": "0", + "type": "t_bytes32" + }, + { + "astId": 6896, + "contract": "contracts/Distributor.sol:Distributor", + "label": "ipfsHash", + "offset": 0, + "slot": "1", + "type": "t_bytes32" + } + ], + "numberOfBytes": "64" + }, + "t_uint208": { + "encoding": "inplace", + "label": "uint208", + "numberOfBytes": "26" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + }, + "t_uint48": { + "encoding": "inplace", + "label": "uint48", + "numberOfBytes": "6" + }, + "t_uint8": { + "encoding": "inplace", + "label": "uint8", + "numberOfBytes": "1" + } + } + } +} \ No newline at end of file diff --git a/deployments/thundercore/solcInputs/1d17a992f70400315a977c7229541e31.json b/deployments/thundercore/solcInputs/1d17a992f70400315a977c7229541e31.json new file mode 100644 index 0000000..3683843 --- /dev/null +++ b/deployments/thundercore/solcInputs/1d17a992f70400315a977c7229541e31.json @@ -0,0 +1,132 @@ +{ + "language": "Solidity", + "sources": { + "@openzeppelin/contracts-upgradeable/interfaces/draft-IERC1822Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\n * proxy whose upgrades are fully controlled by the current implementation.\n */\ninterface IERC1822ProxiableUpgradeable {\n /**\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\n * address.\n *\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\n * function revert if invoked through a proxy.\n */\n function proxiableUUID() external view returns (bytes32);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/proxy/beacon/IBeaconUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\n */\ninterface IBeaconUpgradeable {\n /**\n * @dev Must return an address that can be used as a delegate call target.\n *\n * {BeaconProxy} will check that this address is a contract.\n */\n function implementation() external view returns (address);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/proxy/ERC1967/ERC1967UpgradeUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (proxy/ERC1967/ERC1967Upgrade.sol)\n\npragma solidity ^0.8.2;\n\nimport \"../beacon/IBeaconUpgradeable.sol\";\nimport \"../../interfaces/draft-IERC1822Upgradeable.sol\";\nimport \"../../utils/AddressUpgradeable.sol\";\nimport \"../../utils/StorageSlotUpgradeable.sol\";\nimport \"../utils/Initializable.sol\";\n\n/**\n * @dev This abstract contract provides getters and event emitting update functions for\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\n *\n * _Available since v4.1._\n *\n * @custom:oz-upgrades-unsafe-allow delegatecall\n */\nabstract contract ERC1967UpgradeUpgradeable is Initializable {\n function __ERC1967Upgrade_init() internal onlyInitializing {\n }\n\n function __ERC1967Upgrade_init_unchained() internal onlyInitializing {\n }\n // This is the keccak-256 hash of \"eip1967.proxy.rollback\" subtracted by 1\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\n\n /**\n * @dev Storage slot with the address of the current implementation.\n * This is the keccak-256 hash of \"eip1967.proxy.implementation\" subtracted by 1, and is\n * validated in the constructor.\n */\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n\n /**\n * @dev Emitted when the implementation is upgraded.\n */\n event Upgraded(address indexed implementation);\n\n /**\n * @dev Returns the current implementation address.\n */\n function _getImplementation() internal view returns (address) {\n return StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value;\n }\n\n /**\n * @dev Stores a new address in the EIP1967 implementation slot.\n */\n function _setImplementation(address newImplementation) private {\n require(AddressUpgradeable.isContract(newImplementation), \"ERC1967: new implementation is not a contract\");\n StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\n }\n\n /**\n * @dev Perform implementation upgrade\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeTo(address newImplementation) internal {\n _setImplementation(newImplementation);\n emit Upgraded(newImplementation);\n }\n\n /**\n * @dev Perform implementation upgrade with additional setup call.\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeToAndCall(\n address newImplementation,\n bytes memory data,\n bool forceCall\n ) internal {\n _upgradeTo(newImplementation);\n if (data.length > 0 || forceCall) {\n _functionDelegateCall(newImplementation, data);\n }\n }\n\n /**\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeToAndCallUUPS(\n address newImplementation,\n bytes memory data,\n bool forceCall\n ) internal {\n // Upgrades from old implementations will perform a rollback test. This test requires the new\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\n // this special case will break upgrade paths from old UUPS implementation to new ones.\n if (StorageSlotUpgradeable.getBooleanSlot(_ROLLBACK_SLOT).value) {\n _setImplementation(newImplementation);\n } else {\n try IERC1822ProxiableUpgradeable(newImplementation).proxiableUUID() returns (bytes32 slot) {\n require(slot == _IMPLEMENTATION_SLOT, \"ERC1967Upgrade: unsupported proxiableUUID\");\n } catch {\n revert(\"ERC1967Upgrade: new implementation is not UUPS\");\n }\n _upgradeToAndCall(newImplementation, data, forceCall);\n }\n }\n\n /**\n * @dev Storage slot with the admin of the contract.\n * This is the keccak-256 hash of \"eip1967.proxy.admin\" subtracted by 1, and is\n * validated in the constructor.\n */\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\n\n /**\n * @dev Emitted when the admin account has changed.\n */\n event AdminChanged(address previousAdmin, address newAdmin);\n\n /**\n * @dev Returns the current admin.\n */\n function _getAdmin() internal view returns (address) {\n return StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value;\n }\n\n /**\n * @dev Stores a new address in the EIP1967 admin slot.\n */\n function _setAdmin(address newAdmin) private {\n require(newAdmin != address(0), \"ERC1967: new admin is the zero address\");\n StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\n }\n\n /**\n * @dev Changes the admin of the proxy.\n *\n * Emits an {AdminChanged} event.\n */\n function _changeAdmin(address newAdmin) internal {\n emit AdminChanged(_getAdmin(), newAdmin);\n _setAdmin(newAdmin);\n }\n\n /**\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\n */\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\n\n /**\n * @dev Emitted when the beacon is upgraded.\n */\n event BeaconUpgraded(address indexed beacon);\n\n /**\n * @dev Returns the current beacon.\n */\n function _getBeacon() internal view returns (address) {\n return StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value;\n }\n\n /**\n * @dev Stores a new beacon in the EIP1967 beacon slot.\n */\n function _setBeacon(address newBeacon) private {\n require(AddressUpgradeable.isContract(newBeacon), \"ERC1967: new beacon is not a contract\");\n require(\n AddressUpgradeable.isContract(IBeaconUpgradeable(newBeacon).implementation()),\n \"ERC1967: beacon implementation is not a contract\"\n );\n StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value = newBeacon;\n }\n\n /**\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\n *\n * Emits a {BeaconUpgraded} event.\n */\n function _upgradeBeaconToAndCall(\n address newBeacon,\n bytes memory data,\n bool forceCall\n ) internal {\n _setBeacon(newBeacon);\n emit BeaconUpgraded(newBeacon);\n if (data.length > 0 || forceCall) {\n _functionDelegateCall(IBeaconUpgradeable(newBeacon).implementation(), data);\n }\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function _functionDelegateCall(address target, bytes memory data) private returns (bytes memory) {\n require(AddressUpgradeable.isContract(target), \"Address: delegate call to non-contract\");\n\n // solhint-disable-next-line avoid-low-level-calls\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return AddressUpgradeable.verifyCallResult(success, returndata, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.1) (proxy/utils/Initializable.sol)\n\npragma solidity ^0.8.2;\n\nimport \"../../utils/AddressUpgradeable.sol\";\n\n/**\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\n *\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\n * reused. This mechanism prevents re-execution of each \"step\" but allows the creation of new initialization steps in\n * case an upgrade adds a module that needs to be initialized.\n *\n * For example:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * contract MyToken is ERC20Upgradeable {\n * function initialize() initializer public {\n * __ERC20_init(\"MyToken\", \"MTK\");\n * }\n * }\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\n * function initializeV2() reinitializer(2) public {\n * __ERC20Permit_init(\"MyToken\");\n * }\n * }\n * ```\n *\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\n *\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\n *\n * [CAUTION]\n * ====\n * Avoid leaving a contract uninitialized.\n *\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * /// @custom:oz-upgrades-unsafe-allow constructor\n * constructor() {\n * _disableInitializers();\n * }\n * ```\n * ====\n */\nabstract contract Initializable {\n /**\n * @dev Indicates that the contract has been initialized.\n * @custom:oz-retyped-from bool\n */\n uint8 private _initialized;\n\n /**\n * @dev Indicates that the contract is in the process of being initialized.\n */\n bool private _initializing;\n\n /**\n * @dev Triggered when the contract has been initialized or reinitialized.\n */\n event Initialized(uint8 version);\n\n /**\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\n * `onlyInitializing` functions can be used to initialize parent contracts.\n *\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\n * constructor.\n *\n * Emits an {Initialized} event.\n */\n modifier initializer() {\n bool isTopLevelCall = !_initializing;\n require(\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\n \"Initializable: contract is already initialized\"\n );\n _initialized = 1;\n if (isTopLevelCall) {\n _initializing = true;\n }\n _;\n if (isTopLevelCall) {\n _initializing = false;\n emit Initialized(1);\n }\n }\n\n /**\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\n * used to initialize parent contracts.\n *\n * A reinitializer may be used after the original initialization step. This is essential to configure modules that\n * are added through upgrades and that require initialization.\n *\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\n * cannot be nested. If one is invoked in the context of another, execution will revert.\n *\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\n * a contract, executing them in the right order is up to the developer or operator.\n *\n * WARNING: setting the version to 255 will prevent any future reinitialization.\n *\n * Emits an {Initialized} event.\n */\n modifier reinitializer(uint8 version) {\n require(!_initializing && _initialized < version, \"Initializable: contract is already initialized\");\n _initialized = version;\n _initializing = true;\n _;\n _initializing = false;\n emit Initialized(version);\n }\n\n /**\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\n */\n modifier onlyInitializing() {\n require(_initializing, \"Initializable: contract is not initializing\");\n _;\n }\n\n /**\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\n * through proxies.\n *\n * Emits an {Initialized} event the first time it is successfully executed.\n */\n function _disableInitializers() internal virtual {\n require(!_initializing, \"Initializable: contract is initializing\");\n if (_initialized < type(uint8).max) {\n _initialized = type(uint8).max;\n emit Initialized(type(uint8).max);\n }\n }\n\n /**\n * @dev Returns the highest version that has been initialized. See {reinitializer}.\n */\n function _getInitializedVersion() internal view returns (uint8) {\n return _initialized;\n }\n\n /**\n * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.\n */\n function _isInitializing() internal view returns (bool) {\n return _initializing;\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (proxy/utils/UUPSUpgradeable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../interfaces/draft-IERC1822Upgradeable.sol\";\nimport \"../ERC1967/ERC1967UpgradeUpgradeable.sol\";\nimport \"./Initializable.sol\";\n\n/**\n * @dev An upgradeability mechanism designed for UUPS proxies. The functions included here can perform an upgrade of an\n * {ERC1967Proxy}, when this contract is set as the implementation behind such a proxy.\n *\n * A security mechanism ensures that an upgrade does not turn off upgradeability accidentally, although this risk is\n * reinstated if the upgrade retains upgradeability but removes the security mechanism, e.g. by replacing\n * `UUPSUpgradeable` with a custom implementation of upgrades.\n *\n * The {_authorizeUpgrade} function must be overridden to include access restriction to the upgrade mechanism.\n *\n * _Available since v4.1._\n */\nabstract contract UUPSUpgradeable is Initializable, IERC1822ProxiableUpgradeable, ERC1967UpgradeUpgradeable {\n function __UUPSUpgradeable_init() internal onlyInitializing {\n }\n\n function __UUPSUpgradeable_init_unchained() internal onlyInitializing {\n }\n /// @custom:oz-upgrades-unsafe-allow state-variable-immutable state-variable-assignment\n address private immutable __self = address(this);\n\n /**\n * @dev Check that the execution is being performed through a delegatecall call and that the execution context is\n * a proxy contract with an implementation (as defined in ERC1967) pointing to self. This should only be the case\n * for UUPS and transparent proxies that are using the current contract as their implementation. Execution of a\n * function through ERC1167 minimal proxies (clones) would not normally pass this test, but is not guaranteed to\n * fail.\n */\n modifier onlyProxy() {\n require(address(this) != __self, \"Function must be called through delegatecall\");\n require(_getImplementation() == __self, \"Function must be called through active proxy\");\n _;\n }\n\n /**\n * @dev Check that the execution is not being performed through a delegate call. This allows a function to be\n * callable on the implementing contract but not through proxies.\n */\n modifier notDelegated() {\n require(address(this) == __self, \"UUPSUpgradeable: must not be called through delegatecall\");\n _;\n }\n\n /**\n * @dev Implementation of the ERC1822 {proxiableUUID} function. This returns the storage slot used by the\n * implementation. It is used to validate the implementation's compatibility when performing an upgrade.\n *\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\n * function revert if invoked through a proxy. This is guaranteed by the `notDelegated` modifier.\n */\n function proxiableUUID() external view virtual override notDelegated returns (bytes32) {\n return _IMPLEMENTATION_SLOT;\n }\n\n /**\n * @dev Upgrade the implementation of the proxy to `newImplementation`.\n *\n * Calls {_authorizeUpgrade}.\n *\n * Emits an {Upgraded} event.\n */\n function upgradeTo(address newImplementation) external virtual onlyProxy {\n _authorizeUpgrade(newImplementation);\n _upgradeToAndCallUUPS(newImplementation, new bytes(0), false);\n }\n\n /**\n * @dev Upgrade the implementation of the proxy to `newImplementation`, and subsequently execute the function call\n * encoded in `data`.\n *\n * Calls {_authorizeUpgrade}.\n *\n * Emits an {Upgraded} event.\n */\n function upgradeToAndCall(address newImplementation, bytes memory data) external payable virtual onlyProxy {\n _authorizeUpgrade(newImplementation);\n _upgradeToAndCallUUPS(newImplementation, data, true);\n }\n\n /**\n * @dev Function that should revert when `msg.sender` is not authorized to upgrade the contract. Called by\n * {upgradeTo} and {upgradeToAndCall}.\n *\n * Normally, this function will use an xref:access.adoc[access control] modifier such as {Ownable-onlyOwner}.\n *\n * ```solidity\n * function _authorizeUpgrade(address) internal override onlyOwner {}\n * ```\n */\n function _authorizeUpgrade(address newImplementation) internal virtual;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (security/ReentrancyGuard.sol)\n\npragma solidity ^0.8.0;\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Contract module that helps prevent reentrant calls to a function.\n *\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\n * available, which can be applied to functions to make sure there are no nested\n * (reentrant) calls to them.\n *\n * Note that because there is a single `nonReentrant` guard, functions marked as\n * `nonReentrant` may not call one another. This can be worked around by making\n * those functions `private`, and then adding `external` `nonReentrant` entry\n * points to them.\n *\n * TIP: If you would like to learn more about reentrancy and alternative ways\n * to protect against it, check out our blog post\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\n */\nabstract contract ReentrancyGuardUpgradeable is Initializable {\n // Booleans are more expensive than uint256 or any type that takes up a full\n // word because each write operation emits an extra SLOAD to first read the\n // slot's contents, replace the bits taken up by the boolean, and then write\n // back. This is the compiler's defense against contract upgrades and\n // pointer aliasing, and it cannot be disabled.\n\n // The values being non-zero value makes deployment a bit more expensive,\n // but in exchange the refund on every call to nonReentrant will be lower in\n // amount. Since refunds are capped to a percentage of the total\n // transaction's gas, it is best to keep them low in cases like this one, to\n // increase the likelihood of the full refund coming into effect.\n uint256 private constant _NOT_ENTERED = 1;\n uint256 private constant _ENTERED = 2;\n\n uint256 private _status;\n\n function __ReentrancyGuard_init() internal onlyInitializing {\n __ReentrancyGuard_init_unchained();\n }\n\n function __ReentrancyGuard_init_unchained() internal onlyInitializing {\n _status = _NOT_ENTERED;\n }\n\n /**\n * @dev Prevents a contract from calling itself, directly or indirectly.\n * Calling a `nonReentrant` function from another `nonReentrant`\n * function is not supported. It is possible to prevent this from happening\n * by making the `nonReentrant` function external, and making it call a\n * `private` function that does the actual work.\n */\n modifier nonReentrant() {\n _nonReentrantBefore();\n _;\n _nonReentrantAfter();\n }\n\n function _nonReentrantBefore() private {\n // On the first call to nonReentrant, _status will be _NOT_ENTERED\n require(_status != _ENTERED, \"ReentrancyGuard: reentrant call\");\n\n // Any calls to nonReentrant after this point will fail\n _status = _ENTERED;\n }\n\n function _nonReentrantAfter() private {\n // By storing the original value once again, a refund is triggered (see\n // https://eips.ethereum.org/EIPS/eip-2200)\n _status = _NOT_ENTERED;\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[49] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20Upgradeable {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary AddressUpgradeable {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/StorageSlotUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/StorageSlot.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Library for reading and writing primitive types to specific storage slots.\n *\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\n * This library helps with reading and writing to such slots without the need for inline assembly.\n *\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\n *\n * Example usage to set ERC1967 implementation slot:\n * ```\n * contract ERC1967 {\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n *\n * function _getImplementation() internal view returns (address) {\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\n * }\n *\n * function _setImplementation(address newImplementation) internal {\n * require(Address.isContract(newImplementation), \"ERC1967: new implementation is not a contract\");\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\n * }\n * }\n * ```\n *\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\n */\nlibrary StorageSlotUpgradeable {\n struct AddressSlot {\n address value;\n }\n\n struct BooleanSlot {\n bool value;\n }\n\n struct Bytes32Slot {\n bytes32 value;\n }\n\n struct Uint256Slot {\n uint256 value;\n }\n\n /**\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\n */\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\n */\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\n */\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\n */\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n */\ninterface IERC20Permit {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also apply here.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `deadline` must be a timestamp in the future.\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\n * over the EIP712-formatted function arguments.\n * - the signature must use ``owner``'s current nonce (see {nonces}).\n *\n * For more information on the signature format, see the\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\n * section].\n */\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n\n /**\n * @dev Returns the current nonce for `owner`. This value must be\n * included whenever a signature is generated for {permit}.\n *\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\n * prevents a signature from being used multiple times.\n */\n function nonces(address owner) external view returns (uint256);\n\n /**\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\n */\n // solhint-disable-next-line func-name-mixedcase\n function DOMAIN_SEPARATOR() external view returns (bytes32);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20Metadata is IERC20 {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/IERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\nimport \"../extensions/draft-IERC20Permit.sol\";\nimport \"../../../utils/Address.sol\";\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n using Address for address;\n\n function safeTransfer(\n IERC20 token,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n function safeTransferFrom(\n IERC20 token,\n address from,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\n }\n\n /**\n * @dev Deprecated. This function has issues similar to the ones found in\n * {IERC20-approve}, and its usage is discouraged.\n *\n * Whenever possible, use {safeIncreaseAllowance} and\n * {safeDecreaseAllowance} instead.\n */\n function safeApprove(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n // safeApprove should only be called when setting an initial allowance,\n // or when resetting it to zero. To increase and decrease it, use\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\n require(\n (value == 0) || (token.allowance(address(this), spender) == 0),\n \"SafeERC20: approve from non-zero to non-zero allowance\"\n );\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\n }\n\n function safeIncreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n uint256 newAllowance = token.allowance(address(this), spender) + value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n\n function safeDecreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n unchecked {\n uint256 oldAllowance = token.allowance(address(this), spender);\n require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\n uint256 newAllowance = oldAllowance - value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n }\n\n function safePermit(\n IERC20Permit token,\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal {\n uint256 nonceBefore = token.nonces(owner);\n token.permit(owner, spender, value, deadline, v, r, s);\n uint256 nonceAfter = token.nonces(owner);\n require(nonceAfter == nonceBefore + 1, \"SafeERC20: permit did not succeed\");\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data, \"SafeERC20: low-level call failed\");\n if (returndata.length > 0) {\n // Return data is optional\n require(abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Address.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/cryptography/ECDSA.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/ECDSA.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../Strings.sol\";\n\n/**\n * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.\n *\n * These functions can be used to verify that a message was signed by the holder\n * of the private keys of a given address.\n */\nlibrary ECDSA {\n enum RecoverError {\n NoError,\n InvalidSignature,\n InvalidSignatureLength,\n InvalidSignatureS,\n InvalidSignatureV // Deprecated in v4.8\n }\n\n function _throwError(RecoverError error) private pure {\n if (error == RecoverError.NoError) {\n return; // no error: do nothing\n } else if (error == RecoverError.InvalidSignature) {\n revert(\"ECDSA: invalid signature\");\n } else if (error == RecoverError.InvalidSignatureLength) {\n revert(\"ECDSA: invalid signature length\");\n } else if (error == RecoverError.InvalidSignatureS) {\n revert(\"ECDSA: invalid signature 's' value\");\n }\n }\n\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with\n * `signature` or error string. This address can then be used for verification purposes.\n *\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {toEthSignedMessageHash} on it.\n *\n * Documentation for signature generation:\n * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]\n * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]\n *\n * _Available since v4.3._\n */\n function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {\n if (signature.length == 65) {\n bytes32 r;\n bytes32 s;\n uint8 v;\n // ecrecover takes the signature parameters, and the only way to get them\n // currently is to use assembly.\n /// @solidity memory-safe-assembly\n assembly {\n r := mload(add(signature, 0x20))\n s := mload(add(signature, 0x40))\n v := byte(0, mload(add(signature, 0x60)))\n }\n return tryRecover(hash, v, r, s);\n } else {\n return (address(0), RecoverError.InvalidSignatureLength);\n }\n }\n\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with\n * `signature`. This address can then be used for verification purposes.\n *\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {toEthSignedMessageHash} on it.\n */\n function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, signature);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.\n *\n * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]\n *\n * _Available since v4.3._\n */\n function tryRecover(\n bytes32 hash,\n bytes32 r,\n bytes32 vs\n ) internal pure returns (address, RecoverError) {\n bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);\n uint8 v = uint8((uint256(vs) >> 255) + 27);\n return tryRecover(hash, v, r, s);\n }\n\n /**\n * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.\n *\n * _Available since v4.2._\n */\n function recover(\n bytes32 hash,\n bytes32 r,\n bytes32 vs\n ) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, r, vs);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Overload of {ECDSA-tryRecover} that receives the `v`,\n * `r` and `s` signature fields separately.\n *\n * _Available since v4.3._\n */\n function tryRecover(\n bytes32 hash,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal pure returns (address, RecoverError) {\n // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature\n // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines\n // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most\n // signatures from current libraries generate a unique signature with an s-value in the lower half order.\n //\n // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value\n // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or\n // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept\n // these malleable signatures as well.\n if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {\n return (address(0), RecoverError.InvalidSignatureS);\n }\n\n // If the signature is valid (and not malleable), return the signer address\n address signer = ecrecover(hash, v, r, s);\n if (signer == address(0)) {\n return (address(0), RecoverError.InvalidSignature);\n }\n\n return (signer, RecoverError.NoError);\n }\n\n /**\n * @dev Overload of {ECDSA-recover} that receives the `v`,\n * `r` and `s` signature fields separately.\n */\n function recover(\n bytes32 hash,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, v, r, s);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Returns an Ethereum Signed Message, created from a `hash`. This\n * produces hash corresponding to the one signed with the\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n * JSON-RPC method as part of EIP-191.\n *\n * See {recover}.\n */\n function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {\n // 32 is the length in bytes of hash,\n // enforced by the type signature above\n return keccak256(abi.encodePacked(\"\\x19Ethereum Signed Message:\\n32\", hash));\n }\n\n /**\n * @dev Returns an Ethereum Signed Message, created from `s`. This\n * produces hash corresponding to the one signed with the\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n * JSON-RPC method as part of EIP-191.\n *\n * See {recover}.\n */\n function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(\"\\x19Ethereum Signed Message:\\n\", Strings.toString(s.length), s));\n }\n\n /**\n * @dev Returns an Ethereum Signed Typed Data, created from a\n * `domainSeparator` and a `structHash`. This produces hash corresponding\n * to the one signed with the\n * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]\n * JSON-RPC method as part of EIP-712.\n *\n * See {recover}.\n */\n function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(\"\\x19\\x01\", domainSeparator, structHash));\n }\n}\n" + }, + "@openzeppelin/contracts/utils/math/Math.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary Math {\n enum Rounding {\n Down, // Toward negative infinity\n Up, // Toward infinity\n Zero // Toward zero\n }\n\n /**\n * @dev Returns the largest of two numbers.\n */\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two numbers.\n */\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two numbers. The result is rounded towards\n * zero.\n */\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b) / 2 can overflow.\n return (a & b) + (a ^ b) / 2;\n }\n\n /**\n * @dev Returns the ceiling of the division of two numbers.\n *\n * This differs from standard division with `/` in that it rounds up instead\n * of rounding down.\n */\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b - 1) / b can overflow on addition, so we distribute.\n return a == 0 ? 0 : (a - 1) / b + 1;\n }\n\n /**\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\n * with further edits by Uniswap Labs also under MIT license.\n */\n function mulDiv(\n uint256 x,\n uint256 y,\n uint256 denominator\n ) internal pure returns (uint256 result) {\n unchecked {\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\n // variables such that product = prod1 * 2^256 + prod0.\n uint256 prod0; // Least significant 256 bits of the product\n uint256 prod1; // Most significant 256 bits of the product\n assembly {\n let mm := mulmod(x, y, not(0))\n prod0 := mul(x, y)\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n }\n\n // Handle non-overflow cases, 256 by 256 division.\n if (prod1 == 0) {\n return prod0 / denominator;\n }\n\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\n require(denominator > prod1);\n\n ///////////////////////////////////////////////\n // 512 by 256 division.\n ///////////////////////////////////////////////\n\n // Make division exact by subtracting the remainder from [prod1 prod0].\n uint256 remainder;\n assembly {\n // Compute remainder using mulmod.\n remainder := mulmod(x, y, denominator)\n\n // Subtract 256 bit number from 512 bit number.\n prod1 := sub(prod1, gt(remainder, prod0))\n prod0 := sub(prod0, remainder)\n }\n\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\n // See https://cs.stackexchange.com/q/138556/92363.\n\n // Does not overflow because the denominator cannot be zero at this stage in the function.\n uint256 twos = denominator & (~denominator + 1);\n assembly {\n // Divide denominator by twos.\n denominator := div(denominator, twos)\n\n // Divide [prod1 prod0] by twos.\n prod0 := div(prod0, twos)\n\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\n twos := add(div(sub(0, twos), twos), 1)\n }\n\n // Shift in bits from prod1 into prod0.\n prod0 |= prod1 * twos;\n\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\n // four bits. That is, denominator * inv = 1 mod 2^4.\n uint256 inverse = (3 * denominator) ^ 2;\n\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\n // in modular arithmetic, doubling the correct bits in each step.\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\n\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\n // is no longer required.\n result = prod0 * inverse;\n return result;\n }\n }\n\n /**\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\n */\n function mulDiv(\n uint256 x,\n uint256 y,\n uint256 denominator,\n Rounding rounding\n ) internal pure returns (uint256) {\n uint256 result = mulDiv(x, y, denominator);\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\n result += 1;\n }\n return result;\n }\n\n /**\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\n *\n * Inspired by Henry S. Warren, Jr.'s \"Hacker's Delight\" (Chapter 11).\n */\n function sqrt(uint256 a) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\n //\n // We know that the \"msb\" (most significant bit) of our target number `a` is a power of 2 such that we have\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\n //\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\n // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\n // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\n //\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\n uint256 result = 1 << (log2(a) >> 1);\n\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\n // into the expected uint128 result.\n unchecked {\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n return min(result, a / result);\n }\n }\n\n /**\n * @notice Calculates sqrt(a), following the selected rounding direction.\n */\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = sqrt(a);\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 2, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 128;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 64;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 32;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 16;\n }\n if (value >> 8 > 0) {\n value >>= 8;\n result += 8;\n }\n if (value >> 4 > 0) {\n value >>= 4;\n result += 4;\n }\n if (value >> 2 > 0) {\n value >>= 2;\n result += 2;\n }\n if (value >> 1 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log2(value);\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 10, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >= 10**64) {\n value /= 10**64;\n result += 64;\n }\n if (value >= 10**32) {\n value /= 10**32;\n result += 32;\n }\n if (value >= 10**16) {\n value /= 10**16;\n result += 16;\n }\n if (value >= 10**8) {\n value /= 10**8;\n result += 8;\n }\n if (value >= 10**4) {\n value /= 10**4;\n result += 4;\n }\n if (value >= 10**2) {\n value /= 10**2;\n result += 2;\n }\n if (value >= 10**1) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log10(value);\n return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 256, rounded down, of a positive value.\n * Returns 0 if given 0.\n *\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\n */\n function log256(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 16;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 8;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 4;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 2;\n }\n if (value >> 8 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log256(value);\n return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/math/SafeCast.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SafeCast.sol)\n// This file was procedurally generated from scripts/generate/templates/SafeCast.js.\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Wrappers over Solidity's uintXX/intXX casting operators with added overflow\n * checks.\n *\n * Downcasting from uint256/int256 in Solidity does not revert on overflow. This can\n * easily result in undesired exploitation or bugs, since developers usually\n * assume that overflows raise errors. `SafeCast` restores this intuition by\n * reverting the transaction when such an operation overflows.\n *\n * Using this library instead of the unchecked operations eliminates an entire\n * class of bugs, so it's recommended to use it always.\n *\n * Can be combined with {SafeMath} and {SignedSafeMath} to extend it to smaller types, by performing\n * all math on `uint256` and `int256` and then downcasting.\n */\nlibrary SafeCast {\n /**\n * @dev Returns the downcasted uint248 from uint256, reverting on\n * overflow (when the input is greater than largest uint248).\n *\n * Counterpart to Solidity's `uint248` operator.\n *\n * Requirements:\n *\n * - input must fit into 248 bits\n *\n * _Available since v4.7._\n */\n function toUint248(uint256 value) internal pure returns (uint248) {\n require(value <= type(uint248).max, \"SafeCast: value doesn't fit in 248 bits\");\n return uint248(value);\n }\n\n /**\n * @dev Returns the downcasted uint240 from uint256, reverting on\n * overflow (when the input is greater than largest uint240).\n *\n * Counterpart to Solidity's `uint240` operator.\n *\n * Requirements:\n *\n * - input must fit into 240 bits\n *\n * _Available since v4.7._\n */\n function toUint240(uint256 value) internal pure returns (uint240) {\n require(value <= type(uint240).max, \"SafeCast: value doesn't fit in 240 bits\");\n return uint240(value);\n }\n\n /**\n * @dev Returns the downcasted uint232 from uint256, reverting on\n * overflow (when the input is greater than largest uint232).\n *\n * Counterpart to Solidity's `uint232` operator.\n *\n * Requirements:\n *\n * - input must fit into 232 bits\n *\n * _Available since v4.7._\n */\n function toUint232(uint256 value) internal pure returns (uint232) {\n require(value <= type(uint232).max, \"SafeCast: value doesn't fit in 232 bits\");\n return uint232(value);\n }\n\n /**\n * @dev Returns the downcasted uint224 from uint256, reverting on\n * overflow (when the input is greater than largest uint224).\n *\n * Counterpart to Solidity's `uint224` operator.\n *\n * Requirements:\n *\n * - input must fit into 224 bits\n *\n * _Available since v4.2._\n */\n function toUint224(uint256 value) internal pure returns (uint224) {\n require(value <= type(uint224).max, \"SafeCast: value doesn't fit in 224 bits\");\n return uint224(value);\n }\n\n /**\n * @dev Returns the downcasted uint216 from uint256, reverting on\n * overflow (when the input is greater than largest uint216).\n *\n * Counterpart to Solidity's `uint216` operator.\n *\n * Requirements:\n *\n * - input must fit into 216 bits\n *\n * _Available since v4.7._\n */\n function toUint216(uint256 value) internal pure returns (uint216) {\n require(value <= type(uint216).max, \"SafeCast: value doesn't fit in 216 bits\");\n return uint216(value);\n }\n\n /**\n * @dev Returns the downcasted uint208 from uint256, reverting on\n * overflow (when the input is greater than largest uint208).\n *\n * Counterpart to Solidity's `uint208` operator.\n *\n * Requirements:\n *\n * - input must fit into 208 bits\n *\n * _Available since v4.7._\n */\n function toUint208(uint256 value) internal pure returns (uint208) {\n require(value <= type(uint208).max, \"SafeCast: value doesn't fit in 208 bits\");\n return uint208(value);\n }\n\n /**\n * @dev Returns the downcasted uint200 from uint256, reverting on\n * overflow (when the input is greater than largest uint200).\n *\n * Counterpart to Solidity's `uint200` operator.\n *\n * Requirements:\n *\n * - input must fit into 200 bits\n *\n * _Available since v4.7._\n */\n function toUint200(uint256 value) internal pure returns (uint200) {\n require(value <= type(uint200).max, \"SafeCast: value doesn't fit in 200 bits\");\n return uint200(value);\n }\n\n /**\n * @dev Returns the downcasted uint192 from uint256, reverting on\n * overflow (when the input is greater than largest uint192).\n *\n * Counterpart to Solidity's `uint192` operator.\n *\n * Requirements:\n *\n * - input must fit into 192 bits\n *\n * _Available since v4.7._\n */\n function toUint192(uint256 value) internal pure returns (uint192) {\n require(value <= type(uint192).max, \"SafeCast: value doesn't fit in 192 bits\");\n return uint192(value);\n }\n\n /**\n * @dev Returns the downcasted uint184 from uint256, reverting on\n * overflow (when the input is greater than largest uint184).\n *\n * Counterpart to Solidity's `uint184` operator.\n *\n * Requirements:\n *\n * - input must fit into 184 bits\n *\n * _Available since v4.7._\n */\n function toUint184(uint256 value) internal pure returns (uint184) {\n require(value <= type(uint184).max, \"SafeCast: value doesn't fit in 184 bits\");\n return uint184(value);\n }\n\n /**\n * @dev Returns the downcasted uint176 from uint256, reverting on\n * overflow (when the input is greater than largest uint176).\n *\n * Counterpart to Solidity's `uint176` operator.\n *\n * Requirements:\n *\n * - input must fit into 176 bits\n *\n * _Available since v4.7._\n */\n function toUint176(uint256 value) internal pure returns (uint176) {\n require(value <= type(uint176).max, \"SafeCast: value doesn't fit in 176 bits\");\n return uint176(value);\n }\n\n /**\n * @dev Returns the downcasted uint168 from uint256, reverting on\n * overflow (when the input is greater than largest uint168).\n *\n * Counterpart to Solidity's `uint168` operator.\n *\n * Requirements:\n *\n * - input must fit into 168 bits\n *\n * _Available since v4.7._\n */\n function toUint168(uint256 value) internal pure returns (uint168) {\n require(value <= type(uint168).max, \"SafeCast: value doesn't fit in 168 bits\");\n return uint168(value);\n }\n\n /**\n * @dev Returns the downcasted uint160 from uint256, reverting on\n * overflow (when the input is greater than largest uint160).\n *\n * Counterpart to Solidity's `uint160` operator.\n *\n * Requirements:\n *\n * - input must fit into 160 bits\n *\n * _Available since v4.7._\n */\n function toUint160(uint256 value) internal pure returns (uint160) {\n require(value <= type(uint160).max, \"SafeCast: value doesn't fit in 160 bits\");\n return uint160(value);\n }\n\n /**\n * @dev Returns the downcasted uint152 from uint256, reverting on\n * overflow (when the input is greater than largest uint152).\n *\n * Counterpart to Solidity's `uint152` operator.\n *\n * Requirements:\n *\n * - input must fit into 152 bits\n *\n * _Available since v4.7._\n */\n function toUint152(uint256 value) internal pure returns (uint152) {\n require(value <= type(uint152).max, \"SafeCast: value doesn't fit in 152 bits\");\n return uint152(value);\n }\n\n /**\n * @dev Returns the downcasted uint144 from uint256, reverting on\n * overflow (when the input is greater than largest uint144).\n *\n * Counterpart to Solidity's `uint144` operator.\n *\n * Requirements:\n *\n * - input must fit into 144 bits\n *\n * _Available since v4.7._\n */\n function toUint144(uint256 value) internal pure returns (uint144) {\n require(value <= type(uint144).max, \"SafeCast: value doesn't fit in 144 bits\");\n return uint144(value);\n }\n\n /**\n * @dev Returns the downcasted uint136 from uint256, reverting on\n * overflow (when the input is greater than largest uint136).\n *\n * Counterpart to Solidity's `uint136` operator.\n *\n * Requirements:\n *\n * - input must fit into 136 bits\n *\n * _Available since v4.7._\n */\n function toUint136(uint256 value) internal pure returns (uint136) {\n require(value <= type(uint136).max, \"SafeCast: value doesn't fit in 136 bits\");\n return uint136(value);\n }\n\n /**\n * @dev Returns the downcasted uint128 from uint256, reverting on\n * overflow (when the input is greater than largest uint128).\n *\n * Counterpart to Solidity's `uint128` operator.\n *\n * Requirements:\n *\n * - input must fit into 128 bits\n *\n * _Available since v2.5._\n */\n function toUint128(uint256 value) internal pure returns (uint128) {\n require(value <= type(uint128).max, \"SafeCast: value doesn't fit in 128 bits\");\n return uint128(value);\n }\n\n /**\n * @dev Returns the downcasted uint120 from uint256, reverting on\n * overflow (when the input is greater than largest uint120).\n *\n * Counterpart to Solidity's `uint120` operator.\n *\n * Requirements:\n *\n * - input must fit into 120 bits\n *\n * _Available since v4.7._\n */\n function toUint120(uint256 value) internal pure returns (uint120) {\n require(value <= type(uint120).max, \"SafeCast: value doesn't fit in 120 bits\");\n return uint120(value);\n }\n\n /**\n * @dev Returns the downcasted uint112 from uint256, reverting on\n * overflow (when the input is greater than largest uint112).\n *\n * Counterpart to Solidity's `uint112` operator.\n *\n * Requirements:\n *\n * - input must fit into 112 bits\n *\n * _Available since v4.7._\n */\n function toUint112(uint256 value) internal pure returns (uint112) {\n require(value <= type(uint112).max, \"SafeCast: value doesn't fit in 112 bits\");\n return uint112(value);\n }\n\n /**\n * @dev Returns the downcasted uint104 from uint256, reverting on\n * overflow (when the input is greater than largest uint104).\n *\n * Counterpart to Solidity's `uint104` operator.\n *\n * Requirements:\n *\n * - input must fit into 104 bits\n *\n * _Available since v4.7._\n */\n function toUint104(uint256 value) internal pure returns (uint104) {\n require(value <= type(uint104).max, \"SafeCast: value doesn't fit in 104 bits\");\n return uint104(value);\n }\n\n /**\n * @dev Returns the downcasted uint96 from uint256, reverting on\n * overflow (when the input is greater than largest uint96).\n *\n * Counterpart to Solidity's `uint96` operator.\n *\n * Requirements:\n *\n * - input must fit into 96 bits\n *\n * _Available since v4.2._\n */\n function toUint96(uint256 value) internal pure returns (uint96) {\n require(value <= type(uint96).max, \"SafeCast: value doesn't fit in 96 bits\");\n return uint96(value);\n }\n\n /**\n * @dev Returns the downcasted uint88 from uint256, reverting on\n * overflow (when the input is greater than largest uint88).\n *\n * Counterpart to Solidity's `uint88` operator.\n *\n * Requirements:\n *\n * - input must fit into 88 bits\n *\n * _Available since v4.7._\n */\n function toUint88(uint256 value) internal pure returns (uint88) {\n require(value <= type(uint88).max, \"SafeCast: value doesn't fit in 88 bits\");\n return uint88(value);\n }\n\n /**\n * @dev Returns the downcasted uint80 from uint256, reverting on\n * overflow (when the input is greater than largest uint80).\n *\n * Counterpart to Solidity's `uint80` operator.\n *\n * Requirements:\n *\n * - input must fit into 80 bits\n *\n * _Available since v4.7._\n */\n function toUint80(uint256 value) internal pure returns (uint80) {\n require(value <= type(uint80).max, \"SafeCast: value doesn't fit in 80 bits\");\n return uint80(value);\n }\n\n /**\n * @dev Returns the downcasted uint72 from uint256, reverting on\n * overflow (when the input is greater than largest uint72).\n *\n * Counterpart to Solidity's `uint72` operator.\n *\n * Requirements:\n *\n * - input must fit into 72 bits\n *\n * _Available since v4.7._\n */\n function toUint72(uint256 value) internal pure returns (uint72) {\n require(value <= type(uint72).max, \"SafeCast: value doesn't fit in 72 bits\");\n return uint72(value);\n }\n\n /**\n * @dev Returns the downcasted uint64 from uint256, reverting on\n * overflow (when the input is greater than largest uint64).\n *\n * Counterpart to Solidity's `uint64` operator.\n *\n * Requirements:\n *\n * - input must fit into 64 bits\n *\n * _Available since v2.5._\n */\n function toUint64(uint256 value) internal pure returns (uint64) {\n require(value <= type(uint64).max, \"SafeCast: value doesn't fit in 64 bits\");\n return uint64(value);\n }\n\n /**\n * @dev Returns the downcasted uint56 from uint256, reverting on\n * overflow (when the input is greater than largest uint56).\n *\n * Counterpart to Solidity's `uint56` operator.\n *\n * Requirements:\n *\n * - input must fit into 56 bits\n *\n * _Available since v4.7._\n */\n function toUint56(uint256 value) internal pure returns (uint56) {\n require(value <= type(uint56).max, \"SafeCast: value doesn't fit in 56 bits\");\n return uint56(value);\n }\n\n /**\n * @dev Returns the downcasted uint48 from uint256, reverting on\n * overflow (when the input is greater than largest uint48).\n *\n * Counterpart to Solidity's `uint48` operator.\n *\n * Requirements:\n *\n * - input must fit into 48 bits\n *\n * _Available since v4.7._\n */\n function toUint48(uint256 value) internal pure returns (uint48) {\n require(value <= type(uint48).max, \"SafeCast: value doesn't fit in 48 bits\");\n return uint48(value);\n }\n\n /**\n * @dev Returns the downcasted uint40 from uint256, reverting on\n * overflow (when the input is greater than largest uint40).\n *\n * Counterpart to Solidity's `uint40` operator.\n *\n * Requirements:\n *\n * - input must fit into 40 bits\n *\n * _Available since v4.7._\n */\n function toUint40(uint256 value) internal pure returns (uint40) {\n require(value <= type(uint40).max, \"SafeCast: value doesn't fit in 40 bits\");\n return uint40(value);\n }\n\n /**\n * @dev Returns the downcasted uint32 from uint256, reverting on\n * overflow (when the input is greater than largest uint32).\n *\n * Counterpart to Solidity's `uint32` operator.\n *\n * Requirements:\n *\n * - input must fit into 32 bits\n *\n * _Available since v2.5._\n */\n function toUint32(uint256 value) internal pure returns (uint32) {\n require(value <= type(uint32).max, \"SafeCast: value doesn't fit in 32 bits\");\n return uint32(value);\n }\n\n /**\n * @dev Returns the downcasted uint24 from uint256, reverting on\n * overflow (when the input is greater than largest uint24).\n *\n * Counterpart to Solidity's `uint24` operator.\n *\n * Requirements:\n *\n * - input must fit into 24 bits\n *\n * _Available since v4.7._\n */\n function toUint24(uint256 value) internal pure returns (uint24) {\n require(value <= type(uint24).max, \"SafeCast: value doesn't fit in 24 bits\");\n return uint24(value);\n }\n\n /**\n * @dev Returns the downcasted uint16 from uint256, reverting on\n * overflow (when the input is greater than largest uint16).\n *\n * Counterpart to Solidity's `uint16` operator.\n *\n * Requirements:\n *\n * - input must fit into 16 bits\n *\n * _Available since v2.5._\n */\n function toUint16(uint256 value) internal pure returns (uint16) {\n require(value <= type(uint16).max, \"SafeCast: value doesn't fit in 16 bits\");\n return uint16(value);\n }\n\n /**\n * @dev Returns the downcasted uint8 from uint256, reverting on\n * overflow (when the input is greater than largest uint8).\n *\n * Counterpart to Solidity's `uint8` operator.\n *\n * Requirements:\n *\n * - input must fit into 8 bits\n *\n * _Available since v2.5._\n */\n function toUint8(uint256 value) internal pure returns (uint8) {\n require(value <= type(uint8).max, \"SafeCast: value doesn't fit in 8 bits\");\n return uint8(value);\n }\n\n /**\n * @dev Converts a signed int256 into an unsigned uint256.\n *\n * Requirements:\n *\n * - input must be greater than or equal to 0.\n *\n * _Available since v3.0._\n */\n function toUint256(int256 value) internal pure returns (uint256) {\n require(value >= 0, \"SafeCast: value must be positive\");\n return uint256(value);\n }\n\n /**\n * @dev Returns the downcasted int248 from int256, reverting on\n * overflow (when the input is less than smallest int248 or\n * greater than largest int248).\n *\n * Counterpart to Solidity's `int248` operator.\n *\n * Requirements:\n *\n * - input must fit into 248 bits\n *\n * _Available since v4.7._\n */\n function toInt248(int256 value) internal pure returns (int248 downcasted) {\n downcasted = int248(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 248 bits\");\n }\n\n /**\n * @dev Returns the downcasted int240 from int256, reverting on\n * overflow (when the input is less than smallest int240 or\n * greater than largest int240).\n *\n * Counterpart to Solidity's `int240` operator.\n *\n * Requirements:\n *\n * - input must fit into 240 bits\n *\n * _Available since v4.7._\n */\n function toInt240(int256 value) internal pure returns (int240 downcasted) {\n downcasted = int240(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 240 bits\");\n }\n\n /**\n * @dev Returns the downcasted int232 from int256, reverting on\n * overflow (when the input is less than smallest int232 or\n * greater than largest int232).\n *\n * Counterpart to Solidity's `int232` operator.\n *\n * Requirements:\n *\n * - input must fit into 232 bits\n *\n * _Available since v4.7._\n */\n function toInt232(int256 value) internal pure returns (int232 downcasted) {\n downcasted = int232(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 232 bits\");\n }\n\n /**\n * @dev Returns the downcasted int224 from int256, reverting on\n * overflow (when the input is less than smallest int224 or\n * greater than largest int224).\n *\n * Counterpart to Solidity's `int224` operator.\n *\n * Requirements:\n *\n * - input must fit into 224 bits\n *\n * _Available since v4.7._\n */\n function toInt224(int256 value) internal pure returns (int224 downcasted) {\n downcasted = int224(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 224 bits\");\n }\n\n /**\n * @dev Returns the downcasted int216 from int256, reverting on\n * overflow (when the input is less than smallest int216 or\n * greater than largest int216).\n *\n * Counterpart to Solidity's `int216` operator.\n *\n * Requirements:\n *\n * - input must fit into 216 bits\n *\n * _Available since v4.7._\n */\n function toInt216(int256 value) internal pure returns (int216 downcasted) {\n downcasted = int216(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 216 bits\");\n }\n\n /**\n * @dev Returns the downcasted int208 from int256, reverting on\n * overflow (when the input is less than smallest int208 or\n * greater than largest int208).\n *\n * Counterpart to Solidity's `int208` operator.\n *\n * Requirements:\n *\n * - input must fit into 208 bits\n *\n * _Available since v4.7._\n */\n function toInt208(int256 value) internal pure returns (int208 downcasted) {\n downcasted = int208(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 208 bits\");\n }\n\n /**\n * @dev Returns the downcasted int200 from int256, reverting on\n * overflow (when the input is less than smallest int200 or\n * greater than largest int200).\n *\n * Counterpart to Solidity's `int200` operator.\n *\n * Requirements:\n *\n * - input must fit into 200 bits\n *\n * _Available since v4.7._\n */\n function toInt200(int256 value) internal pure returns (int200 downcasted) {\n downcasted = int200(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 200 bits\");\n }\n\n /**\n * @dev Returns the downcasted int192 from int256, reverting on\n * overflow (when the input is less than smallest int192 or\n * greater than largest int192).\n *\n * Counterpart to Solidity's `int192` operator.\n *\n * Requirements:\n *\n * - input must fit into 192 bits\n *\n * _Available since v4.7._\n */\n function toInt192(int256 value) internal pure returns (int192 downcasted) {\n downcasted = int192(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 192 bits\");\n }\n\n /**\n * @dev Returns the downcasted int184 from int256, reverting on\n * overflow (when the input is less than smallest int184 or\n * greater than largest int184).\n *\n * Counterpart to Solidity's `int184` operator.\n *\n * Requirements:\n *\n * - input must fit into 184 bits\n *\n * _Available since v4.7._\n */\n function toInt184(int256 value) internal pure returns (int184 downcasted) {\n downcasted = int184(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 184 bits\");\n }\n\n /**\n * @dev Returns the downcasted int176 from int256, reverting on\n * overflow (when the input is less than smallest int176 or\n * greater than largest int176).\n *\n * Counterpart to Solidity's `int176` operator.\n *\n * Requirements:\n *\n * - input must fit into 176 bits\n *\n * _Available since v4.7._\n */\n function toInt176(int256 value) internal pure returns (int176 downcasted) {\n downcasted = int176(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 176 bits\");\n }\n\n /**\n * @dev Returns the downcasted int168 from int256, reverting on\n * overflow (when the input is less than smallest int168 or\n * greater than largest int168).\n *\n * Counterpart to Solidity's `int168` operator.\n *\n * Requirements:\n *\n * - input must fit into 168 bits\n *\n * _Available since v4.7._\n */\n function toInt168(int256 value) internal pure returns (int168 downcasted) {\n downcasted = int168(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 168 bits\");\n }\n\n /**\n * @dev Returns the downcasted int160 from int256, reverting on\n * overflow (when the input is less than smallest int160 or\n * greater than largest int160).\n *\n * Counterpart to Solidity's `int160` operator.\n *\n * Requirements:\n *\n * - input must fit into 160 bits\n *\n * _Available since v4.7._\n */\n function toInt160(int256 value) internal pure returns (int160 downcasted) {\n downcasted = int160(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 160 bits\");\n }\n\n /**\n * @dev Returns the downcasted int152 from int256, reverting on\n * overflow (when the input is less than smallest int152 or\n * greater than largest int152).\n *\n * Counterpart to Solidity's `int152` operator.\n *\n * Requirements:\n *\n * - input must fit into 152 bits\n *\n * _Available since v4.7._\n */\n function toInt152(int256 value) internal pure returns (int152 downcasted) {\n downcasted = int152(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 152 bits\");\n }\n\n /**\n * @dev Returns the downcasted int144 from int256, reverting on\n * overflow (when the input is less than smallest int144 or\n * greater than largest int144).\n *\n * Counterpart to Solidity's `int144` operator.\n *\n * Requirements:\n *\n * - input must fit into 144 bits\n *\n * _Available since v4.7._\n */\n function toInt144(int256 value) internal pure returns (int144 downcasted) {\n downcasted = int144(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 144 bits\");\n }\n\n /**\n * @dev Returns the downcasted int136 from int256, reverting on\n * overflow (when the input is less than smallest int136 or\n * greater than largest int136).\n *\n * Counterpart to Solidity's `int136` operator.\n *\n * Requirements:\n *\n * - input must fit into 136 bits\n *\n * _Available since v4.7._\n */\n function toInt136(int256 value) internal pure returns (int136 downcasted) {\n downcasted = int136(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 136 bits\");\n }\n\n /**\n * @dev Returns the downcasted int128 from int256, reverting on\n * overflow (when the input is less than smallest int128 or\n * greater than largest int128).\n *\n * Counterpart to Solidity's `int128` operator.\n *\n * Requirements:\n *\n * - input must fit into 128 bits\n *\n * _Available since v3.1._\n */\n function toInt128(int256 value) internal pure returns (int128 downcasted) {\n downcasted = int128(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 128 bits\");\n }\n\n /**\n * @dev Returns the downcasted int120 from int256, reverting on\n * overflow (when the input is less than smallest int120 or\n * greater than largest int120).\n *\n * Counterpart to Solidity's `int120` operator.\n *\n * Requirements:\n *\n * - input must fit into 120 bits\n *\n * _Available since v4.7._\n */\n function toInt120(int256 value) internal pure returns (int120 downcasted) {\n downcasted = int120(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 120 bits\");\n }\n\n /**\n * @dev Returns the downcasted int112 from int256, reverting on\n * overflow (when the input is less than smallest int112 or\n * greater than largest int112).\n *\n * Counterpart to Solidity's `int112` operator.\n *\n * Requirements:\n *\n * - input must fit into 112 bits\n *\n * _Available since v4.7._\n */\n function toInt112(int256 value) internal pure returns (int112 downcasted) {\n downcasted = int112(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 112 bits\");\n }\n\n /**\n * @dev Returns the downcasted int104 from int256, reverting on\n * overflow (when the input is less than smallest int104 or\n * greater than largest int104).\n *\n * Counterpart to Solidity's `int104` operator.\n *\n * Requirements:\n *\n * - input must fit into 104 bits\n *\n * _Available since v4.7._\n */\n function toInt104(int256 value) internal pure returns (int104 downcasted) {\n downcasted = int104(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 104 bits\");\n }\n\n /**\n * @dev Returns the downcasted int96 from int256, reverting on\n * overflow (when the input is less than smallest int96 or\n * greater than largest int96).\n *\n * Counterpart to Solidity's `int96` operator.\n *\n * Requirements:\n *\n * - input must fit into 96 bits\n *\n * _Available since v4.7._\n */\n function toInt96(int256 value) internal pure returns (int96 downcasted) {\n downcasted = int96(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 96 bits\");\n }\n\n /**\n * @dev Returns the downcasted int88 from int256, reverting on\n * overflow (when the input is less than smallest int88 or\n * greater than largest int88).\n *\n * Counterpart to Solidity's `int88` operator.\n *\n * Requirements:\n *\n * - input must fit into 88 bits\n *\n * _Available since v4.7._\n */\n function toInt88(int256 value) internal pure returns (int88 downcasted) {\n downcasted = int88(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 88 bits\");\n }\n\n /**\n * @dev Returns the downcasted int80 from int256, reverting on\n * overflow (when the input is less than smallest int80 or\n * greater than largest int80).\n *\n * Counterpart to Solidity's `int80` operator.\n *\n * Requirements:\n *\n * - input must fit into 80 bits\n *\n * _Available since v4.7._\n */\n function toInt80(int256 value) internal pure returns (int80 downcasted) {\n downcasted = int80(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 80 bits\");\n }\n\n /**\n * @dev Returns the downcasted int72 from int256, reverting on\n * overflow (when the input is less than smallest int72 or\n * greater than largest int72).\n *\n * Counterpart to Solidity's `int72` operator.\n *\n * Requirements:\n *\n * - input must fit into 72 bits\n *\n * _Available since v4.7._\n */\n function toInt72(int256 value) internal pure returns (int72 downcasted) {\n downcasted = int72(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 72 bits\");\n }\n\n /**\n * @dev Returns the downcasted int64 from int256, reverting on\n * overflow (when the input is less than smallest int64 or\n * greater than largest int64).\n *\n * Counterpart to Solidity's `int64` operator.\n *\n * Requirements:\n *\n * - input must fit into 64 bits\n *\n * _Available since v3.1._\n */\n function toInt64(int256 value) internal pure returns (int64 downcasted) {\n downcasted = int64(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 64 bits\");\n }\n\n /**\n * @dev Returns the downcasted int56 from int256, reverting on\n * overflow (when the input is less than smallest int56 or\n * greater than largest int56).\n *\n * Counterpart to Solidity's `int56` operator.\n *\n * Requirements:\n *\n * - input must fit into 56 bits\n *\n * _Available since v4.7._\n */\n function toInt56(int256 value) internal pure returns (int56 downcasted) {\n downcasted = int56(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 56 bits\");\n }\n\n /**\n * @dev Returns the downcasted int48 from int256, reverting on\n * overflow (when the input is less than smallest int48 or\n * greater than largest int48).\n *\n * Counterpart to Solidity's `int48` operator.\n *\n * Requirements:\n *\n * - input must fit into 48 bits\n *\n * _Available since v4.7._\n */\n function toInt48(int256 value) internal pure returns (int48 downcasted) {\n downcasted = int48(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 48 bits\");\n }\n\n /**\n * @dev Returns the downcasted int40 from int256, reverting on\n * overflow (when the input is less than smallest int40 or\n * greater than largest int40).\n *\n * Counterpart to Solidity's `int40` operator.\n *\n * Requirements:\n *\n * - input must fit into 40 bits\n *\n * _Available since v4.7._\n */\n function toInt40(int256 value) internal pure returns (int40 downcasted) {\n downcasted = int40(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 40 bits\");\n }\n\n /**\n * @dev Returns the downcasted int32 from int256, reverting on\n * overflow (when the input is less than smallest int32 or\n * greater than largest int32).\n *\n * Counterpart to Solidity's `int32` operator.\n *\n * Requirements:\n *\n * - input must fit into 32 bits\n *\n * _Available since v3.1._\n */\n function toInt32(int256 value) internal pure returns (int32 downcasted) {\n downcasted = int32(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 32 bits\");\n }\n\n /**\n * @dev Returns the downcasted int24 from int256, reverting on\n * overflow (when the input is less than smallest int24 or\n * greater than largest int24).\n *\n * Counterpart to Solidity's `int24` operator.\n *\n * Requirements:\n *\n * - input must fit into 24 bits\n *\n * _Available since v4.7._\n */\n function toInt24(int256 value) internal pure returns (int24 downcasted) {\n downcasted = int24(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 24 bits\");\n }\n\n /**\n * @dev Returns the downcasted int16 from int256, reverting on\n * overflow (when the input is less than smallest int16 or\n * greater than largest int16).\n *\n * Counterpart to Solidity's `int16` operator.\n *\n * Requirements:\n *\n * - input must fit into 16 bits\n *\n * _Available since v3.1._\n */\n function toInt16(int256 value) internal pure returns (int16 downcasted) {\n downcasted = int16(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 16 bits\");\n }\n\n /**\n * @dev Returns the downcasted int8 from int256, reverting on\n * overflow (when the input is less than smallest int8 or\n * greater than largest int8).\n *\n * Counterpart to Solidity's `int8` operator.\n *\n * Requirements:\n *\n * - input must fit into 8 bits\n *\n * _Available since v3.1._\n */\n function toInt8(int256 value) internal pure returns (int8 downcasted) {\n downcasted = int8(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 8 bits\");\n }\n\n /**\n * @dev Converts an unsigned uint256 into a signed int256.\n *\n * Requirements:\n *\n * - input must be less than or equal to maxInt256.\n *\n * _Available since v3.0._\n */\n function toInt256(uint256 value) internal pure returns (int256) {\n // Note: Unsafe cast below is okay because `type(int256).max` is guaranteed to be positive\n require(value <= uint256(type(int256).max), \"SafeCast: value doesn't fit in an int256\");\n return int256(value);\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Strings.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./math/Math.sol\";\n\n/**\n * @dev String operations.\n */\nlibrary Strings {\n bytes16 private constant _SYMBOLS = \"0123456789abcdef\";\n uint8 private constant _ADDRESS_LENGTH = 20;\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n */\n function toString(uint256 value) internal pure returns (string memory) {\n unchecked {\n uint256 length = Math.log10(value) + 1;\n string memory buffer = new string(length);\n uint256 ptr;\n /// @solidity memory-safe-assembly\n assembly {\n ptr := add(buffer, add(32, length))\n }\n while (true) {\n ptr--;\n /// @solidity memory-safe-assembly\n assembly {\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\n }\n value /= 10;\n if (value == 0) break;\n }\n return buffer;\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n */\n function toHexString(uint256 value) internal pure returns (string memory) {\n unchecked {\n return toHexString(value, Math.log256(value) + 1);\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n */\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n bytes memory buffer = new bytes(2 * length + 2);\n buffer[0] = \"0\";\n buffer[1] = \"x\";\n for (uint256 i = 2 * length + 1; i > 1; --i) {\n buffer[i] = _SYMBOLS[value & 0xf];\n value >>= 4;\n }\n require(value == 0, \"Strings: hex length insufficient\");\n return string(buffer);\n }\n\n /**\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\n */\n function toHexString(address addr) internal pure returns (string memory) {\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\n }\n}\n" + }, + "contracts/deprecated/OldDistributor.sol": { + "content": "// SPDX-License-Identifier: BUSL-1.1\n\n/*\n * █ \n ***** ▓▓▓ \n * ▓▓▓▓▓▓▓ \n * ///. ▓▓▓▓▓▓▓▓▓▓▓▓▓ \n ***** //////// ▓▓▓▓▓▓▓ \n * ///////////// ▓▓▓ \n ▓▓ ////////////////// █ ▓▓ \n ▓▓ ▓▓ /////////////////////// ▓▓ ▓▓ \n ▓▓ ▓▓ //////////////////////////// ▓▓ ▓▓ \n ▓▓ ▓▓ /////////▓▓▓///////▓▓▓///////// ▓▓ ▓▓ \n ▓▓ ,////////////////////////////////////// ▓▓ ▓▓ \n ▓▓ ////////////////////////////////////////// ▓▓ \n ▓▓ //////////////////////▓▓▓▓///////////////////// \n ,//////////////////////////////////////////////////// \n .////////////////////////////////////////////////////////// \n .//////////////////////////██.,//////////////////////////█ \n .//////////////////////████..,./////////////////////██ \n ...////////////////███████.....,.////////////////███ \n ,.,////////////████████ ........,///////////████ \n .,.,//////█████████ ,.......///////████ \n ,..//████████ ........./████ \n ..,██████ .....,███ \n .██ ,.,█ \n \n \n \n ▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓ ▓▓▓▓▓▓▓▓▓▓ \n ▓▓▓▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓ ▓▓ ▓▓▓▓ \n ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓ ▓▓▓▓▓ \n ▓▓▓ ▓▓ ▓▓▓ ▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ \n*/\n\npragma solidity ^0.8.17;\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport \"@openzeppelin/contracts/utils/math/SafeCast.sol\";\n\nimport \"../utils/UUPSHelper.sol\";\n\nstruct MerkleTree {\n // Root of a Merkle tree which leaves are `(address user, address token, uint amount)`\n // representing an amount of tokens accumulated by `user`.\n // The Merkle tree is assumed to have only increasing amounts: that is to say if a user can claim 1,\n // then after the amount associated in the Merkle tree for this token should be x > 1\n bytes32 merkleRoot;\n // Ipfs hash of the tree data\n bytes32 ipfsHash;\n}\n\nstruct Claim {\n uint208 amount;\n uint48 timestamp;\n}\n\n/// @title OldDistributor\n/// @notice Allows LPs on AMMs with concentrated liquidity to claim the rewards that were distributed to them\n/// @author Angle Labs. Inc\ncontract OldDistributor is UUPSHelper {\n using SafeERC20 for IERC20;\n\n // ================================= VARIABLES =================================\n\n /// @notice Tree of claimable tokens through this contract\n MerkleTree public tree;\n\n /// @notice Tree that was in place in the contract before the last `tree` update\n MerkleTree public lastTree;\n\n /// @notice Token to deposit to freeze the roots update\n IERC20 public disputeToken;\n\n /// @notice `Core` contract handling access control\n ICore public core;\n\n /// @notice Address which created the dispute\n /// @dev Used to store if there is an ongoing dispute\n address public disputer;\n\n /// @notice Last time the `tree` was updated\n uint48 public lastTreeUpdate;\n\n /// @notice Time before which a change in a tree becomes effective\n uint48 public disputePeriod;\n\n /// @notice Amount to deposit to freeze the roots update\n uint256 public disputeAmount;\n\n /// @notice Mapping user -> token -> amount to track claimed amounts\n mapping(address => mapping(address => Claim)) public claimed;\n\n /// @notice Trusted EOAs to update the Merkle root\n mapping(address => uint256) public canUpdateMerkleRoot;\n\n /// @notice Whether or not to disable permissionless claiming\n mapping(address => uint256) public onlyOperatorCanClaim;\n\n /// @notice user -> operator -> authorisation to claim\n mapping(address => mapping(address => uint256)) public operators;\n\n uint256[38] private __gap;\n\n // =================================== EVENTS ==================================\n\n event Claimed(address user, address token, uint256 amount);\n event Disputed(string reason);\n event DisputePeriodUpdated(uint48 _disputePeriod);\n event DisputeTokenUpdated(address indexed _disputeToken);\n event DisputeAmountUpdated(uint256 _disputeAmount);\n event DisputeResolved(bool valid);\n event OperatorClaimingToggled(address user, bool isEnabled);\n event OperatorToggled(address user, address operator, bool isWhitelisted);\n event Recovered(address indexed token, address indexed to, uint256 amount);\n event TreeUpdated(bytes32 merkleRoot, bytes32 ipfsHash);\n event TrustedToggled(address indexed eoa, bool trust);\n\n // ================================= MODIFIERS =================================\n\n /// @notice Checks whether the `msg.sender` has the governor role or the guardian role\n modifier onlyGovernorOrGuardian() {\n if (!core.isGovernorOrGuardian(msg.sender)) revert NotGovernorOrGuardian();\n _;\n }\n\n /// @notice Checks whether the `msg.sender` is the `user` address or is a trusted address\n modifier onlyTrustedOrUser(address user) {\n if (user != msg.sender && canUpdateMerkleRoot[msg.sender] != 1 && !core.isGovernorOrGuardian(msg.sender))\n revert NotTrusted();\n _;\n }\n\n // ================================ CONSTRUCTOR ================================\n\n constructor() initializer {}\n\n function initialize(ICore _core) external initializer {\n if (address(_core) == address(0)) revert ZeroAddress();\n core = _core;\n }\n\n /// @inheritdoc UUPSUpgradeable\n function _authorizeUpgrade(address) internal view override onlyGuardianUpgrader(core) {}\n\n // =============================== MAIN FUNCTION ===============================\n\n /// @notice Claims rewards for a given set of users\n /// @dev Anyone may call this function for anyone else, funds go to destination regardless, it's just a question of\n /// who provides the proof and pays the gas: `msg.sender` is used only for addresses that require a trusted operator\n /// @param users Recipient of tokens\n /// @param tokens ERC20 claimed\n /// @param amounts Amount of tokens that will be sent to the corresponding users\n /// @param proofs Array of hashes bridging from a leaf `(hash of user | token | amount)` to the Merkle root\n function claim(\n address[] calldata users,\n address[] calldata tokens,\n uint256[] calldata amounts,\n bytes32[][] calldata proofs\n ) external {\n uint256 usersLength = users.length;\n if (\n usersLength == 0 ||\n usersLength != tokens.length ||\n usersLength != amounts.length ||\n usersLength != proofs.length\n ) revert InvalidLengths();\n\n for (uint256 i; i < usersLength; ) {\n address user = users[i];\n address token = tokens[i];\n uint256 amount = amounts[i];\n\n // Checking if only an approved operator can claim for `user`\n if (onlyOperatorCanClaim[user] == 1 && operators[user][msg.sender] == 0) revert NotWhitelisted();\n\n // Verifying proof\n bytes32 leaf = keccak256(abi.encode(user, token, amount));\n if (!_verifyProof(leaf, proofs[i])) revert InvalidProof();\n\n // Closing reentrancy gate here\n uint256 toSend = amount - claimed[user][token].amount;\n claimed[user][token] = Claim(SafeCast.toUint208(amount), uint48(block.timestamp));\n\n IERC20(token).safeTransfer(user, toSend);\n emit Claimed(user, token, toSend);\n unchecked {\n ++i;\n }\n }\n }\n\n /// @notice Returns the MerkleRoot that is currently live for the contract\n function getMerkleRoot() public view returns (bytes32) {\n if (block.timestamp - lastTreeUpdate >= disputePeriod) return tree.merkleRoot;\n else return lastTree.merkleRoot;\n }\n\n // ============================ GOVERNANCE FUNCTIONS ===========================\n\n /// @notice Adds or removes EOAs which are trusted to update the Merkle root\n function toggleTrusted(address eoa) external onlyGovernorOrGuardian {\n uint256 trustedStatus = 1 - canUpdateMerkleRoot[eoa];\n canUpdateMerkleRoot[eoa] = trustedStatus;\n emit TrustedToggled(eoa, trustedStatus == 1);\n }\n\n /// @notice Updates Merkle Tree\n function updateTree(MerkleTree calldata _tree) external {\n if (\n disputer != address(0) ||\n // A trusted address cannot update a tree right after a precedent tree update otherwise it can de facto\n // validate a tree which has not passed the dispute period\n ((canUpdateMerkleRoot[msg.sender] != 1 || block.timestamp - lastTreeUpdate < disputePeriod) &&\n !core.isGovernorOrGuardian(msg.sender))\n ) revert NotTrusted();\n MerkleTree memory _lastTree = tree;\n tree = _tree;\n lastTree = _lastTree;\n lastTreeUpdate = uint48(block.timestamp);\n emit TreeUpdated(_tree.merkleRoot, _tree.ipfsHash);\n }\n\n /// @notice Freezes the Merkle tree update until the dispute is resolved\n /// @dev Requires a deposit of `disputeToken` that'll be slashed if the dispute is not accepted\n /// @dev It is only possible to create a dispute for `disputePeriod` after each tree update\n function disputeTree(string memory reason) external {\n if (block.timestamp - lastTreeUpdate >= disputePeriod) revert InvalidDispute();\n IERC20(disputeToken).safeTransferFrom(msg.sender, address(this), disputeAmount);\n disputer = msg.sender;\n emit Disputed(reason);\n }\n\n /// @notice Resolve the ongoing dispute, if any\n /// @param valid Whether the dispute was valid\n function resolveDispute(bool valid) external onlyGovernorOrGuardian {\n if (disputer == address(0)) revert NoDispute();\n if (valid) {\n IERC20(disputeToken).safeTransfer(disputer, disputeAmount);\n // If a dispute is valid, the contract falls back to the last tree that was updated\n _revokeTree();\n } else {\n IERC20(disputeToken).safeTransfer(msg.sender, disputeAmount);\n lastTreeUpdate = uint48(block.timestamp);\n }\n disputer = address(0);\n emit DisputeResolved(valid);\n }\n\n /// @notice Allows the governor or the guardian of this contract to fallback to the last version of the tree\n /// immediately\n function revokeTree() external onlyGovernorOrGuardian {\n if (disputer != address(0)) revert UnresolvedDispute();\n _revokeTree();\n }\n\n /// @notice Toggles permissioned claiming for a given user\n function toggleOnlyOperatorCanClaim(address user) external onlyTrustedOrUser(user) {\n uint256 oldValue = onlyOperatorCanClaim[user];\n onlyOperatorCanClaim[user] = 1 - oldValue;\n emit OperatorClaimingToggled(user, oldValue == 0);\n }\n\n /// @notice Toggles whitelisting for a given user and a given operator\n function toggleOperator(address user, address operator) external onlyTrustedOrUser(user) {\n uint256 oldValue = operators[user][operator];\n operators[user][operator] = 1 - oldValue;\n emit OperatorToggled(user, operator, oldValue == 0);\n }\n\n /// @notice Recovers any ERC20 token\n function recoverERC20(address tokenAddress, address to, uint256 amountToRecover) external onlyGovernorOrGuardian {\n IERC20(tokenAddress).safeTransfer(to, amountToRecover);\n emit Recovered(tokenAddress, to, amountToRecover);\n }\n\n /// @notice Sets the dispute period before which a tree update becomes effective\n function setDisputePeriod(uint48 _disputePeriod) external onlyGovernorOrGuardian {\n if (_disputePeriod > block.timestamp) revert InvalidParam();\n disputePeriod = uint48(_disputePeriod);\n emit DisputePeriodUpdated(_disputePeriod);\n }\n\n /// @notice Sets the token used as a caution during disputes\n function setDisputeToken(IERC20 _disputeToken) external onlyGovernorOrGuardian {\n if (disputer != address(0)) revert UnresolvedDispute();\n disputeToken = _disputeToken;\n emit DisputeTokenUpdated(address(_disputeToken));\n }\n\n /// @notice Sets the amount of `disputeToken` used as a caution during disputes\n function setDisputeAmount(uint256 _disputeAmount) external onlyGovernorOrGuardian {\n if (disputer != address(0)) revert UnresolvedDispute();\n disputeAmount = _disputeAmount;\n emit DisputeAmountUpdated(_disputeAmount);\n }\n\n // ============================= INTERNAL FUNCTIONS ============================\n\n /// @notice Fallback to the last version of the tree\n function _revokeTree() internal {\n MerkleTree memory _tree = lastTree;\n lastTreeUpdate = 0;\n tree = _tree;\n emit TreeUpdated(_tree.merkleRoot, _tree.ipfsHash);\n }\n\n /// @notice Checks the validity of a proof\n /// @param leaf Hashed leaf data, the starting point of the proof\n /// @param proof Array of hashes forming a hash chain from leaf to root\n /// @return true If proof is correct, else false\n function _verifyProof(bytes32 leaf, bytes32[] memory proof) internal view returns (bool) {\n bytes32 currentHash = leaf;\n uint256 proofLength = proof.length;\n for (uint256 i; i < proofLength; ) {\n if (currentHash < proof[i]) {\n currentHash = keccak256(abi.encode(currentHash, proof[i]));\n } else {\n currentHash = keccak256(abi.encode(proof[i], currentHash));\n }\n unchecked {\n ++i;\n }\n }\n bytes32 root = getMerkleRoot();\n if (root == bytes32(0)) revert InvalidUninitializedRoot();\n return currentHash == root;\n }\n}\n" + }, + "contracts/DistributionCreator.sol": { + "content": "// SPDX-License-Identifier: BUSL-1.1\n\n/*\n * █ \n ***** ▓▓▓ \n * ▓▓▓▓▓▓▓ \n * ///. ▓▓▓▓▓▓▓▓▓▓▓▓▓ \n ***** //////// ▓▓▓▓▓▓▓ \n * ///////////// ▓▓▓ \n ▓▓ ////////////////// █ ▓▓ \n ▓▓ ▓▓ /////////////////////// ▓▓ ▓▓ \n ▓▓ ▓▓ //////////////////////////// ▓▓ ▓▓ \n ▓▓ ▓▓ /////////▓▓▓///////▓▓▓///////// ▓▓ ▓▓ \n ▓▓ ,////////////////////////////////////// ▓▓ ▓▓ \n ▓▓ ////////////////////////////////////////// ▓▓ \n ▓▓ //////////////////////▓▓▓▓///////////////////// \n ,//////////////////////////////////////////////////// \n .////////////////////////////////////////////////////////// \n .//////////////////////////██.,//////////////////////////█ \n .//////////////////////████..,./////////////////////██ \n ...////////////////███████.....,.////////////////███ \n ,.,////////////████████ ........,///////////████ \n .,.,//////█████████ ,.......///////████ \n ,..//████████ ........./████ \n ..,██████ .....,███ \n .██ ,.,█ \n \n \n \n ▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓ ▓▓▓▓▓▓▓▓▓▓ \n ▓▓▓▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓ ▓▓ ▓▓▓▓ \n ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓ ▓▓▓▓▓ \n ▓▓▓ ▓▓ ▓▓▓ ▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ \n*/\n\npragma solidity ^0.8.17;\n\nimport { ReentrancyGuardUpgradeable } from \"@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol\";\nimport { IERC20, IERC20Metadata } from \"@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol\";\nimport { SafeERC20 } from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport { ECDSA } from \"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\";\n\nimport { IUniswapV3Pool } from \"./interfaces/external/uniswap/IUniswapV3Pool.sol\";\n\nimport \"./utils/UUPSHelper.sol\";\nimport { DistributionParameters } from \"./struct/DistributionParameters.sol\";\nimport { UniswapTokenData, ExtensiveDistributionParameters } from \"./struct/ExtensiveDistributionParameters.sol\";\nimport { RewardTokenAmounts } from \"./struct/RewardTokenAmounts.sol\";\n\ninterface IDistributionCreator {\n function tryGetExtensiveDistributionParameters(\n DistributionParameters memory distribution\n ) external view returns (bool success, ExtensiveDistributionParameters memory extensiveParams);\n}\n\n/// @title DistributionCreator\n/// @author Angle Labs, Inc.\n/// @notice Manages the distribution of rewards across different pools with concentrated liquidity (like on Uniswap V3)\n/// @dev This contract is mostly a helper for APIs built on top of Merkl\n/// @dev People depositing rewards must have signed a `message` with the conditions for using the\n/// product\n//solhint-disable\ncontract DistributionCreator is UUPSHelper, ReentrancyGuardUpgradeable {\n using SafeERC20 for IERC20;\n\n // =========================== CONSTANTS / VARIABLES ===========================\n\n /// @notice Epoch duration\n uint32 public constant EPOCH_DURATION = 3600;\n\n /// @notice Base for fee computation\n uint256 public constant BASE_9 = 1e9;\n\n /// @notice `Core` contract handling access control\n ICore public core;\n\n /// @notice User contract for distributing rewards\n address public distributor;\n\n /// @notice Address to which fees are forwarded\n address public feeRecipient;\n\n /// @notice Value (in base 10**9) of the fees taken when creating a distribution for a pool which do not\n /// have a whitelisted token in it\n uint256 public fees;\n\n /// @notice Message that needs to be acknowledged by users creating a distribution\n string public message;\n\n /// @notice Hash of the message that needs to be signed\n bytes32 public messageHash;\n\n /// @notice List of all rewards ever distributed or to be distributed in the contract\n /// @dev An attacker could try to populate this list. It shouldn't be an issue as only view functions\n /// iterate on it\n DistributionParameters[] public distributionList;\n\n /// @notice Maps an address to its fee rebate\n mapping(address => uint256) public feeRebate;\n\n /// @notice Maps a token to whether it is whitelisted or not. No fees are to be paid for incentives given\n /// on pools with whitelisted tokens\n mapping(address => uint256) public isWhitelistedToken;\n\n /// @notice Maps an address to its nonce for creating a distribution\n mapping(address => uint256) public nonces;\n\n /// @notice Maps an address to the last valid hash signed\n mapping(address => bytes32) public userSignatures;\n\n /// @notice Maps a user to whether it is whitelisted for not signing\n mapping(address => uint256) public userSignatureWhitelist;\n\n /// @notice Maps a token to the minimum amount that must be sent per epoch for a distribution to be valid\n /// @dev If `rewardTokenMinAmounts[token] == 0`, then `token` cannot be used as a reward\n mapping(address => uint256) public rewardTokenMinAmounts;\n\n /// @notice List of all reward tokens that have at some point been accepted\n address[] public rewardTokens;\n\n uint256[36] private __gap;\n\n // =================================== EVENTS ==================================\n\n event DistributorUpdated(address indexed _distributor);\n event FeeRebateUpdated(address indexed user, uint256 userFeeRebate);\n event FeeRecipientUpdated(address indexed _feeRecipient);\n event FeesSet(uint256 _fees);\n event MessageUpdated(bytes32 _messageHash);\n event NewDistribution(DistributionParameters distribution, address indexed sender);\n event RewardTokenMinimumAmountUpdated(address indexed token, uint256 amount);\n event TokenWhitelistToggled(address indexed token, uint256 toggleStatus);\n event UserSigned(bytes32 messageHash, address indexed user);\n event UserSigningWhitelistToggled(address indexed user, uint256 toggleStatus);\n\n // ================================= MODIFIERS =================================\n\n /// @notice Checks whether the `msg.sender` has the governor role or the guardian role\n modifier onlyGovernorOrGuardian() {\n if (!core.isGovernorOrGuardian(msg.sender)) revert NotGovernorOrGuardian();\n _;\n }\n\n /// @notice Checks whether an address has signed the message or not\n modifier hasSigned() {\n if (\n userSignatureWhitelist[msg.sender] == 0 &&\n userSignatures[msg.sender] != messageHash &&\n userSignatureWhitelist[tx.origin] == 0 &&\n userSignatures[tx.origin] != messageHash\n ) revert NotSigned();\n _;\n }\n\n // ================================ CONSTRUCTOR ================================\n\n function initialize(ICore _core, address _distributor, uint256 _fees) external initializer {\n if (address(_core) == address(0) || _distributor == address(0)) revert ZeroAddress();\n if (_fees >= BASE_9) revert InvalidParam();\n distributor = _distributor;\n core = _core;\n fees = _fees;\n }\n\n constructor() initializer {}\n\n /// @inheritdoc UUPSUpgradeable\n function _authorizeUpgrade(address) internal view override onlyGuardianUpgrader(core) {}\n\n // ============================== DEPOSIT FUNCTION =============================\n\n /// @notice Creates a `distribution` to incentivize a given pool for a specific period of time\n /// @return distributionAmount How many reward tokens are actually taken into consideration in the contract\n /// @dev If the address specified as a UniV3 pool is not effectively a pool, it will not be handled by the\n /// distribution script and rewards may be lost\n /// @dev Reward tokens sent as part of distributions must have been whitelisted before and amounts\n /// sent should be bigger than a minimum amount specific to each token\n /// @dev The `positionWrappers` specified in the `distribution` struct need to be supported by the script\n /// List of supported `positionWrappers` can be found in the docs.\n /// @dev If the pool incentivized contains one whitelisted token, then no fees are taken on the rewards\n /// @dev This function reverts if the sender has not signed the message `messageHash` once through one of\n /// the functions enabling to sign\n function createDistribution(\n DistributionParameters memory distribution\n ) external hasSigned returns (uint256 distributionAmount) {\n return _createDistribution(distribution);\n }\n\n /// @notice Same as the function above but for multiple distributions at once\n /// @return List of all the distribution amounts actually deposited for each `distribution` in the `distributions` list\n function createDistributions(\n DistributionParameters[] memory distributions\n ) external hasSigned returns (uint256[] memory) {\n uint256 distributionsLength = distributions.length;\n uint256[] memory distributionAmounts = new uint256[](distributionsLength);\n for (uint256 i; i < distributionsLength; ) {\n distributionAmounts[i] = _createDistribution(distributions[i]);\n unchecked {\n ++i;\n }\n }\n return distributionAmounts;\n }\n\n /// @notice Checks whether the `msg.sender`'s `signature` is compatible with the message\n /// to sign and stores the signature\n /// @dev If you signed the message once, and the message has not been modified, then you do not\n /// need to sign again\n function sign(bytes calldata signature) external {\n _sign(signature);\n }\n\n /// @notice Combines signing the message and creating a distribution\n function signAndCreateDistribution(\n DistributionParameters memory distribution,\n bytes calldata signature\n ) external returns (uint256 distributionAmount) {\n _sign(signature);\n return _createDistribution(distribution);\n }\n\n /// @notice Internal version of `createDistribution`\n function _createDistribution(\n DistributionParameters memory distribution\n ) internal nonReentrant returns (uint256 distributionAmount) {\n uint32 epochStart = _getRoundedEpoch(distribution.epochStart);\n uint256 minDistributionAmount = rewardTokenMinAmounts[distribution.rewardToken];\n distribution.epochStart = epochStart;\n // Reward are not accepted in the following conditions:\n if (\n // if epoch parameters lead to a past distribution\n epochStart + EPOCH_DURATION < block.timestamp ||\n // if the amount of epochs for which this distribution should last is zero\n distribution.numEpoch == 0 ||\n // if the distribution parameters are not correctly specified\n distribution.propFees + distribution.propToken0 + distribution.propToken1 != 1e4 ||\n // if boosted addresses get less than non-boosted addresses in case of\n (distribution.boostingAddress != address(0) && distribution.boostedReward < 1e4) ||\n // if the type of the position wrappers is not well specified\n distribution.positionWrappers.length != distribution.wrapperTypes.length ||\n // if the reward token is not whitelisted as an incentive token\n minDistributionAmount == 0 ||\n // if the amount distributed is too small with respect to what is allowed\n distribution.amount / distribution.numEpoch < minDistributionAmount\n ) revert InvalidReward();\n distributionAmount = distribution.amount;\n // Computing fees: these are waived for whitelisted addresses and if there is a whitelisted token in a pool\n uint256 userFeeRebate = feeRebate[msg.sender];\n if (\n userFeeRebate < BASE_9 &&\n // Algebra pools also have these `token0` and `token1` parameters\n isWhitelistedToken[IUniswapV3Pool(distribution.uniV3Pool).token0()] == 0 &&\n isWhitelistedToken[IUniswapV3Pool(distribution.uniV3Pool).token1()] == 0\n ) {\n uint256 _fees = (fees * (BASE_9 - userFeeRebate)) / BASE_9;\n uint256 distributionAmountMinusFees = (distributionAmount * (BASE_9 - _fees)) / BASE_9;\n address _feeRecipient = feeRecipient;\n _feeRecipient = _feeRecipient == address(0) ? address(this) : _feeRecipient;\n IERC20(distribution.rewardToken).safeTransferFrom(\n msg.sender,\n _feeRecipient,\n distributionAmount - distributionAmountMinusFees\n );\n distributionAmount = distributionAmountMinusFees;\n distribution.amount = distributionAmount;\n }\n\n IERC20(distribution.rewardToken).safeTransferFrom(msg.sender, distributor, distributionAmount);\n uint256 senderNonce = nonces[msg.sender];\n nonces[msg.sender] = senderNonce + 1;\n distribution.rewardId = bytes32(keccak256(abi.encodePacked(msg.sender, senderNonce)));\n distributionList.push(distribution);\n emit NewDistribution(distribution, msg.sender);\n }\n\n /// @notice Internal version of the `sign` function\n function _sign(bytes calldata signature) internal {\n bytes32 _messageHash = messageHash;\n if (ECDSA.recover(_messageHash, signature) != msg.sender) revert InvalidSignature();\n userSignatures[msg.sender] = _messageHash;\n emit UserSigned(_messageHash, msg.sender);\n }\n\n // ================================= UI HELPERS ================================\n // These functions are not to be queried on-chain and hence are not optimized for gas consumption\n\n /// @notice Returns the list of all distributions ever made or to be done in the future\n function getAllDistributions() external view returns (DistributionParameters[] memory) {\n return distributionList;\n }\n\n /// @notice Returns the list of all currently active distributions on pools of supported AMMs (like Uniswap V3)\n function getActiveDistributions()\n external\n view\n returns (ExtensiveDistributionParameters[] memory searchDistributions)\n {\n uint32 roundedEpoch = _getRoundedEpoch(uint32(block.timestamp));\n (searchDistributions, ) = _getPoolDistributionsBetweenEpochs(\n address(0),\n roundedEpoch,\n roundedEpoch + EPOCH_DURATION,\n 0,\n type(uint32).max\n );\n }\n\n /// @notice Similar to `getActiveDistributions()` with additional parameters to prevent out of gas error\n /// @param skip Disregard distibutions with a global index lower than `skip`\n /// @param first Limit the length of the returned array to `first`\n /// @return searchDistributions Eligible distributions\n /// @return lastIndexDistribution Index of the last distribution assessed in the list of all distributions\n /// For pagniation purpose, in case of out of gas, you can call back the same function but with `skip` set to `lastIndexDistribution`\n function getActiveDistributions(\n uint32 skip,\n uint32 first\n )\n external\n view\n returns (ExtensiveDistributionParameters[] memory searchDistributions, uint256 lastIndexDistribution)\n {\n uint32 roundedEpoch = _getRoundedEpoch(uint32(block.timestamp));\n return _getPoolDistributionsBetweenEpochs(address(0), roundedEpoch, roundedEpoch + EPOCH_DURATION, skip, first);\n }\n\n /// @notice Returns the list of all the reward tokens supported as well as their minimum amounts\n function getValidRewardTokens() external view returns (RewardTokenAmounts[] memory) {\n uint256 length;\n uint256 rewardTokenListLength = rewardTokens.length;\n RewardTokenAmounts[] memory validRewardTokens = new RewardTokenAmounts[](rewardTokenListLength);\n for (uint32 i; i < rewardTokenListLength; ) {\n address token = rewardTokens[i];\n uint256 minAmount = rewardTokenMinAmounts[token];\n if (minAmount > 0) {\n validRewardTokens[length] = RewardTokenAmounts(token, minAmount);\n length += 1;\n }\n unchecked {\n ++i;\n }\n }\n assembly {\n mstore(validRewardTokens, length)\n }\n return validRewardTokens;\n }\n\n /// @notice Returns the list of all the distributions that were or that are going to be live at\n /// a specific epoch\n function getDistributionsForEpoch(\n uint32 epoch\n ) external view returns (ExtensiveDistributionParameters[] memory searchDistributions) {\n uint32 roundedEpoch = _getRoundedEpoch(epoch);\n (searchDistributions, ) = _getPoolDistributionsBetweenEpochs(\n address(0),\n roundedEpoch,\n roundedEpoch + EPOCH_DURATION,\n 0,\n type(uint32).max\n );\n }\n\n /// @notice Similar to `getDistributionsForEpoch(uint256 epoch)` with additional parameters to prevent out of gas error\n /// @param skip Disregard distibutions with a global index lower than `skip`\n /// @param first Limit the length of the returned array to `first`\n /// @return searchDistributions Eligible distributions\n /// @return lastIndexDistribution Index of the last distribution assessed in the list of all distributions\n /// For pagniation purpose, in case of out of gas, you can call back the same function but with `skip` set to `lastIndexDistribution`\n function getDistributionsForEpoch(\n uint32 epoch,\n uint32 skip,\n uint32 first\n ) external view returns (ExtensiveDistributionParameters[] memory, uint256 lastIndexDistribution) {\n uint32 roundedEpoch = _getRoundedEpoch(epoch);\n return _getPoolDistributionsBetweenEpochs(address(0), roundedEpoch, roundedEpoch + EPOCH_DURATION, skip, first);\n }\n\n /// @notice Gets the distributions that were or will be live at some point between `epochStart` (included) and `epochEnd` (excluded)\n /// @dev If a distribution starts during `epochEnd`, it is not be returned by this function\n /// @dev Conversely, if a distribution starts after `epochStart` and ends before `epochEnd`, it is returned by this function\n function getDistributionsBetweenEpochs(\n uint32 epochStart,\n uint32 epochEnd\n ) external view returns (ExtensiveDistributionParameters[] memory searchDistributions) {\n (searchDistributions, ) = _getPoolDistributionsBetweenEpochs(\n address(0),\n _getRoundedEpoch(epochStart),\n _getRoundedEpoch(epochEnd),\n 0,\n type(uint32).max\n );\n }\n\n /// @notice Similar to `getDistributionsBetweenEpochs(uint256 epochStart, uint256 epochEnd)` with additional parameters to prevent out of gas error\n /// @param skip Disregard distibutions with a global index lower than `skip`\n /// @param first Limit the length of the returned array to `first`\n /// @return searchDistributions Eligible distributions\n /// @return lastIndexDistribution Index of the last distribution assessed in the list of all distributions\n /// For pagniation purpose, in case of out of gas, you can call back the same function but with `skip` set to `lastIndexDistribution`\n function getDistributionsBetweenEpochs(\n uint32 epochStart,\n uint32 epochEnd,\n uint32 skip,\n uint32 first\n ) external view returns (ExtensiveDistributionParameters[] memory, uint256 lastIndexDistribution) {\n return\n _getPoolDistributionsBetweenEpochs(\n address(0),\n _getRoundedEpoch(epochStart),\n _getRoundedEpoch(epochEnd),\n skip,\n first\n );\n }\n\n /// @notice Returns the list of all distributions that were or will be live after `epochStart` (included)\n function getDistributionsAfterEpoch(\n uint32 epochStart\n ) external view returns (ExtensiveDistributionParameters[] memory searchDistributions) {\n (searchDistributions, ) = _getPoolDistributionsBetweenEpochs(\n address(0),\n _getRoundedEpoch(epochStart),\n type(uint32).max,\n 0,\n type(uint32).max\n );\n }\n\n /// @notice Similar to `getDistributionsAfterEpoch(uint256 epochStart)` with additional parameters to prevent out of gas error\n /// @param skip Disregard distibutions with a global index lower than `skip`\n /// @param first Limit the length of the returned array to `first`\n /// @return searchDistributions Eligible distributions\n /// @return lastIndexDistribution Index of the last distribution assessed in the list of all distributions\n /// For pagniation purpose, in case of out of gas, you can call back the same function but with `skip` set to `lastIndexDistribution`\n function getDistributionsAfterEpoch(\n uint32 epochStart,\n uint32 skip,\n uint32 first\n ) external view returns (ExtensiveDistributionParameters[] memory, uint256 lastIndexDistribution) {\n return\n _getPoolDistributionsBetweenEpochs(address(0), _getRoundedEpoch(epochStart), type(uint32).max, skip, first);\n }\n\n /// @notice Returns the list of all currently active distributions for a specific UniswapV3 pool\n function getActivePoolDistributions(\n address uniV3Pool\n ) external view returns (ExtensiveDistributionParameters[] memory searchDistributions) {\n uint32 roundedEpoch = _getRoundedEpoch(uint32(block.timestamp));\n (searchDistributions, ) = _getPoolDistributionsBetweenEpochs(\n uniV3Pool,\n roundedEpoch,\n roundedEpoch + EPOCH_DURATION,\n 0,\n type(uint32).max\n );\n }\n\n /// @notice Similar to `getActivePoolDistributions(address uniV3Pool)` with additional parameters to prevent out of gas error\n /// @param skip Disregard distibutions with a global index lower than `skip`\n /// @param first Limit the length of the returned array to `first`\n /// @return searchDistributions Eligible distributions\n /// @return lastIndexDistribution Index of the last distribution assessed in the list of all distributions\n /// For pagniation purpose, in case of out of gas, you can call back the same function but with `skip` set to `lastIndexDistribution`\n function getActivePoolDistributions(\n address uniV3Pool,\n uint32 skip,\n uint32 first\n ) external view returns (ExtensiveDistributionParameters[] memory, uint256 lastIndexDistribution) {\n uint32 roundedEpoch = _getRoundedEpoch(uint32(block.timestamp));\n return _getPoolDistributionsBetweenEpochs(uniV3Pool, roundedEpoch, roundedEpoch + EPOCH_DURATION, skip, first);\n }\n\n /// @notice Returns the list of all the distributions that were or that are going to be live at a\n /// specific epoch and for a specific pool\n function getPoolDistributionsForEpoch(\n address uniV3Pool,\n uint32 epoch\n ) external view returns (ExtensiveDistributionParameters[] memory searchDistributions) {\n uint32 roundedEpoch = _getRoundedEpoch(epoch);\n (searchDistributions, ) = _getPoolDistributionsBetweenEpochs(\n uniV3Pool,\n roundedEpoch,\n roundedEpoch + EPOCH_DURATION,\n 0,\n type(uint32).max\n );\n }\n\n /// @notice Similar to `getPoolDistributionsForEpoch(address uniV3Pool,uint32 epoch)` with additional parameters to prevent out of gas error\n /// @param skip Disregard distibutions with a global index lower than `skip`\n /// @param first Limit the length of the returned array to `first`\n /// @return searchDistributions Eligible distributions\n /// @return lastIndexDistribution Index of the last distribution assessed in the list of all distributions\n /// For pagniation purpose, in case of out of gas, you can call back the same function but with `skip` set to `lastIndexDistribution`\n function getPoolDistributionsForEpoch(\n address uniV3Pool,\n uint32 epoch,\n uint32 skip,\n uint32 first\n ) external view returns (ExtensiveDistributionParameters[] memory, uint256 lastIndexDistribution) {\n uint32 roundedEpoch = _getRoundedEpoch(epoch);\n return _getPoolDistributionsBetweenEpochs(uniV3Pool, roundedEpoch, roundedEpoch + EPOCH_DURATION, skip, first);\n }\n\n /// @notice Returns the list of all distributions that were or will be live at some point between\n /// `epochStart` (included) and `epochEnd` (excluded) for a specific pool\n function getPoolDistributionsBetweenEpochs(\n address uniV3Pool,\n uint32 epochStart,\n uint32 epochEnd\n ) external view returns (ExtensiveDistributionParameters[] memory searchDistributions) {\n (searchDistributions, ) = _getPoolDistributionsBetweenEpochs(\n uniV3Pool,\n _getRoundedEpoch(epochStart),\n _getRoundedEpoch(epochEnd),\n 0,\n type(uint32).max\n );\n }\n\n /// @notice Similar to `getPoolDistributionsBetweenEpochs(address uniV3Pool,uint32 epochStart, uint32 epochEnd)` with additional parameters to prevent out of gas error\n /// @param skip Disregard distibutions with a global index lower than `skip`\n /// @param first Limit the length of the returned array to `first`\n /// @return searchDistributions Eligible distributions\n /// @return lastIndexDistribution Index of the last distribution assessed in the list of all distributions\n /// For pagniation purpose, in case of out of gas, you can call back the same function but with `skip` set to `lastIndexDistribution`\n function getPoolDistributionsBetweenEpochs(\n address uniV3Pool,\n uint32 epochStart,\n uint32 epochEnd,\n uint32 skip,\n uint32 first\n ) external view returns (ExtensiveDistributionParameters[] memory, uint256 lastIndexDistribution) {\n return\n _getPoolDistributionsBetweenEpochs(\n uniV3Pool,\n _getRoundedEpoch(epochStart),\n _getRoundedEpoch(epochEnd),\n skip,\n first\n );\n }\n\n /// @notice Returns the list of all distributions that were or will be live after `epochStart` (included)\n /// for a specific pool\n function getPoolDistributionsAfterEpoch(\n address uniV3Pool,\n uint32 epochStart\n ) external view returns (ExtensiveDistributionParameters[] memory searchDistributions) {\n (searchDistributions, ) = _getPoolDistributionsBetweenEpochs(\n uniV3Pool,\n _getRoundedEpoch(epochStart),\n type(uint32).max,\n 0,\n type(uint32).max\n );\n }\n\n /// @notice Similar to `getPoolDistributionsAfterEpoch(address uniV3Pool,uint32 epochStart)` with additional parameters to prevent out of gas error\n /// @param skip Disregard distibutions with a global index lower than `skip`\n /// @param first Limit the length of the returned array to `first`\n /// @return searchDistributions Eligible distributions\n /// @return lastIndexDistribution Index of the last distribution assessed in the list of all distributions\n /// For pagniation purpose, in case of out of gas, you can call back the same function but with `skip` set to `lastIndexDistribution`\n function getPoolDistributionsAfterEpoch(\n address uniV3Pool,\n uint32 epochStart,\n uint32 skip,\n uint32 first\n ) external view returns (ExtensiveDistributionParameters[] memory, uint256 lastIndexDistribution) {\n return\n _getPoolDistributionsBetweenEpochs(uniV3Pool, _getRoundedEpoch(epochStart), type(uint32).max, skip, first);\n }\n\n // ============================ GOVERNANCE FUNCTIONS ===========================\n\n /// @notice Sets a new `distributor` to which rewards should be distributed\n function setNewDistributor(address _distributor) external onlyGovernorOrGuardian {\n if (_distributor == address(0)) revert InvalidParam();\n distributor = _distributor;\n emit DistributorUpdated(_distributor);\n }\n\n /// @notice Sets the fees on deposit\n function setFees(uint256 _fees) external onlyGovernorOrGuardian {\n if (_fees >= BASE_9) revert InvalidParam();\n fees = _fees;\n emit FeesSet(_fees);\n }\n\n /// @notice Sets fee rebates for a given user\n function setUserFeeRebate(address user, uint256 userFeeRebate) external onlyGovernorOrGuardian {\n feeRebate[user] = userFeeRebate;\n emit FeeRebateUpdated(user, userFeeRebate);\n }\n\n /// @notice Toggles the fee whitelist for `token`\n function toggleTokenWhitelist(address token) external onlyGovernorOrGuardian {\n uint256 toggleStatus = 1 - isWhitelistedToken[token];\n isWhitelistedToken[token] = toggleStatus;\n emit TokenWhitelistToggled(token, toggleStatus);\n }\n\n /// @notice Recovers fees accrued on the contract for a list of `tokens`\n function recoverFees(IERC20[] calldata tokens, address to) external onlyGovernorOrGuardian {\n uint256 tokensLength = tokens.length;\n for (uint256 i; i < tokensLength; ) {\n tokens[i].safeTransfer(to, tokens[i].balanceOf(address(this)));\n unchecked {\n ++i;\n }\n }\n }\n\n /// @notice Sets the minimum amounts per distribution epoch for different reward tokens\n function setRewardTokenMinAmounts(\n address[] calldata tokens,\n uint256[] calldata amounts\n ) external onlyGovernorOrGuardian {\n uint256 tokensLength = tokens.length;\n if (tokensLength != amounts.length) revert InvalidLengths();\n for (uint256 i; i < tokensLength; ++i) {\n uint256 amount = amounts[i];\n // Basic logic check to make sure there are no duplicates in the `rewardTokens` table. If a token is\n // removed then re-added, it will appear as a duplicate in the list\n if (amount > 0 && rewardTokenMinAmounts[tokens[i]] == 0) rewardTokens.push(tokens[i]);\n rewardTokenMinAmounts[tokens[i]] = amount;\n emit RewardTokenMinimumAmountUpdated(tokens[i], amount);\n }\n }\n\n /// @notice Sets a new address to receive fees\n function setFeeRecipient(address _feeRecipient) external onlyGovernorOrGuardian {\n feeRecipient = _feeRecipient;\n emit FeeRecipientUpdated(_feeRecipient);\n }\n\n /// @notice Sets the message that needs to be signed by users before posting rewards\n function setMessage(string memory _message) external onlyGovernorOrGuardian {\n message = _message;\n bytes32 _messageHash = ECDSA.toEthSignedMessageHash(bytes(_message));\n messageHash = _messageHash;\n emit MessageUpdated(_messageHash);\n }\n\n /// @notice Toggles the whitelist status for `user` when it comes to signing messages before depositing rewards.\n function toggleSigningWhitelist(address user) external onlyGovernorOrGuardian {\n uint256 whitelistStatus = 1 - userSignatureWhitelist[user];\n userSignatureWhitelist[user] = whitelistStatus;\n emit UserSigningWhitelistToggled(user, whitelistStatus);\n }\n\n // ============================== INTERNAL HELPERS =============================\n\n /// @notice Rounds an `epoch` timestamp to the start of the corresponding period\n function _getRoundedEpoch(uint32 epoch) internal pure returns (uint32) {\n return (epoch / EPOCH_DURATION) * EPOCH_DURATION;\n }\n\n /// @notice Checks whether `distribution` was live between `roundedEpochStart` and `roundedEpochEnd`\n function _isDistributionLiveBetweenEpochs(\n DistributionParameters memory distribution,\n uint32 roundedEpochStart,\n uint32 roundedEpochEnd\n ) internal pure returns (bool) {\n uint256 distributionEpochStart = distribution.epochStart;\n return (distributionEpochStart + distribution.numEpoch * EPOCH_DURATION > roundedEpochStart &&\n distributionEpochStart < roundedEpochEnd);\n }\n\n /// @notice Fetches data for `token` on the Uniswap `pool`\n function _getUniswapTokenData(\n IERC20Metadata token,\n address pool\n ) internal view returns (UniswapTokenData memory data) {\n data.add = address(token);\n data.decimals = token.decimals();\n data.symbol = token.symbol();\n data.poolBalance = token.balanceOf(pool);\n }\n\n /// @notice Fetches extra data about the parameters in a distribution\n function getExtensiveDistributionParameters(\n DistributionParameters memory distribution\n ) external view returns (ExtensiveDistributionParameters memory extensiveParams) {\n extensiveParams.base = distribution;\n try IUniswapV3Pool(distribution.uniV3Pool).fee() returns (uint24 fee) {\n extensiveParams.poolFee = fee;\n } catch {\n extensiveParams.poolFee = 0;\n }\n extensiveParams.token0 = _getUniswapTokenData(\n IERC20Metadata(IUniswapV3Pool(distribution.uniV3Pool).token0()),\n distribution.uniV3Pool\n );\n extensiveParams.token1 = _getUniswapTokenData(\n IERC20Metadata(IUniswapV3Pool(distribution.uniV3Pool).token1()),\n distribution.uniV3Pool\n );\n extensiveParams.rewardTokenSymbol = IERC20Metadata(distribution.rewardToken).symbol();\n extensiveParams.rewardTokenDecimals = IERC20Metadata(distribution.rewardToken).decimals();\n }\n\n /// @notice Tries to fetch extra data about the parameters in a distribution\n function tryGetExtensiveDistributionParameters(\n DistributionParameters memory distribution\n ) external returns (bool success, ExtensiveDistributionParameters memory extensiveParams) {\n (bool callSuccess, bytes memory returndata) = address(this).delegatecall(\n abi.encodeWithSelector(DistributionCreator.getExtensiveDistributionParameters.selector, distribution)\n );\n success = callSuccess;\n if (success) {\n extensiveParams = abi.decode(returndata, (ExtensiveDistributionParameters));\n }\n return (success, extensiveParams);\n }\n\n /// @notice Gets the list of all the distributions for `uniV3Pool` that have been active between `epochStart` and `epochEnd` (excluded)\n /// @dev If the `uniV3Pool` parameter is equal to 0, then this function will return the distributions for all pools\n function _getPoolDistributionsBetweenEpochs(\n address uniV3Pool,\n uint32 epochStart,\n uint32 epochEnd,\n uint32 skip,\n uint32 first\n ) internal view returns (ExtensiveDistributionParameters[] memory, uint256) {\n uint256 length;\n uint256 distributionListLength = distributionList.length;\n uint256 returnSize = first > distributionListLength ? distributionListLength : first;\n ExtensiveDistributionParameters[] memory activeRewards = new ExtensiveDistributionParameters[](returnSize);\n uint32 i = skip;\n while (i < distributionListLength) {\n DistributionParameters memory distribution = distributionList[i];\n if (\n _isDistributionLiveBetweenEpochs(distribution, epochStart, epochEnd) &&\n (uniV3Pool == address(0) || distribution.uniV3Pool == uniV3Pool)\n ) {\n (bool success, ExtensiveDistributionParameters memory extensiveParams) = IDistributionCreator(\n address(this)\n ).tryGetExtensiveDistributionParameters(distribution);\n if (success) {\n activeRewards[length] = extensiveParams;\n length += 1;\n }\n }\n unchecked {\n ++i;\n }\n if (length == returnSize) break;\n }\n assembly {\n mstore(activeRewards, length)\n }\n return (activeRewards, i);\n }\n}\n" + }, + "contracts/Distributor.sol": { + "content": "// SPDX-License-Identifier: BUSL-1.1\n\n/*\n * █ \n ***** ▓▓▓ \n * ▓▓▓▓▓▓▓ \n * ///. ▓▓▓▓▓▓▓▓▓▓▓▓▓ \n ***** //////// ▓▓▓▓▓▓▓ \n * ///////////// ▓▓▓ \n ▓▓ ////////////////// █ ▓▓ \n ▓▓ ▓▓ /////////////////////// ▓▓ ▓▓ \n ▓▓ ▓▓ //////////////////////////// ▓▓ ▓▓ \n ▓▓ ▓▓ /////////▓▓▓///////▓▓▓///////// ▓▓ ▓▓ \n ▓▓ ,////////////////////////////////////// ▓▓ ▓▓ \n ▓▓ ////////////////////////////////////////// ▓▓ \n ▓▓ //////////////////////▓▓▓▓///////////////////// \n ,//////////////////////////////////////////////////// \n .////////////////////////////////////////////////////////// \n .//////////////////////////██.,//////////////////////////█ \n .//////////////////////████..,./////////////////////██ \n ...////////////////███████.....,.////////////////███ \n ,.,////////////████████ ........,///////////████ \n .,.,//////█████████ ,.......///////████ \n ,..//████████ ........./████ \n ..,██████ .....,███ \n .██ ,.,█ \n \n \n \n ▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓ ▓▓▓▓▓▓▓▓▓▓ \n ▓▓▓▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓ ▓▓ ▓▓▓▓ \n ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓ ▓▓▓▓▓ \n ▓▓▓ ▓▓ ▓▓▓ ▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ \n*/\n\npragma solidity ^0.8.17;\n\nimport { IERC20 } from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport { SafeERC20 } from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport { SafeCast } from \"@openzeppelin/contracts/utils/math/SafeCast.sol\";\n\nimport \"./utils/UUPSHelper.sol\";\n\nstruct MerkleTree {\n // Root of a Merkle tree which leaves are `(address user, address token, uint amount)`\n // representing an amount of tokens accumulated by `user`.\n // The Merkle tree is assumed to have only increasing amounts: that is to say if a user can claim 1,\n // then after the amount associated in the Merkle tree for this token should be x > 1\n bytes32 merkleRoot;\n // Ipfs hash of the tree data\n bytes32 ipfsHash;\n}\n\nstruct Claim {\n uint208 amount;\n uint48 timestamp;\n bytes32 merkleRoot;\n}\n\n/// @title Distributor\n/// @notice Allows LPs on AMMs with concentrated liquidity to claim the rewards that were distributed to them\n/// @author Angle Labs. Inc\ncontract Distributor is UUPSHelper {\n using SafeERC20 for IERC20;\n\n /// @notice Epoch duration\n uint32 internal constant _EPOCH_DURATION = 3600;\n\n // ================================= VARIABLES =================================\n\n /// @notice Tree of claimable tokens through this contract\n MerkleTree public tree;\n\n /// @notice Tree that was in place in the contract before the last `tree` update\n MerkleTree public lastTree;\n\n /// @notice Token to deposit to freeze the roots update\n IERC20 public disputeToken;\n\n /// @notice `Core` contract handling access control\n ICore public core;\n\n /// @notice Address which created the dispute\n /// @dev Used to store if there is an ongoing dispute\n address public disputer;\n\n /// @notice When the current tree will become valid\n uint48 public endOfDisputePeriod;\n\n /// @notice Time after which a change in a tree becomes effective, in EPOCH_DURATION\n uint48 public disputePeriod;\n\n /// @notice Amount to deposit to freeze the roots update\n uint256 public disputeAmount;\n\n /// @notice Mapping user -> token -> amount to track claimed amounts\n mapping(address => mapping(address => Claim)) public claimed;\n\n /// @notice Trusted EOAs to update the Merkle root\n mapping(address => uint256) public canUpdateMerkleRoot;\n\n /// @notice Whether or not to disable permissionless claiming\n mapping(address => uint256) public onlyOperatorCanClaim;\n\n /// @notice user -> operator -> authorisation to claim\n mapping(address => mapping(address => uint256)) public operators;\n\n uint256[38] private __gap;\n\n // =================================== EVENTS ==================================\n\n event Claimed(address indexed user, address indexed token, uint256 amount);\n event DisputeAmountUpdated(uint256 _disputeAmount);\n event Disputed(string reason);\n event DisputePeriodUpdated(uint48 _disputePeriod);\n event DisputeResolved(bool valid);\n event DisputeTokenUpdated(address indexed _disputeToken);\n event OperatorClaimingToggled(address indexed user, bool isEnabled);\n event OperatorToggled(address indexed user, address indexed operator, bool isWhitelisted);\n event Recovered(address indexed token, address indexed to, uint256 amount);\n event Revoked(); // With this event an indexer could maintain a table (timestamp, merkleRootUpdate)\n event TreeUpdated(bytes32 merkleRoot, bytes32 ipfsHash, uint48 endOfDisputePeriod);\n event TrustedToggled(address indexed eoa, bool trust);\n\n // ================================= MODIFIERS =================================\n\n /// @notice Checks whether the `msg.sender` has the governor role or the guardian role\n modifier onlyGovernorOrGuardian() {\n if (!core.isGovernorOrGuardian(msg.sender)) revert NotGovernorOrGuardian();\n _;\n }\n\n /// @notice Checks whether the `msg.sender` is the `user` address or is a trusted address\n modifier onlyTrustedOrUser(address user) {\n if (user != msg.sender && canUpdateMerkleRoot[msg.sender] != 1 && !core.isGovernorOrGuardian(msg.sender))\n revert NotTrusted();\n _;\n }\n\n // ================================ CONSTRUCTOR ================================\n\n constructor() initializer {}\n\n function initialize(ICore _core) external initializer {\n if (address(_core) == address(0)) revert ZeroAddress();\n core = _core;\n }\n\n /// @inheritdoc UUPSUpgradeable\n function _authorizeUpgrade(address) internal view override onlyGuardianUpgrader(core) {}\n\n // =============================== MAIN FUNCTION ===============================\n\n /// @notice Claims rewards for a given set of users\n /// @dev Anyone may call this function for anyone else, funds go to destination regardless, it's just a question of\n /// who provides the proof and pays the gas: `msg.sender` is used only for addresses that require a trusted operator\n /// @param users Recipient of tokens\n /// @param tokens ERC20 claimed\n /// @param amounts Amount of tokens that will be sent to the corresponding users\n /// @param proofs Array of hashes bridging from a leaf `(hash of user | token | amount)` to the Merkle root\n function claim(\n address[] calldata users,\n address[] calldata tokens,\n uint256[] calldata amounts,\n bytes32[][] calldata proofs\n ) external {\n uint256 usersLength = users.length;\n if (\n usersLength == 0 ||\n usersLength != tokens.length ||\n usersLength != amounts.length ||\n usersLength != proofs.length\n ) revert InvalidLengths();\n\n for (uint256 i; i < usersLength; ) {\n address user = users[i];\n address token = tokens[i];\n uint256 amount = amounts[i];\n\n // Checking if only an approved operator can claim for `user`\n if (onlyOperatorCanClaim[user] == 1 && operators[user][msg.sender] == 0) revert NotWhitelisted();\n\n // Verifying proof\n bytes32 leaf = keccak256(abi.encode(user, token, amount));\n if (!_verifyProof(leaf, proofs[i])) revert InvalidProof();\n\n // Closing reentrancy gate here\n uint256 toSend = amount - claimed[user][token].amount;\n claimed[user][token] = Claim(SafeCast.toUint208(amount), uint48(block.timestamp), getMerkleRoot());\n\n IERC20(token).safeTransfer(user, toSend);\n emit Claimed(user, token, toSend);\n unchecked {\n ++i;\n }\n }\n }\n\n /// @notice Returns the MerkleRoot that is currently live for the contract\n function getMerkleRoot() public view returns (bytes32) {\n if (block.timestamp >= endOfDisputePeriod && disputer == address(0)) return tree.merkleRoot;\n else return lastTree.merkleRoot;\n }\n\n // ============================ GOVERNANCE FUNCTIONS ===========================\n\n /// @notice Adds or removes EOAs which are trusted to update the Merkle root\n function toggleTrusted(address eoa) external onlyGovernorOrGuardian {\n uint256 trustedStatus = 1 - canUpdateMerkleRoot[eoa];\n canUpdateMerkleRoot[eoa] = trustedStatus;\n emit TrustedToggled(eoa, trustedStatus == 1);\n }\n\n /// @notice Updates Merkle Tree\n function updateTree(MerkleTree calldata _tree) external {\n if (\n disputer != address(0) ||\n // A trusted address cannot update a tree right after a precedent tree update otherwise it can de facto\n // validate a tree which has not passed the dispute period\n ((canUpdateMerkleRoot[msg.sender] != 1 || block.timestamp < endOfDisputePeriod) &&\n !core.isGovernorOrGuardian(msg.sender))\n ) revert NotTrusted();\n MerkleTree memory _lastTree = tree;\n tree = _tree;\n lastTree = _lastTree;\n\n uint48 _endOfPeriod = _endOfDisputePeriod(uint48(block.timestamp));\n endOfDisputePeriod = _endOfPeriod;\n emit TreeUpdated(_tree.merkleRoot, _tree.ipfsHash, _endOfPeriod);\n }\n\n /// @notice Freezes the Merkle tree update until the dispute is resolved\n /// @dev Requires a deposit of `disputeToken` that'll be slashed if the dispute is not accepted\n /// @dev It is only possible to create a dispute within `disputePeriod` after each tree update\n function disputeTree(string memory reason) external {\n if (disputer != address(0)) revert UnresolvedDispute();\n if (block.timestamp >= endOfDisputePeriod) revert InvalidDispute();\n IERC20(disputeToken).safeTransferFrom(msg.sender, address(this), disputeAmount);\n disputer = msg.sender;\n emit Disputed(reason);\n }\n\n /// @notice Resolve the ongoing dispute, if any\n /// @param valid Whether the dispute was valid\n function resolveDispute(bool valid) external onlyGovernorOrGuardian {\n if (disputer == address(0)) revert NoDispute();\n if (valid) {\n IERC20(disputeToken).safeTransfer(disputer, disputeAmount);\n // If a dispute is valid, the contract falls back to the last tree that was updated\n _revokeTree();\n } else {\n IERC20(disputeToken).safeTransfer(msg.sender, disputeAmount);\n endOfDisputePeriod = _endOfDisputePeriod(uint48(block.timestamp));\n }\n disputer = address(0);\n emit DisputeResolved(valid);\n }\n\n /// @notice Allows the governor or the guardian of this contract to fallback to the last version of the tree\n /// immediately\n function revokeTree() external onlyGovernorOrGuardian {\n if (disputer != address(0)) revert UnresolvedDispute();\n _revokeTree();\n }\n\n /// @notice Toggles permissioned claiming for a given user\n function toggleOnlyOperatorCanClaim(address user) external onlyTrustedOrUser(user) {\n uint256 oldValue = onlyOperatorCanClaim[user];\n onlyOperatorCanClaim[user] = 1 - oldValue;\n emit OperatorClaimingToggled(user, oldValue == 0);\n }\n\n /// @notice Toggles whitelisting for a given user and a given operator\n function toggleOperator(address user, address operator) external onlyTrustedOrUser(user) {\n uint256 oldValue = operators[user][operator];\n operators[user][operator] = 1 - oldValue;\n emit OperatorToggled(user, operator, oldValue == 0);\n }\n\n /// @notice Recovers any ERC20 token\n function recoverERC20(address tokenAddress, address to, uint256 amountToRecover) external onlyGovernorOrGuardian {\n IERC20(tokenAddress).safeTransfer(to, amountToRecover);\n emit Recovered(tokenAddress, to, amountToRecover);\n }\n\n /// @notice Sets the dispute period after which a tree update becomes effective\n function setDisputePeriod(uint48 _disputePeriod) external onlyGovernorOrGuardian {\n disputePeriod = uint48(_disputePeriod);\n emit DisputePeriodUpdated(_disputePeriod);\n }\n\n /// @notice Sets the token used as a caution during disputes\n function setDisputeToken(IERC20 _disputeToken) external onlyGovernorOrGuardian {\n if (disputer != address(0)) revert UnresolvedDispute();\n disputeToken = _disputeToken;\n emit DisputeTokenUpdated(address(_disputeToken));\n }\n\n /// @notice Sets the amount of `disputeToken` used as a caution during disputes\n function setDisputeAmount(uint256 _disputeAmount) external onlyGovernorOrGuardian {\n if (disputer != address(0)) revert UnresolvedDispute();\n disputeAmount = _disputeAmount;\n emit DisputeAmountUpdated(_disputeAmount);\n }\n\n // ============================= INTERNAL FUNCTIONS ============================\n\n /// @notice Fallback to the last version of the tree\n function _revokeTree() internal {\n MerkleTree memory _tree = lastTree;\n endOfDisputePeriod = 0;\n tree = _tree;\n emit Revoked();\n emit TreeUpdated(\n _tree.merkleRoot,\n _tree.ipfsHash,\n (uint48(block.timestamp) / _EPOCH_DURATION) * (_EPOCH_DURATION) // Last hour\n );\n }\n\n /// @notice Returns the end of the dispute period\n /// @dev treeUpdate is rounded up to next hour and then `disputePeriod` hours are added\n function _endOfDisputePeriod(uint48 treeUpdate) internal view returns (uint48) {\n return ((treeUpdate - 1) / _EPOCH_DURATION + 1 + disputePeriod) * (_EPOCH_DURATION);\n }\n\n /// @notice Checks the validity of a proof\n /// @param leaf Hashed leaf data, the starting point of the proof\n /// @param proof Array of hashes forming a hash chain from leaf to root\n /// @return true If proof is correct, else false\n function _verifyProof(bytes32 leaf, bytes32[] memory proof) internal view returns (bool) {\n bytes32 currentHash = leaf;\n uint256 proofLength = proof.length;\n for (uint256 i; i < proofLength; ) {\n if (currentHash < proof[i]) {\n currentHash = keccak256(abi.encode(currentHash, proof[i]));\n } else {\n currentHash = keccak256(abi.encode(proof[i], currentHash));\n }\n unchecked {\n ++i;\n }\n }\n bytes32 root = getMerkleRoot();\n if (root == bytes32(0)) revert InvalidUninitializedRoot();\n return currentHash == root;\n }\n}\n" + }, + "contracts/interfaces/external/uniswap/IUniswapV3Pool.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity >=0.5.0;\n\n/// @title Pool state that never changes\n/// @notice These parameters are fixed for a pool forever, i.e., the methods will always return the same values\ninterface IUniswapV3Pool {\n /// @notice The first of the two tokens of the pool, sorted by address\n /// @return The token contract address\n function token0() external view returns (address);\n\n /// @notice The second of the two tokens of the pool, sorted by address\n /// @return The token contract address\n function token1() external view returns (address);\n\n /// @notice The pool's fee in hundredths of a bip, i.e. 1e-6\n /// @return The fee\n function fee() external view returns (uint24);\n}\n" + }, + "contracts/interfaces/IAgToken.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport { IERC20Upgradeable } from \"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\";\n\n/// @title IAgToken\n/// @author Angle Core Team\n/// @notice Interface for the stablecoins `AgToken` contracts\n/// @dev This interface only contains functions of the `AgToken` contract which are called by other contracts\n/// of this module or of the first module of the Angle Protocol\ninterface IAgToken is IERC20Upgradeable {\n // ======================= Minter Role Only Functions ===========================\n\n /// @notice Lets the `StableMaster` contract or another whitelisted contract mint agTokens\n /// @param account Address to mint to\n /// @param amount Amount to mint\n /// @dev The contracts allowed to issue agTokens are the `StableMaster` contract, `VaultManager` contracts\n /// associated to this stablecoin as well as the flash loan module (if activated) and potentially contracts\n /// whitelisted by governance\n function mint(address account, uint256 amount) external;\n\n /// @notice Burns `amount` tokens from a `burner` address after being asked to by `sender`\n /// @param amount Amount of tokens to burn\n /// @param burner Address to burn from\n /// @param sender Address which requested the burn from `burner`\n /// @dev This method is to be called by a contract with the minter right after being requested\n /// to do so by a `sender` address willing to burn tokens from another `burner` address\n /// @dev The method checks the allowance between the `sender` and the `burner`\n function burnFrom(uint256 amount, address burner, address sender) external;\n\n /// @notice Burns `amount` tokens from a `burner` address\n /// @param amount Amount of tokens to burn\n /// @param burner Address to burn from\n /// @dev This method is to be called by a contract with a minter right on the AgToken after being\n /// requested to do so by an address willing to burn tokens from its address\n function burnSelf(uint256 amount, address burner) external;\n\n // ========================= Treasury Only Functions ===========================\n\n /// @notice Adds a minter in the contract\n /// @param minter Minter address to add\n /// @dev Zero address checks are performed directly in the `Treasury` contract\n function addMinter(address minter) external;\n\n /// @notice Removes a minter from the contract\n /// @param minter Minter address to remove\n /// @dev This function can also be called by a minter wishing to revoke itself\n function removeMinter(address minter) external;\n\n /// @notice Sets a new treasury contract\n /// @param _treasury New treasury address\n function setTreasury(address _treasury) external;\n\n // ========================= External functions ================================\n\n /// @notice Checks whether an address has the right to mint agTokens\n /// @param minter Address for which the minting right should be checked\n /// @return Whether the address has the right to mint agTokens or not\n function isMinter(address minter) external view returns (bool);\n}\n" + }, + "contracts/interfaces/ICore.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\n/// @title ICore\n/// @author Angle Labs, Inc.\n/// @notice Interface for the `Core` contracts of smart contract modules used in Angle Labs contracts\ninterface ICore {\n /// @notice Checks whether an address is governor\n /// @param admin Address to check\n /// @return Whether the address has the `GOVERNOR_ROLE` or not\n function isGovernor(address admin) external view returns (bool);\n\n /// @notice Checks whether an address is a governor or a guardian of a module\n /// @param admin Address to check\n /// @return Whether the address has the `GUARDIAN_ROLE` or not\n /// @dev Governance should make sure when adding a governor to also give this governor the guardian\n /// role by calling the `addGovernor` function\n function isGovernorOrGuardian(address admin) external view returns (bool);\n}\n" + }, + "contracts/interfaces/ITreasury.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport { IAgToken } from \"./IAgToken.sol\";\nimport { ICore } from \"./ICore.sol\";\n\n/// @title ITreasury\n/// @author Angle Core Team\n/// @notice Interface for the `Treasury` contract\n/// @dev This interface only contains functions of the `Treasury` which are called by other contracts\n/// of this module\ninterface ITreasury {\n /// @notice Stablecoin handled by this `treasury` contract\n function stablecoin() external view returns (IAgToken);\n\n /// @notice Checks whether a given address has the governor role\n /// @param admin Address to check\n /// @return Whether the address has the governor role\n /// @dev Access control is only kept in the `CoreBorrow` contract\n function isGovernor(address admin) external view returns (bool);\n\n /// @notice Checks whether a given address has the guardian or the governor role\n /// @param admin Address to check\n /// @return Whether the address has the guardian or the governor role\n /// @dev Access control is only kept in the `CoreBorrow` contract which means that this function\n /// queries the `CoreBorrow` contract\n function isGovernorOrGuardian(address admin) external view returns (bool);\n}\n" + }, + "contracts/middleman/MerklGaugeMiddleman.sol": { + "content": "// SPDX-License-Identifier: BUSL-1.1\n\n/*\n * █ \n ***** ▓▓▓ \n * ▓▓▓▓▓▓▓ \n * ///. ▓▓▓▓▓▓▓▓▓▓▓▓▓ \n ***** //////// ▓▓▓▓▓▓▓ \n * ///////////// ▓▓▓ \n ▓▓ ////////////////// █ ▓▓ \n ▓▓ ▓▓ /////////////////////// ▓▓ ▓▓ \n ▓▓ ▓▓ //////////////////////////// ▓▓ ▓▓ \n ▓▓ ▓▓ /////////▓▓▓///////▓▓▓///////// ▓▓ ▓▓ \n ▓▓ ,////////////////////////////////////// ▓▓ ▓▓ \n ▓▓ ////////////////////////////////////////// ▓▓ \n ▓▓ //////////////////////▓▓▓▓///////////////////// \n ,//////////////////////////////////////////////////// \n .////////////////////////////////////////////////////////// \n .//////////////////////////██.,//////////////////////////█ \n .//////////////////////████..,./////////////////////██ \n ...////////////////███████.....,.////////////////███ \n ,.,////////////████████ ........,///////////████ \n .,.,//////█████████ ,.......///////████ \n ,..//████████ ........./████ \n ..,██████ .....,███ \n .██ ,.,█ \n \n \n \n ▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓ ▓▓▓▓▓▓▓▓▓▓ \n ▓▓▓▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓ ▓▓ ▓▓▓▓ \n ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓ ▓▓▓▓▓ \n ▓▓▓ ▓▓ ▓▓▓ ▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ \n*/\n\npragma solidity ^0.8.17;\n\nimport { IERC20 } from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport { SafeERC20 } from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\n\nimport \"../DistributionCreator.sol\";\n\n/// @title MerklGaugeMiddleman\n/// @author Angle Labs, Inc.\n/// @notice Manages the transfer of ANGLE rewards to the `DistributionCreator` contract\n/// @dev This contract is built under the assumption that the `DistributionCreator` contract has already whitelisted\n/// this contract for it to distribute rewards without having to sign a message\n/// @dev Transient funds left in this contract after a call may be exploited\ncontract MerklGaugeMiddleman {\n using SafeERC20 for IERC20;\n\n // ================================= PARAMETERS ================================\n\n /// @notice Contract handling access control\n ICore public accessControlManager;\n\n /// @notice Maps a gauge to its reward parameters\n mapping(address => DistributionParameters) public gaugeParams;\n\n // =================================== EVENT ===================================\n\n event GaugeSet(address indexed gauge);\n\n constructor(ICore _accessControlManager) {\n if (address(_accessControlManager) == address(0)) revert ZeroAddress();\n accessControlManager = _accessControlManager;\n IERC20 _angle = angle();\n // Condition left here for testing purposes\n if (address(_angle) != address(0))\n _angle.safeIncreaseAllowance(address(merklDistributionCreator()), type(uint256).max);\n }\n\n // ================================= REFERENCES ================================\n\n /// @notice Address of the ANGLE token\n function angle() public view virtual returns (IERC20) {\n return IERC20(0x31429d1856aD1377A8A0079410B297e1a9e214c2);\n }\n\n /// @notice Address of the Merkl contract managing rewards to be distributed\n /// @dev Address is the same across the different chains on which it is deployed\n function merklDistributionCreator() public view virtual returns (DistributionCreator) {\n return DistributionCreator(0x8BB4C975Ff3c250e0ceEA271728547f3802B36Fd);\n }\n\n // ============================= EXTERNAL FUNCTIONS ============================\n\n /// @notice Restores the allowance for the ANGLE token to the `DistributionCreator` contract\n function setAngleAllowance() external {\n IERC20 _angle = angle();\n address manager = address(merklDistributionCreator());\n uint256 currentAllowance = _angle.allowance(address(this), manager);\n if (currentAllowance < type(uint256).max)\n _angle.safeIncreaseAllowance(manager, type(uint256).max - currentAllowance);\n }\n\n /// @notice Specifies the reward distribution parameters for `gauge`\n function setGauge(address gauge, DistributionParameters memory params) external {\n if (!accessControlManager.isGovernorOrGuardian(msg.sender)) revert NotGovernorOrGuardian();\n DistributionCreator manager = merklDistributionCreator();\n if (\n gauge == address(0) ||\n params.rewardToken != address(angle()) ||\n (manager.isWhitelistedToken(IUniswapV3Pool(params.uniV3Pool).token0()) == 0 &&\n manager.isWhitelistedToken(IUniswapV3Pool(params.uniV3Pool).token1()) == 0)\n ) revert InvalidParams();\n gaugeParams[gauge] = params;\n emit GaugeSet(gauge);\n }\n\n /// @notice Transmits rewards from the `AngleDistributor` to the `DistributionCreator` with the correct\n /// parameters\n /// @dev Callable by any contract\n /// @dev This method can be used to recover leftover ANGLE tokens in the contract\n function notifyReward(address gauge, uint256 amount) public {\n DistributionParameters memory params = gaugeParams[gauge];\n if (params.uniV3Pool == address(0)) revert InvalidParams();\n if (amount == 0) amount = angle().balanceOf(address(this));\n params.epochStart = uint32(block.timestamp);\n params.amount = amount;\n DistributionCreator creator = merklDistributionCreator();\n if (amount > 0) {\n // Need to deal with minimum distribution amounts\n if (amount > creator.rewardTokenMinAmounts(address(angle())) * params.numEpoch) {\n merklDistributionCreator().createDistribution(params);\n } else {\n // Sending leftover ANGLE tokens to the `msg.sender`\n angle().safeTransfer(msg.sender, amount);\n }\n }\n }\n\n /// @notice Fetches tokens and transmits rewards in the same transaction\n function notifyRewardWithTransfer(address gauge, uint256 amount) external {\n angle().safeTransferFrom(msg.sender, address(this), amount);\n notifyReward(gauge, amount);\n }\n}\n" + }, + "contracts/middleman/MerklGaugeMiddlemanPolygon.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"./MerklGaugeMiddleman.sol\";\n\n/// @title MerklGaugeMiddlemanPolygon\n/// @author Angle Labs, Inc.\ncontract MerklGaugeMiddlemanPolygon is MerklGaugeMiddleman {\n constructor(ICore _accessControlManager) MerklGaugeMiddleman(_accessControlManager) {}\n\n function angle() public pure override returns (IERC20) {\n return IERC20(0x900F717EA076E1E7a484ad9DD2dB81CEEc60eBF1);\n }\n}\n" + }, + "contracts/mock/MockMerklGaugeMiddleman.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"../middleman/MerklGaugeMiddleman.sol\";\n\ncontract MockMerklGaugeMiddleman is MerklGaugeMiddleman {\n address public angleDistributorAddress;\n IERC20 public angleAddress;\n DistributionCreator public manager;\n\n constructor(ICore _coreBorrow) MerklGaugeMiddleman(_coreBorrow) {}\n\n function angle() public view override returns (IERC20) {\n return angleAddress;\n }\n\n function merklDistributionCreator() public view override returns (DistributionCreator) {\n return manager;\n }\n\n function setAddresses(\n address _angleDistributorAddress,\n IERC20 _angleAddress,\n DistributionCreator _manager\n ) external {\n angleDistributorAddress = _angleDistributorAddress;\n angleAddress = _angleAddress;\n manager = _manager;\n }\n}\n" + }, + "contracts/struct/DistributionParameters.sol": { + "content": "// SPDX-License-Identifier: BUSL-1.1\n\npragma solidity ^0.8.17;\n\nstruct DistributionParameters {\n // ID of the reward (populated once created)\n bytes32 rewardId;\n // Address of the UniswapV3 pool that needs to be incentivized\n address uniV3Pool;\n // Address of the reward token for the incentives\n address rewardToken;\n // Amount of `rewardToken` to distribute across all the epochs\n // Amount distributed per epoch is `amount/numEpoch`\n uint256 amount;\n // List of all position wrappers to consider or not for this contract. Some wrappers like Gamma or Arrakis\n // are automatically detected and so there is no need to specify them here. Check out the docs to find out\n // which need to be specified and which are not automatically detected.\n address[] positionWrappers;\n // Type (Arrakis, Gamma, Blacklist, ...) encoded as a `uint32` for each wrapper in the list above. Mapping between\n // wrapper types and their corresponding `uint32` value can be found in Angle Docs\n uint32[] wrapperTypes;\n // In the incentivization formula, how much of the fees should go to holders of token0\n // in base 10**4\n uint32 propToken0;\n // Proportion for holding token1 (in base 10**4)\n uint32 propToken1;\n // Proportion for providing a useful liquidity (in base 10**4) that generates fees\n uint32 propFees;\n // Timestamp at which the incentivization should start\n uint32 epochStart;\n // Amount of epochs for which incentivization should last\n uint32 numEpoch;\n // Whether out of range liquidity should still be incentivized or not\n // This should be equal to 1 if out of range liquidity should still be incentivized\n // and 0 otherwise\n uint32 isOutOfRangeIncentivized;\n // How much more addresses with a maximum boost can get with respect to addresses\n // which do not have a boost (in base 4). In the case of Curve where addresses get 2.5x more\n // this would be 25000\n uint32 boostedReward;\n // Address of the token which dictates who gets boosted rewards or not. This is optional\n // and if the zero address is given no boost will be taken into account\n address boostingAddress;\n // Additional data passed when distributing rewards. This parameter may be used in case\n // the reward distribution script needs to look into other parameters beyond the ones above.\n bytes additionalData;\n}\n" + }, + "contracts/struct/ExtensiveDistributionParameters.sol": { + "content": "// SPDX-License-Identifier: BUSL-1.1\n\npragma solidity ^0.8.17;\n\nimport { DistributionParameters } from \"./DistributionParameters.sol\";\n\nstruct UniswapTokenData {\n address add;\n uint8 decimals;\n string symbol;\n uint256 poolBalance;\n}\n\nstruct ExtensiveDistributionParameters {\n DistributionParameters base;\n // Uniswap pool data\n uint24 poolFee;\n UniswapTokenData token0;\n UniswapTokenData token1;\n // rewardToken data\n string rewardTokenSymbol;\n uint8 rewardTokenDecimals;\n}\n" + }, + "contracts/struct/RewardTokenAmounts.sol": { + "content": "// SPDX-License-Identifier: BUSL-1.1\n\npragma solidity ^0.8.17;\n\nstruct RewardTokenAmounts {\n address token;\n uint256 minimumAmountPerEpoch;\n}\n" + }, + "contracts/utils/Errors.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nerror InvalidDispute();\nerror InvalidLengths();\nerror InvalidParam();\nerror InvalidParams();\nerror InvalidProof();\nerror InvalidUninitializedRoot();\nerror InvalidReward();\nerror InvalidSignature();\nerror NoDispute();\nerror NotGovernor();\nerror NotGovernorOrGuardian();\nerror NotSigned();\nerror NotTrusted();\nerror NotWhitelisted();\nerror UnresolvedDispute();\nerror ZeroAddress();\n" + }, + "contracts/utils/UUPSHelper.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\n/*\n * █ \n ***** ▓▓▓ \n * ▓▓▓▓▓▓▓ \n * ///. ▓▓▓▓▓▓▓▓▓▓▓▓▓ \n ***** //////// ▓▓▓▓▓▓▓ \n * ///////////// ▓▓▓ \n ▓▓ ////////////////// █ ▓▓ \n ▓▓ ▓▓ /////////////////////// ▓▓ ▓▓ \n ▓▓ ▓▓ //////////////////////////// ▓▓ ▓▓ \n ▓▓ ▓▓ /////////▓▓▓///////▓▓▓///////// ▓▓ ▓▓ \n ▓▓ ,////////////////////////////////////// ▓▓ ▓▓ \n ▓▓ ////////////////////////////////////////// ▓▓ \n ▓▓ //////////////////////▓▓▓▓///////////////////// \n ,//////////////////////////////////////////////////// \n .////////////////////////////////////////////////////////// \n .//////////////////////////██.,//////////////////////////█ \n .//////////////////////████..,./////////////////////██ \n ...////////////////███████.....,.////////////////███ \n ,.,////////////████████ ........,///////////████ \n .,.,//////█████████ ,.......///////████ \n ,..//████████ ........./████ \n ..,██████ .....,███ \n .██ ,.,█ \n \n \n \n ▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓ ▓▓▓▓▓▓▓▓▓▓ \n ▓▓▓▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓ ▓▓ ▓▓▓▓ \n ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓ ▓▓▓▓▓ \n ▓▓▓ ▓▓ ▓▓▓ ▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ \n*/\n\npragma solidity ^0.8.17;\n\nimport { UUPSUpgradeable } from \"@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol\";\n\nimport { ICore } from \"../interfaces/ICore.sol\";\nimport \"../utils/Errors.sol\";\n\n/// @title UUPSHelper\n/// @notice Helper contract for UUPSUpgradeable contracts where the upgradeability is controlled by a specific address\n/// @author Angle Labs., Inc\n/// @dev The 0 address check in the modifier allows the use of these modifiers during initialization\nabstract contract UUPSHelper is UUPSUpgradeable {\n modifier onlyGuardianUpgrader(ICore _core) {\n if (address(_core) != address(0) && !_core.isGovernorOrGuardian(msg.sender)) revert NotGovernorOrGuardian();\n _;\n }\n\n modifier onlyGovernorUpgrader(ICore _core) {\n if (address(_core) != address(0) && !_core.isGovernor(msg.sender)) revert NotGovernor();\n _;\n }\n\n constructor() initializer {}\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 100000 + }, + "viaIR": false, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + } + } +} \ No newline at end of file diff --git a/deployments/thundercore/solcInputs/69984a2380fa2fad0c3afbbb08b5652b.json b/deployments/thundercore/solcInputs/69984a2380fa2fad0c3afbbb08b5652b.json new file mode 100644 index 0000000..a42b1be --- /dev/null +++ b/deployments/thundercore/solcInputs/69984a2380fa2fad0c3afbbb08b5652b.json @@ -0,0 +1,98 @@ +{ + "language": "Solidity", + "sources": { + "@openzeppelin/contracts-upgradeable/interfaces/draft-IERC1822Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\n * proxy whose upgrades are fully controlled by the current implementation.\n */\ninterface IERC1822ProxiableUpgradeable {\n /**\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\n * address.\n *\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\n * function revert if invoked through a proxy.\n */\n function proxiableUUID() external view returns (bytes32);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/proxy/beacon/IBeaconUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\n */\ninterface IBeaconUpgradeable {\n /**\n * @dev Must return an address that can be used as a delegate call target.\n *\n * {BeaconProxy} will check that this address is a contract.\n */\n function implementation() external view returns (address);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/proxy/ERC1967/ERC1967UpgradeUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (proxy/ERC1967/ERC1967Upgrade.sol)\n\npragma solidity ^0.8.2;\n\nimport \"../beacon/IBeaconUpgradeable.sol\";\nimport \"../../interfaces/draft-IERC1822Upgradeable.sol\";\nimport \"../../utils/AddressUpgradeable.sol\";\nimport \"../../utils/StorageSlotUpgradeable.sol\";\nimport \"../utils/Initializable.sol\";\n\n/**\n * @dev This abstract contract provides getters and event emitting update functions for\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\n *\n * _Available since v4.1._\n *\n * @custom:oz-upgrades-unsafe-allow delegatecall\n */\nabstract contract ERC1967UpgradeUpgradeable is Initializable {\n function __ERC1967Upgrade_init() internal onlyInitializing {\n }\n\n function __ERC1967Upgrade_init_unchained() internal onlyInitializing {\n }\n // This is the keccak-256 hash of \"eip1967.proxy.rollback\" subtracted by 1\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\n\n /**\n * @dev Storage slot with the address of the current implementation.\n * This is the keccak-256 hash of \"eip1967.proxy.implementation\" subtracted by 1, and is\n * validated in the constructor.\n */\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n\n /**\n * @dev Emitted when the implementation is upgraded.\n */\n event Upgraded(address indexed implementation);\n\n /**\n * @dev Returns the current implementation address.\n */\n function _getImplementation() internal view returns (address) {\n return StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value;\n }\n\n /**\n * @dev Stores a new address in the EIP1967 implementation slot.\n */\n function _setImplementation(address newImplementation) private {\n require(AddressUpgradeable.isContract(newImplementation), \"ERC1967: new implementation is not a contract\");\n StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\n }\n\n /**\n * @dev Perform implementation upgrade\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeTo(address newImplementation) internal {\n _setImplementation(newImplementation);\n emit Upgraded(newImplementation);\n }\n\n /**\n * @dev Perform implementation upgrade with additional setup call.\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeToAndCall(\n address newImplementation,\n bytes memory data,\n bool forceCall\n ) internal {\n _upgradeTo(newImplementation);\n if (data.length > 0 || forceCall) {\n _functionDelegateCall(newImplementation, data);\n }\n }\n\n /**\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeToAndCallUUPS(\n address newImplementation,\n bytes memory data,\n bool forceCall\n ) internal {\n // Upgrades from old implementations will perform a rollback test. This test requires the new\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\n // this special case will break upgrade paths from old UUPS implementation to new ones.\n if (StorageSlotUpgradeable.getBooleanSlot(_ROLLBACK_SLOT).value) {\n _setImplementation(newImplementation);\n } else {\n try IERC1822ProxiableUpgradeable(newImplementation).proxiableUUID() returns (bytes32 slot) {\n require(slot == _IMPLEMENTATION_SLOT, \"ERC1967Upgrade: unsupported proxiableUUID\");\n } catch {\n revert(\"ERC1967Upgrade: new implementation is not UUPS\");\n }\n _upgradeToAndCall(newImplementation, data, forceCall);\n }\n }\n\n /**\n * @dev Storage slot with the admin of the contract.\n * This is the keccak-256 hash of \"eip1967.proxy.admin\" subtracted by 1, and is\n * validated in the constructor.\n */\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\n\n /**\n * @dev Emitted when the admin account has changed.\n */\n event AdminChanged(address previousAdmin, address newAdmin);\n\n /**\n * @dev Returns the current admin.\n */\n function _getAdmin() internal view returns (address) {\n return StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value;\n }\n\n /**\n * @dev Stores a new address in the EIP1967 admin slot.\n */\n function _setAdmin(address newAdmin) private {\n require(newAdmin != address(0), \"ERC1967: new admin is the zero address\");\n StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\n }\n\n /**\n * @dev Changes the admin of the proxy.\n *\n * Emits an {AdminChanged} event.\n */\n function _changeAdmin(address newAdmin) internal {\n emit AdminChanged(_getAdmin(), newAdmin);\n _setAdmin(newAdmin);\n }\n\n /**\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\n */\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\n\n /**\n * @dev Emitted when the beacon is upgraded.\n */\n event BeaconUpgraded(address indexed beacon);\n\n /**\n * @dev Returns the current beacon.\n */\n function _getBeacon() internal view returns (address) {\n return StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value;\n }\n\n /**\n * @dev Stores a new beacon in the EIP1967 beacon slot.\n */\n function _setBeacon(address newBeacon) private {\n require(AddressUpgradeable.isContract(newBeacon), \"ERC1967: new beacon is not a contract\");\n require(\n AddressUpgradeable.isContract(IBeaconUpgradeable(newBeacon).implementation()),\n \"ERC1967: beacon implementation is not a contract\"\n );\n StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value = newBeacon;\n }\n\n /**\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\n *\n * Emits a {BeaconUpgraded} event.\n */\n function _upgradeBeaconToAndCall(\n address newBeacon,\n bytes memory data,\n bool forceCall\n ) internal {\n _setBeacon(newBeacon);\n emit BeaconUpgraded(newBeacon);\n if (data.length > 0 || forceCall) {\n _functionDelegateCall(IBeaconUpgradeable(newBeacon).implementation(), data);\n }\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function _functionDelegateCall(address target, bytes memory data) private returns (bytes memory) {\n require(AddressUpgradeable.isContract(target), \"Address: delegate call to non-contract\");\n\n // solhint-disable-next-line avoid-low-level-calls\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return AddressUpgradeable.verifyCallResult(success, returndata, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.1) (proxy/utils/Initializable.sol)\n\npragma solidity ^0.8.2;\n\nimport \"../../utils/AddressUpgradeable.sol\";\n\n/**\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\n *\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\n * reused. This mechanism prevents re-execution of each \"step\" but allows the creation of new initialization steps in\n * case an upgrade adds a module that needs to be initialized.\n *\n * For example:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * contract MyToken is ERC20Upgradeable {\n * function initialize() initializer public {\n * __ERC20_init(\"MyToken\", \"MTK\");\n * }\n * }\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\n * function initializeV2() reinitializer(2) public {\n * __ERC20Permit_init(\"MyToken\");\n * }\n * }\n * ```\n *\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\n *\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\n *\n * [CAUTION]\n * ====\n * Avoid leaving a contract uninitialized.\n *\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * /// @custom:oz-upgrades-unsafe-allow constructor\n * constructor() {\n * _disableInitializers();\n * }\n * ```\n * ====\n */\nabstract contract Initializable {\n /**\n * @dev Indicates that the contract has been initialized.\n * @custom:oz-retyped-from bool\n */\n uint8 private _initialized;\n\n /**\n * @dev Indicates that the contract is in the process of being initialized.\n */\n bool private _initializing;\n\n /**\n * @dev Triggered when the contract has been initialized or reinitialized.\n */\n event Initialized(uint8 version);\n\n /**\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\n * `onlyInitializing` functions can be used to initialize parent contracts.\n *\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\n * constructor.\n *\n * Emits an {Initialized} event.\n */\n modifier initializer() {\n bool isTopLevelCall = !_initializing;\n require(\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\n \"Initializable: contract is already initialized\"\n );\n _initialized = 1;\n if (isTopLevelCall) {\n _initializing = true;\n }\n _;\n if (isTopLevelCall) {\n _initializing = false;\n emit Initialized(1);\n }\n }\n\n /**\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\n * used to initialize parent contracts.\n *\n * A reinitializer may be used after the original initialization step. This is essential to configure modules that\n * are added through upgrades and that require initialization.\n *\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\n * cannot be nested. If one is invoked in the context of another, execution will revert.\n *\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\n * a contract, executing them in the right order is up to the developer or operator.\n *\n * WARNING: setting the version to 255 will prevent any future reinitialization.\n *\n * Emits an {Initialized} event.\n */\n modifier reinitializer(uint8 version) {\n require(!_initializing && _initialized < version, \"Initializable: contract is already initialized\");\n _initialized = version;\n _initializing = true;\n _;\n _initializing = false;\n emit Initialized(version);\n }\n\n /**\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\n */\n modifier onlyInitializing() {\n require(_initializing, \"Initializable: contract is not initializing\");\n _;\n }\n\n /**\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\n * through proxies.\n *\n * Emits an {Initialized} event the first time it is successfully executed.\n */\n function _disableInitializers() internal virtual {\n require(!_initializing, \"Initializable: contract is initializing\");\n if (_initialized < type(uint8).max) {\n _initialized = type(uint8).max;\n emit Initialized(type(uint8).max);\n }\n }\n\n /**\n * @dev Returns the highest version that has been initialized. See {reinitializer}.\n */\n function _getInitializedVersion() internal view returns (uint8) {\n return _initialized;\n }\n\n /**\n * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.\n */\n function _isInitializing() internal view returns (bool) {\n return _initializing;\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (proxy/utils/UUPSUpgradeable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../interfaces/draft-IERC1822Upgradeable.sol\";\nimport \"../ERC1967/ERC1967UpgradeUpgradeable.sol\";\nimport \"./Initializable.sol\";\n\n/**\n * @dev An upgradeability mechanism designed for UUPS proxies. The functions included here can perform an upgrade of an\n * {ERC1967Proxy}, when this contract is set as the implementation behind such a proxy.\n *\n * A security mechanism ensures that an upgrade does not turn off upgradeability accidentally, although this risk is\n * reinstated if the upgrade retains upgradeability but removes the security mechanism, e.g. by replacing\n * `UUPSUpgradeable` with a custom implementation of upgrades.\n *\n * The {_authorizeUpgrade} function must be overridden to include access restriction to the upgrade mechanism.\n *\n * _Available since v4.1._\n */\nabstract contract UUPSUpgradeable is Initializable, IERC1822ProxiableUpgradeable, ERC1967UpgradeUpgradeable {\n function __UUPSUpgradeable_init() internal onlyInitializing {\n }\n\n function __UUPSUpgradeable_init_unchained() internal onlyInitializing {\n }\n /// @custom:oz-upgrades-unsafe-allow state-variable-immutable state-variable-assignment\n address private immutable __self = address(this);\n\n /**\n * @dev Check that the execution is being performed through a delegatecall call and that the execution context is\n * a proxy contract with an implementation (as defined in ERC1967) pointing to self. This should only be the case\n * for UUPS and transparent proxies that are using the current contract as their implementation. Execution of a\n * function through ERC1167 minimal proxies (clones) would not normally pass this test, but is not guaranteed to\n * fail.\n */\n modifier onlyProxy() {\n require(address(this) != __self, \"Function must be called through delegatecall\");\n require(_getImplementation() == __self, \"Function must be called through active proxy\");\n _;\n }\n\n /**\n * @dev Check that the execution is not being performed through a delegate call. This allows a function to be\n * callable on the implementing contract but not through proxies.\n */\n modifier notDelegated() {\n require(address(this) == __self, \"UUPSUpgradeable: must not be called through delegatecall\");\n _;\n }\n\n /**\n * @dev Implementation of the ERC1822 {proxiableUUID} function. This returns the storage slot used by the\n * implementation. It is used to validate the implementation's compatibility when performing an upgrade.\n *\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\n * function revert if invoked through a proxy. This is guaranteed by the `notDelegated` modifier.\n */\n function proxiableUUID() external view virtual override notDelegated returns (bytes32) {\n return _IMPLEMENTATION_SLOT;\n }\n\n /**\n * @dev Upgrade the implementation of the proxy to `newImplementation`.\n *\n * Calls {_authorizeUpgrade}.\n *\n * Emits an {Upgraded} event.\n */\n function upgradeTo(address newImplementation) external virtual onlyProxy {\n _authorizeUpgrade(newImplementation);\n _upgradeToAndCallUUPS(newImplementation, new bytes(0), false);\n }\n\n /**\n * @dev Upgrade the implementation of the proxy to `newImplementation`, and subsequently execute the function call\n * encoded in `data`.\n *\n * Calls {_authorizeUpgrade}.\n *\n * Emits an {Upgraded} event.\n */\n function upgradeToAndCall(address newImplementation, bytes memory data) external payable virtual onlyProxy {\n _authorizeUpgrade(newImplementation);\n _upgradeToAndCallUUPS(newImplementation, data, true);\n }\n\n /**\n * @dev Function that should revert when `msg.sender` is not authorized to upgrade the contract. Called by\n * {upgradeTo} and {upgradeToAndCall}.\n *\n * Normally, this function will use an xref:access.adoc[access control] modifier such as {Ownable-onlyOwner}.\n *\n * ```solidity\n * function _authorizeUpgrade(address) internal override onlyOwner {}\n * ```\n */\n function _authorizeUpgrade(address newImplementation) internal virtual;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (security/ReentrancyGuard.sol)\n\npragma solidity ^0.8.0;\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Contract module that helps prevent reentrant calls to a function.\n *\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\n * available, which can be applied to functions to make sure there are no nested\n * (reentrant) calls to them.\n *\n * Note that because there is a single `nonReentrant` guard, functions marked as\n * `nonReentrant` may not call one another. This can be worked around by making\n * those functions `private`, and then adding `external` `nonReentrant` entry\n * points to them.\n *\n * TIP: If you would like to learn more about reentrancy and alternative ways\n * to protect against it, check out our blog post\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\n */\nabstract contract ReentrancyGuardUpgradeable is Initializable {\n // Booleans are more expensive than uint256 or any type that takes up a full\n // word because each write operation emits an extra SLOAD to first read the\n // slot's contents, replace the bits taken up by the boolean, and then write\n // back. This is the compiler's defense against contract upgrades and\n // pointer aliasing, and it cannot be disabled.\n\n // The values being non-zero value makes deployment a bit more expensive,\n // but in exchange the refund on every call to nonReentrant will be lower in\n // amount. Since refunds are capped to a percentage of the total\n // transaction's gas, it is best to keep them low in cases like this one, to\n // increase the likelihood of the full refund coming into effect.\n uint256 private constant _NOT_ENTERED = 1;\n uint256 private constant _ENTERED = 2;\n\n uint256 private _status;\n\n function __ReentrancyGuard_init() internal onlyInitializing {\n __ReentrancyGuard_init_unchained();\n }\n\n function __ReentrancyGuard_init_unchained() internal onlyInitializing {\n _status = _NOT_ENTERED;\n }\n\n /**\n * @dev Prevents a contract from calling itself, directly or indirectly.\n * Calling a `nonReentrant` function from another `nonReentrant`\n * function is not supported. It is possible to prevent this from happening\n * by making the `nonReentrant` function external, and making it call a\n * `private` function that does the actual work.\n */\n modifier nonReentrant() {\n _nonReentrantBefore();\n _;\n _nonReentrantAfter();\n }\n\n function _nonReentrantBefore() private {\n // On the first call to nonReentrant, _status will be _NOT_ENTERED\n require(_status != _ENTERED, \"ReentrancyGuard: reentrant call\");\n\n // Any calls to nonReentrant after this point will fail\n _status = _ENTERED;\n }\n\n function _nonReentrantAfter() private {\n // By storing the original value once again, a refund is triggered (see\n // https://eips.ethereum.org/EIPS/eip-2200)\n _status = _NOT_ENTERED;\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[49] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary AddressUpgradeable {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/StorageSlotUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/StorageSlot.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Library for reading and writing primitive types to specific storage slots.\n *\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\n * This library helps with reading and writing to such slots without the need for inline assembly.\n *\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\n *\n * Example usage to set ERC1967 implementation slot:\n * ```\n * contract ERC1967 {\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n *\n * function _getImplementation() internal view returns (address) {\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\n * }\n *\n * function _setImplementation(address newImplementation) internal {\n * require(Address.isContract(newImplementation), \"ERC1967: new implementation is not a contract\");\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\n * }\n * }\n * ```\n *\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\n */\nlibrary StorageSlotUpgradeable {\n struct AddressSlot {\n address value;\n }\n\n struct BooleanSlot {\n bool value;\n }\n\n struct Bytes32Slot {\n bytes32 value;\n }\n\n struct Uint256Slot {\n uint256 value;\n }\n\n /**\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\n */\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\n */\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\n */\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\n */\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n */\ninterface IERC20Permit {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also apply here.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `deadline` must be a timestamp in the future.\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\n * over the EIP712-formatted function arguments.\n * - the signature must use ``owner``'s current nonce (see {nonces}).\n *\n * For more information on the signature format, see the\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\n * section].\n */\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n\n /**\n * @dev Returns the current nonce for `owner`. This value must be\n * included whenever a signature is generated for {permit}.\n *\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\n * prevents a signature from being used multiple times.\n */\n function nonces(address owner) external view returns (uint256);\n\n /**\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\n */\n // solhint-disable-next-line func-name-mixedcase\n function DOMAIN_SEPARATOR() external view returns (bytes32);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20Metadata is IERC20 {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/IERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\nimport \"../extensions/draft-IERC20Permit.sol\";\nimport \"../../../utils/Address.sol\";\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n using Address for address;\n\n function safeTransfer(\n IERC20 token,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n function safeTransferFrom(\n IERC20 token,\n address from,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\n }\n\n /**\n * @dev Deprecated. This function has issues similar to the ones found in\n * {IERC20-approve}, and its usage is discouraged.\n *\n * Whenever possible, use {safeIncreaseAllowance} and\n * {safeDecreaseAllowance} instead.\n */\n function safeApprove(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n // safeApprove should only be called when setting an initial allowance,\n // or when resetting it to zero. To increase and decrease it, use\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\n require(\n (value == 0) || (token.allowance(address(this), spender) == 0),\n \"SafeERC20: approve from non-zero to non-zero allowance\"\n );\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\n }\n\n function safeIncreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n uint256 newAllowance = token.allowance(address(this), spender) + value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n\n function safeDecreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n unchecked {\n uint256 oldAllowance = token.allowance(address(this), spender);\n require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\n uint256 newAllowance = oldAllowance - value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n }\n\n function safePermit(\n IERC20Permit token,\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal {\n uint256 nonceBefore = token.nonces(owner);\n token.permit(owner, spender, value, deadline, v, r, s);\n uint256 nonceAfter = token.nonces(owner);\n require(nonceAfter == nonceBefore + 1, \"SafeERC20: permit did not succeed\");\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data, \"SafeERC20: low-level call failed\");\n if (returndata.length > 0) {\n // Return data is optional\n require(abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Address.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/cryptography/ECDSA.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/ECDSA.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../Strings.sol\";\n\n/**\n * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.\n *\n * These functions can be used to verify that a message was signed by the holder\n * of the private keys of a given address.\n */\nlibrary ECDSA {\n enum RecoverError {\n NoError,\n InvalidSignature,\n InvalidSignatureLength,\n InvalidSignatureS,\n InvalidSignatureV // Deprecated in v4.8\n }\n\n function _throwError(RecoverError error) private pure {\n if (error == RecoverError.NoError) {\n return; // no error: do nothing\n } else if (error == RecoverError.InvalidSignature) {\n revert(\"ECDSA: invalid signature\");\n } else if (error == RecoverError.InvalidSignatureLength) {\n revert(\"ECDSA: invalid signature length\");\n } else if (error == RecoverError.InvalidSignatureS) {\n revert(\"ECDSA: invalid signature 's' value\");\n }\n }\n\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with\n * `signature` or error string. This address can then be used for verification purposes.\n *\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {toEthSignedMessageHash} on it.\n *\n * Documentation for signature generation:\n * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]\n * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]\n *\n * _Available since v4.3._\n */\n function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {\n if (signature.length == 65) {\n bytes32 r;\n bytes32 s;\n uint8 v;\n // ecrecover takes the signature parameters, and the only way to get them\n // currently is to use assembly.\n /// @solidity memory-safe-assembly\n assembly {\n r := mload(add(signature, 0x20))\n s := mload(add(signature, 0x40))\n v := byte(0, mload(add(signature, 0x60)))\n }\n return tryRecover(hash, v, r, s);\n } else {\n return (address(0), RecoverError.InvalidSignatureLength);\n }\n }\n\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with\n * `signature`. This address can then be used for verification purposes.\n *\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {toEthSignedMessageHash} on it.\n */\n function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, signature);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.\n *\n * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]\n *\n * _Available since v4.3._\n */\n function tryRecover(\n bytes32 hash,\n bytes32 r,\n bytes32 vs\n ) internal pure returns (address, RecoverError) {\n bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);\n uint8 v = uint8((uint256(vs) >> 255) + 27);\n return tryRecover(hash, v, r, s);\n }\n\n /**\n * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.\n *\n * _Available since v4.2._\n */\n function recover(\n bytes32 hash,\n bytes32 r,\n bytes32 vs\n ) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, r, vs);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Overload of {ECDSA-tryRecover} that receives the `v`,\n * `r` and `s` signature fields separately.\n *\n * _Available since v4.3._\n */\n function tryRecover(\n bytes32 hash,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal pure returns (address, RecoverError) {\n // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature\n // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines\n // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most\n // signatures from current libraries generate a unique signature with an s-value in the lower half order.\n //\n // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value\n // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or\n // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept\n // these malleable signatures as well.\n if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {\n return (address(0), RecoverError.InvalidSignatureS);\n }\n\n // If the signature is valid (and not malleable), return the signer address\n address signer = ecrecover(hash, v, r, s);\n if (signer == address(0)) {\n return (address(0), RecoverError.InvalidSignature);\n }\n\n return (signer, RecoverError.NoError);\n }\n\n /**\n * @dev Overload of {ECDSA-recover} that receives the `v`,\n * `r` and `s` signature fields separately.\n */\n function recover(\n bytes32 hash,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, v, r, s);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Returns an Ethereum Signed Message, created from a `hash`. This\n * produces hash corresponding to the one signed with the\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n * JSON-RPC method as part of EIP-191.\n *\n * See {recover}.\n */\n function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {\n // 32 is the length in bytes of hash,\n // enforced by the type signature above\n return keccak256(abi.encodePacked(\"\\x19Ethereum Signed Message:\\n32\", hash));\n }\n\n /**\n * @dev Returns an Ethereum Signed Message, created from `s`. This\n * produces hash corresponding to the one signed with the\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n * JSON-RPC method as part of EIP-191.\n *\n * See {recover}.\n */\n function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(\"\\x19Ethereum Signed Message:\\n\", Strings.toString(s.length), s));\n }\n\n /**\n * @dev Returns an Ethereum Signed Typed Data, created from a\n * `domainSeparator` and a `structHash`. This produces hash corresponding\n * to the one signed with the\n * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]\n * JSON-RPC method as part of EIP-712.\n *\n * See {recover}.\n */\n function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(\"\\x19\\x01\", domainSeparator, structHash));\n }\n}\n" + }, + "@openzeppelin/contracts/utils/math/Math.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary Math {\n enum Rounding {\n Down, // Toward negative infinity\n Up, // Toward infinity\n Zero // Toward zero\n }\n\n /**\n * @dev Returns the largest of two numbers.\n */\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two numbers.\n */\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two numbers. The result is rounded towards\n * zero.\n */\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b) / 2 can overflow.\n return (a & b) + (a ^ b) / 2;\n }\n\n /**\n * @dev Returns the ceiling of the division of two numbers.\n *\n * This differs from standard division with `/` in that it rounds up instead\n * of rounding down.\n */\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b - 1) / b can overflow on addition, so we distribute.\n return a == 0 ? 0 : (a - 1) / b + 1;\n }\n\n /**\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\n * with further edits by Uniswap Labs also under MIT license.\n */\n function mulDiv(\n uint256 x,\n uint256 y,\n uint256 denominator\n ) internal pure returns (uint256 result) {\n unchecked {\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\n // variables such that product = prod1 * 2^256 + prod0.\n uint256 prod0; // Least significant 256 bits of the product\n uint256 prod1; // Most significant 256 bits of the product\n assembly {\n let mm := mulmod(x, y, not(0))\n prod0 := mul(x, y)\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n }\n\n // Handle non-overflow cases, 256 by 256 division.\n if (prod1 == 0) {\n return prod0 / denominator;\n }\n\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\n require(denominator > prod1);\n\n ///////////////////////////////////////////////\n // 512 by 256 division.\n ///////////////////////////////////////////////\n\n // Make division exact by subtracting the remainder from [prod1 prod0].\n uint256 remainder;\n assembly {\n // Compute remainder using mulmod.\n remainder := mulmod(x, y, denominator)\n\n // Subtract 256 bit number from 512 bit number.\n prod1 := sub(prod1, gt(remainder, prod0))\n prod0 := sub(prod0, remainder)\n }\n\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\n // See https://cs.stackexchange.com/q/138556/92363.\n\n // Does not overflow because the denominator cannot be zero at this stage in the function.\n uint256 twos = denominator & (~denominator + 1);\n assembly {\n // Divide denominator by twos.\n denominator := div(denominator, twos)\n\n // Divide [prod1 prod0] by twos.\n prod0 := div(prod0, twos)\n\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\n twos := add(div(sub(0, twos), twos), 1)\n }\n\n // Shift in bits from prod1 into prod0.\n prod0 |= prod1 * twos;\n\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\n // four bits. That is, denominator * inv = 1 mod 2^4.\n uint256 inverse = (3 * denominator) ^ 2;\n\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\n // in modular arithmetic, doubling the correct bits in each step.\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\n\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\n // is no longer required.\n result = prod0 * inverse;\n return result;\n }\n }\n\n /**\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\n */\n function mulDiv(\n uint256 x,\n uint256 y,\n uint256 denominator,\n Rounding rounding\n ) internal pure returns (uint256) {\n uint256 result = mulDiv(x, y, denominator);\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\n result += 1;\n }\n return result;\n }\n\n /**\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\n *\n * Inspired by Henry S. Warren, Jr.'s \"Hacker's Delight\" (Chapter 11).\n */\n function sqrt(uint256 a) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\n //\n // We know that the \"msb\" (most significant bit) of our target number `a` is a power of 2 such that we have\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\n //\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\n // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\n // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\n //\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\n uint256 result = 1 << (log2(a) >> 1);\n\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\n // into the expected uint128 result.\n unchecked {\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n return min(result, a / result);\n }\n }\n\n /**\n * @notice Calculates sqrt(a), following the selected rounding direction.\n */\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = sqrt(a);\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 2, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 128;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 64;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 32;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 16;\n }\n if (value >> 8 > 0) {\n value >>= 8;\n result += 8;\n }\n if (value >> 4 > 0) {\n value >>= 4;\n result += 4;\n }\n if (value >> 2 > 0) {\n value >>= 2;\n result += 2;\n }\n if (value >> 1 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log2(value);\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 10, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >= 10**64) {\n value /= 10**64;\n result += 64;\n }\n if (value >= 10**32) {\n value /= 10**32;\n result += 32;\n }\n if (value >= 10**16) {\n value /= 10**16;\n result += 16;\n }\n if (value >= 10**8) {\n value /= 10**8;\n result += 8;\n }\n if (value >= 10**4) {\n value /= 10**4;\n result += 4;\n }\n if (value >= 10**2) {\n value /= 10**2;\n result += 2;\n }\n if (value >= 10**1) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log10(value);\n return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 256, rounded down, of a positive value.\n * Returns 0 if given 0.\n *\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\n */\n function log256(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 16;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 8;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 4;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 2;\n }\n if (value >> 8 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log256(value);\n return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Strings.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./math/Math.sol\";\n\n/**\n * @dev String operations.\n */\nlibrary Strings {\n bytes16 private constant _SYMBOLS = \"0123456789abcdef\";\n uint8 private constant _ADDRESS_LENGTH = 20;\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n */\n function toString(uint256 value) internal pure returns (string memory) {\n unchecked {\n uint256 length = Math.log10(value) + 1;\n string memory buffer = new string(length);\n uint256 ptr;\n /// @solidity memory-safe-assembly\n assembly {\n ptr := add(buffer, add(32, length))\n }\n while (true) {\n ptr--;\n /// @solidity memory-safe-assembly\n assembly {\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\n }\n value /= 10;\n if (value == 0) break;\n }\n return buffer;\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n */\n function toHexString(uint256 value) internal pure returns (string memory) {\n unchecked {\n return toHexString(value, Math.log256(value) + 1);\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n */\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n bytes memory buffer = new bytes(2 * length + 2);\n buffer[0] = \"0\";\n buffer[1] = \"x\";\n for (uint256 i = 2 * length + 1; i > 1; --i) {\n buffer[i] = _SYMBOLS[value & 0xf];\n value >>= 4;\n }\n require(value == 0, \"Strings: hex length insufficient\");\n return string(buffer);\n }\n\n /**\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\n */\n function toHexString(address addr) internal pure returns (string memory) {\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\n }\n}\n" + }, + "contracts/DistributionCreator.sol": { + "content": "// SPDX-License-Identifier: BUSL-1.1\n\n/*\n * █ \n ***** ▓▓▓ \n * ▓▓▓▓▓▓▓ \n * ///. ▓▓▓▓▓▓▓▓▓▓▓▓▓ \n ***** //////// ▓▓▓▓▓▓▓ \n * ///////////// ▓▓▓ \n ▓▓ ////////////////// █ ▓▓ \n ▓▓ ▓▓ /////////////////////// ▓▓ ▓▓ \n ▓▓ ▓▓ //////////////////////////// ▓▓ ▓▓ \n ▓▓ ▓▓ /////////▓▓▓///////▓▓▓///////// ▓▓ ▓▓ \n ▓▓ ,////////////////////////////////////// ▓▓ ▓▓ \n ▓▓ ////////////////////////////////////////// ▓▓ \n ▓▓ //////////////////////▓▓▓▓///////////////////// \n ,//////////////////////////////////////////////////// \n .////////////////////////////////////////////////////////// \n .//////////////////////////██.,//////////////////////////█ \n .//////////////////////████..,./////////////////////██ \n ...////////////////███████.....,.////////////////███ \n ,.,////////////████████ ........,///////////████ \n .,.,//////█████████ ,.......///////████ \n ,..//████████ ........./████ \n ..,██████ .....,███ \n .██ ,.,█ \n \n \n \n ▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓ ▓▓▓▓▓▓▓▓▓▓ \n ▓▓▓▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓ ▓▓ ▓▓▓▓ \n ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓ ▓▓▓▓▓ \n ▓▓▓ ▓▓ ▓▓▓ ▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ \n*/\n\npragma solidity ^0.8.17;\n\nimport { ReentrancyGuardUpgradeable } from \"@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol\";\nimport { IERC20, IERC20Metadata } from \"@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol\";\nimport { SafeERC20 } from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport { ECDSA } from \"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\";\n\nimport { IUniswapV3Pool } from \"./interfaces/external/uniswap/IUniswapV3Pool.sol\";\n\nimport \"./utils/UUPSHelper.sol\";\nimport { DistributionParameters } from \"./struct/DistributionParameters.sol\";\nimport { UniswapTokenData, ExtensiveDistributionParameters } from \"./struct/ExtensiveDistributionParameters.sol\";\nimport { RewardTokenAmounts } from \"./struct/RewardTokenAmounts.sol\";\n\ninterface IDistributionCreator {\n function tryGetExtensiveDistributionParameters(\n DistributionParameters memory distribution\n ) external view returns (bool success, ExtensiveDistributionParameters memory extensiveParams);\n}\n\n/// @title DistributionCreator\n/// @author Angle Labs, Inc.\n/// @notice Manages the distribution of rewards across different pools with concentrated liquidity (like on Uniswap V3)\n/// @dev This contract is mostly a helper for APIs built on top of Merkl\n/// @dev People depositing rewards must have signed a `message` with the conditions for using the\n/// product\n//solhint-disable\ncontract DistributionCreator is UUPSHelper, ReentrancyGuardUpgradeable {\n using SafeERC20 for IERC20;\n\n // =========================== CONSTANTS / VARIABLES ===========================\n\n /// @notice Epoch duration\n uint32 public constant EPOCH_DURATION = 3600;\n\n /// @notice Base for fee computation\n uint256 public constant BASE_9 = 1e9;\n\n /// @notice `Core` contract handling access control\n ICore public core;\n\n /// @notice User contract for distributing rewards\n address public distributor;\n\n /// @notice Address to which fees are forwarded\n address public feeRecipient;\n\n /// @notice Value (in base 10**9) of the fees taken when creating a distribution for a pool which do not\n /// have a whitelisted token in it\n uint256 public fees;\n\n /// @notice Message that needs to be acknowledged by users creating a distribution\n string public message;\n\n /// @notice Hash of the message that needs to be signed\n bytes32 public messageHash;\n\n /// @notice List of all rewards ever distributed or to be distributed in the contract\n /// @dev An attacker could try to populate this list. It shouldn't be an issue as only view functions\n /// iterate on it\n DistributionParameters[] public distributionList;\n\n /// @notice Maps an address to its fee rebate\n mapping(address => uint256) public feeRebate;\n\n /// @notice Maps a token to whether it is whitelisted or not. No fees are to be paid for incentives given\n /// on pools with whitelisted tokens\n mapping(address => uint256) public isWhitelistedToken;\n\n /// @notice Maps an address to its nonce for creating a distribution\n mapping(address => uint256) public nonces;\n\n /// @notice Maps an address to the last valid hash signed\n mapping(address => bytes32) public userSignatures;\n\n /// @notice Maps a user to whether it is whitelisted for not signing\n mapping(address => uint256) public userSignatureWhitelist;\n\n /// @notice Maps a token to the minimum amount that must be sent per epoch for a distribution to be valid\n /// @dev If `rewardTokenMinAmounts[token] == 0`, then `token` cannot be used as a reward\n mapping(address => uint256) public rewardTokenMinAmounts;\n\n /// @notice List of all reward tokens that have at some point been accepted\n address[] public rewardTokens;\n\n uint256[36] private __gap;\n\n // =================================== EVENTS ==================================\n\n event DistributorUpdated(address indexed _distributor);\n event FeeRebateUpdated(address indexed user, uint256 userFeeRebate);\n event FeeRecipientUpdated(address indexed _feeRecipient);\n event FeesSet(uint256 _fees);\n event MessageUpdated(bytes32 _messageHash);\n event NewDistribution(DistributionParameters distribution, address indexed sender);\n event RewardTokenMinimumAmountUpdated(address indexed token, uint256 amount);\n event TokenWhitelistToggled(address indexed token, uint256 toggleStatus);\n event UserSigned(bytes32 messageHash, address indexed user);\n event UserSigningWhitelistToggled(address indexed user, uint256 toggleStatus);\n\n // ================================= MODIFIERS =================================\n\n /// @notice Checks whether the `msg.sender` has the governor role or the guardian role\n modifier onlyGovernorOrGuardian() {\n if (!core.isGovernorOrGuardian(msg.sender)) revert NotGovernorOrGuardian();\n _;\n }\n\n /// @notice Checks whether an address has signed the message or not\n modifier hasSigned() {\n if (\n userSignatureWhitelist[msg.sender] == 0 &&\n userSignatures[msg.sender] != messageHash &&\n userSignatureWhitelist[tx.origin] == 0 &&\n userSignatures[tx.origin] != messageHash\n ) revert NotSigned();\n _;\n }\n\n // ================================ CONSTRUCTOR ================================\n\n function initialize(ICore _core, address _distributor, uint256 _fees) external initializer {\n if (address(_core) == address(0) || _distributor == address(0)) revert ZeroAddress();\n if (_fees >= BASE_9) revert InvalidParam();\n distributor = _distributor;\n core = _core;\n fees = _fees;\n }\n\n constructor() initializer {}\n\n /// @inheritdoc UUPSUpgradeable\n function _authorizeUpgrade(address) internal view override onlyGuardianUpgrader(core) {}\n\n // ============================== DEPOSIT FUNCTION =============================\n\n /// @notice Creates a `distribution` to incentivize a given pool for a specific period of time\n /// @return distributionAmount How many reward tokens are actually taken into consideration in the contract\n /// @dev If the address specified as a UniV3 pool is not effectively a pool, it will not be handled by the\n /// distribution script and rewards may be lost\n /// @dev Reward tokens sent as part of distributions must have been whitelisted before and amounts\n /// sent should be bigger than a minimum amount specific to each token\n /// @dev The `positionWrappers` specified in the `distribution` struct need to be supported by the script\n /// List of supported `positionWrappers` can be found in the docs.\n /// @dev If the pool incentivized contains one whitelisted token, then no fees are taken on the rewards\n /// @dev This function reverts if the sender has not signed the message `messageHash` once through one of\n /// the functions enabling to sign\n function createDistribution(\n DistributionParameters memory distribution\n ) external hasSigned returns (uint256 distributionAmount) {\n return _createDistribution(distribution);\n }\n\n /// @notice Same as the function above but for multiple distributions at once\n /// @return List of all the distribution amounts actually deposited for each `distribution` in the `distributions` list\n function createDistributions(\n DistributionParameters[] memory distributions\n ) external hasSigned returns (uint256[] memory) {\n uint256 distributionsLength = distributions.length;\n uint256[] memory distributionAmounts = new uint256[](distributionsLength);\n for (uint256 i; i < distributionsLength; ) {\n distributionAmounts[i] = _createDistribution(distributions[i]);\n unchecked {\n ++i;\n }\n }\n return distributionAmounts;\n }\n\n /// @notice Checks whether the `msg.sender`'s `signature` is compatible with the message\n /// to sign and stores the signature\n /// @dev If you signed the message once, and the message has not been modified, then you do not\n /// need to sign again\n function sign(bytes calldata signature) external {\n _sign(signature);\n }\n\n /// @notice Combines signing the message and creating a distribution\n function signAndCreateDistribution(\n DistributionParameters memory distribution,\n bytes calldata signature\n ) external returns (uint256 distributionAmount) {\n _sign(signature);\n return _createDistribution(distribution);\n }\n\n /// @notice Internal version of `createDistribution`\n function _createDistribution(\n DistributionParameters memory distribution\n ) internal nonReentrant returns (uint256 distributionAmount) {\n uint32 epochStart = _getRoundedEpoch(distribution.epochStart);\n uint256 minDistributionAmount = rewardTokenMinAmounts[distribution.rewardToken];\n distribution.epochStart = epochStart;\n // Reward are not accepted in the following conditions:\n if (\n // if epoch parameters lead to a past distribution\n epochStart + EPOCH_DURATION < block.timestamp ||\n // if the amount of epochs for which this distribution should last is zero\n distribution.numEpoch == 0 ||\n // if the distribution parameters are not correctly specified\n distribution.propFees + distribution.propToken0 + distribution.propToken1 != 1e4 ||\n // if boosted addresses get less than non-boosted addresses in case of\n (distribution.boostingAddress != address(0) && distribution.boostedReward < 1e4) ||\n // if the type of the position wrappers is not well specified\n distribution.positionWrappers.length != distribution.wrapperTypes.length ||\n // if the reward token is not whitelisted as an incentive token\n minDistributionAmount == 0 ||\n // if the amount distributed is too small with respect to what is allowed\n distribution.amount / distribution.numEpoch < minDistributionAmount\n ) revert InvalidReward();\n distributionAmount = distribution.amount;\n // Computing fees: these are waived for whitelisted addresses and if there is a whitelisted token in a pool\n uint256 userFeeRebate = feeRebate[msg.sender];\n if (\n userFeeRebate < BASE_9 &&\n // Algebra pools also have these `token0` and `token1` parameters\n isWhitelistedToken[IUniswapV3Pool(distribution.uniV3Pool).token0()] == 0 &&\n isWhitelistedToken[IUniswapV3Pool(distribution.uniV3Pool).token1()] == 0\n ) {\n uint256 _fees = (fees * (BASE_9 - userFeeRebate)) / BASE_9;\n uint256 distributionAmountMinusFees = (distributionAmount * (BASE_9 - _fees)) / BASE_9;\n address _feeRecipient = feeRecipient;\n _feeRecipient = _feeRecipient == address(0) ? address(this) : _feeRecipient;\n IERC20(distribution.rewardToken).safeTransferFrom(\n msg.sender,\n _feeRecipient,\n distributionAmount - distributionAmountMinusFees\n );\n distributionAmount = distributionAmountMinusFees;\n distribution.amount = distributionAmount;\n }\n\n IERC20(distribution.rewardToken).safeTransferFrom(msg.sender, distributor, distributionAmount);\n uint256 senderNonce = nonces[msg.sender];\n nonces[msg.sender] = senderNonce + 1;\n distribution.rewardId = bytes32(keccak256(abi.encodePacked(msg.sender, senderNonce)));\n distributionList.push(distribution);\n emit NewDistribution(distribution, msg.sender);\n }\n\n /// @notice Internal version of the `sign` function\n function _sign(bytes calldata signature) internal {\n bytes32 _messageHash = messageHash;\n if (ECDSA.recover(_messageHash, signature) != msg.sender) revert InvalidSignature();\n userSignatures[msg.sender] = _messageHash;\n emit UserSigned(_messageHash, msg.sender);\n }\n\n // ================================= UI HELPERS ================================\n // These functions are not to be queried on-chain and hence are not optimized for gas consumption\n\n /// @notice Returns the list of all distributions ever made or to be done in the future\n function getAllDistributions() external view returns (DistributionParameters[] memory) {\n return distributionList;\n }\n\n /// @notice Returns the list of all currently active distributions on pools of supported AMMs (like Uniswap V3)\n function getActiveDistributions()\n external\n view\n returns (ExtensiveDistributionParameters[] memory searchDistributions)\n {\n uint32 roundedEpoch = _getRoundedEpoch(uint32(block.timestamp));\n (searchDistributions, ) = _getPoolDistributionsBetweenEpochs(\n address(0),\n roundedEpoch,\n roundedEpoch + EPOCH_DURATION,\n 0,\n type(uint32).max\n );\n }\n\n /// @notice Similar to `getActiveDistributions()` with additional parameters to prevent out of gas error\n /// @param skip Disregard distibutions with a global index lower than `skip`\n /// @param first Limit the length of the returned array to `first`\n /// @return searchDistributions Eligible distributions\n /// @return lastIndexDistribution Index of the last distribution assessed in the list of all distributions\n /// For pagniation purpose, in case of out of gas, you can call back the same function but with `skip` set to `lastIndexDistribution`\n function getActiveDistributions(\n uint32 skip,\n uint32 first\n )\n external\n view\n returns (ExtensiveDistributionParameters[] memory searchDistributions, uint256 lastIndexDistribution)\n {\n uint32 roundedEpoch = _getRoundedEpoch(uint32(block.timestamp));\n return _getPoolDistributionsBetweenEpochs(address(0), roundedEpoch, roundedEpoch + EPOCH_DURATION, skip, first);\n }\n\n /// @notice Returns the list of all the reward tokens supported as well as their minimum amounts\n function getValidRewardTokens() external view returns (RewardTokenAmounts[] memory) {\n uint256 length;\n uint256 rewardTokenListLength = rewardTokens.length;\n RewardTokenAmounts[] memory validRewardTokens = new RewardTokenAmounts[](rewardTokenListLength);\n for (uint32 i; i < rewardTokenListLength; ) {\n address token = rewardTokens[i];\n uint256 minAmount = rewardTokenMinAmounts[token];\n if (minAmount > 0) {\n validRewardTokens[length] = RewardTokenAmounts(token, minAmount);\n length += 1;\n }\n unchecked {\n ++i;\n }\n }\n assembly {\n mstore(validRewardTokens, length)\n }\n return validRewardTokens;\n }\n\n /// @notice Returns the list of all the distributions that were or that are going to be live at\n /// a specific epoch\n function getDistributionsForEpoch(\n uint32 epoch\n ) external view returns (ExtensiveDistributionParameters[] memory searchDistributions) {\n uint32 roundedEpoch = _getRoundedEpoch(epoch);\n (searchDistributions, ) = _getPoolDistributionsBetweenEpochs(\n address(0),\n roundedEpoch,\n roundedEpoch + EPOCH_DURATION,\n 0,\n type(uint32).max\n );\n }\n\n /// @notice Similar to `getDistributionsForEpoch(uint256 epoch)` with additional parameters to prevent out of gas error\n /// @param skip Disregard distibutions with a global index lower than `skip`\n /// @param first Limit the length of the returned array to `first`\n /// @return searchDistributions Eligible distributions\n /// @return lastIndexDistribution Index of the last distribution assessed in the list of all distributions\n /// For pagniation purpose, in case of out of gas, you can call back the same function but with `skip` set to `lastIndexDistribution`\n function getDistributionsForEpoch(\n uint32 epoch,\n uint32 skip,\n uint32 first\n ) external view returns (ExtensiveDistributionParameters[] memory, uint256 lastIndexDistribution) {\n uint32 roundedEpoch = _getRoundedEpoch(epoch);\n return _getPoolDistributionsBetweenEpochs(address(0), roundedEpoch, roundedEpoch + EPOCH_DURATION, skip, first);\n }\n\n /// @notice Gets the distributions that were or will be live at some point between `epochStart` (included) and `epochEnd` (excluded)\n /// @dev If a distribution starts during `epochEnd`, it is not be returned by this function\n /// @dev Conversely, if a distribution starts after `epochStart` and ends before `epochEnd`, it is returned by this function\n function getDistributionsBetweenEpochs(\n uint32 epochStart,\n uint32 epochEnd\n ) external view returns (ExtensiveDistributionParameters[] memory searchDistributions) {\n (searchDistributions, ) = _getPoolDistributionsBetweenEpochs(\n address(0),\n _getRoundedEpoch(epochStart),\n _getRoundedEpoch(epochEnd),\n 0,\n type(uint32).max\n );\n }\n\n /// @notice Similar to `getDistributionsBetweenEpochs(uint256 epochStart, uint256 epochEnd)` with additional parameters to prevent out of gas error\n /// @param skip Disregard distibutions with a global index lower than `skip`\n /// @param first Limit the length of the returned array to `first`\n /// @return searchDistributions Eligible distributions\n /// @return lastIndexDistribution Index of the last distribution assessed in the list of all distributions\n /// For pagniation purpose, in case of out of gas, you can call back the same function but with `skip` set to `lastIndexDistribution`\n function getDistributionsBetweenEpochs(\n uint32 epochStart,\n uint32 epochEnd,\n uint32 skip,\n uint32 first\n ) external view returns (ExtensiveDistributionParameters[] memory, uint256 lastIndexDistribution) {\n return\n _getPoolDistributionsBetweenEpochs(\n address(0),\n _getRoundedEpoch(epochStart),\n _getRoundedEpoch(epochEnd),\n skip,\n first\n );\n }\n\n /// @notice Returns the list of all distributions that were or will be live after `epochStart` (included)\n function getDistributionsAfterEpoch(\n uint32 epochStart\n ) external view returns (ExtensiveDistributionParameters[] memory searchDistributions) {\n (searchDistributions, ) = _getPoolDistributionsBetweenEpochs(\n address(0),\n _getRoundedEpoch(epochStart),\n type(uint32).max,\n 0,\n type(uint32).max\n );\n }\n\n /// @notice Similar to `getDistributionsAfterEpoch(uint256 epochStart)` with additional parameters to prevent out of gas error\n /// @param skip Disregard distibutions with a global index lower than `skip`\n /// @param first Limit the length of the returned array to `first`\n /// @return searchDistributions Eligible distributions\n /// @return lastIndexDistribution Index of the last distribution assessed in the list of all distributions\n /// For pagniation purpose, in case of out of gas, you can call back the same function but with `skip` set to `lastIndexDistribution`\n function getDistributionsAfterEpoch(\n uint32 epochStart,\n uint32 skip,\n uint32 first\n ) external view returns (ExtensiveDistributionParameters[] memory, uint256 lastIndexDistribution) {\n return\n _getPoolDistributionsBetweenEpochs(address(0), _getRoundedEpoch(epochStart), type(uint32).max, skip, first);\n }\n\n /// @notice Returns the list of all currently active distributions for a specific UniswapV3 pool\n function getActivePoolDistributions(\n address uniV3Pool\n ) external view returns (ExtensiveDistributionParameters[] memory searchDistributions) {\n uint32 roundedEpoch = _getRoundedEpoch(uint32(block.timestamp));\n (searchDistributions, ) = _getPoolDistributionsBetweenEpochs(\n uniV3Pool,\n roundedEpoch,\n roundedEpoch + EPOCH_DURATION,\n 0,\n type(uint32).max\n );\n }\n\n /// @notice Similar to `getActivePoolDistributions(address uniV3Pool)` with additional parameters to prevent out of gas error\n /// @param skip Disregard distibutions with a global index lower than `skip`\n /// @param first Limit the length of the returned array to `first`\n /// @return searchDistributions Eligible distributions\n /// @return lastIndexDistribution Index of the last distribution assessed in the list of all distributions\n /// For pagniation purpose, in case of out of gas, you can call back the same function but with `skip` set to `lastIndexDistribution`\n function getActivePoolDistributions(\n address uniV3Pool,\n uint32 skip,\n uint32 first\n ) external view returns (ExtensiveDistributionParameters[] memory, uint256 lastIndexDistribution) {\n uint32 roundedEpoch = _getRoundedEpoch(uint32(block.timestamp));\n return _getPoolDistributionsBetweenEpochs(uniV3Pool, roundedEpoch, roundedEpoch + EPOCH_DURATION, skip, first);\n }\n\n /// @notice Returns the list of all the distributions that were or that are going to be live at a\n /// specific epoch and for a specific pool\n function getPoolDistributionsForEpoch(\n address uniV3Pool,\n uint32 epoch\n ) external view returns (ExtensiveDistributionParameters[] memory searchDistributions) {\n uint32 roundedEpoch = _getRoundedEpoch(epoch);\n (searchDistributions, ) = _getPoolDistributionsBetweenEpochs(\n uniV3Pool,\n roundedEpoch,\n roundedEpoch + EPOCH_DURATION,\n 0,\n type(uint32).max\n );\n }\n\n /// @notice Similar to `getPoolDistributionsForEpoch(address uniV3Pool,uint32 epoch)` with additional parameters to prevent out of gas error\n /// @param skip Disregard distibutions with a global index lower than `skip`\n /// @param first Limit the length of the returned array to `first`\n /// @return searchDistributions Eligible distributions\n /// @return lastIndexDistribution Index of the last distribution assessed in the list of all distributions\n /// For pagniation purpose, in case of out of gas, you can call back the same function but with `skip` set to `lastIndexDistribution`\n function getPoolDistributionsForEpoch(\n address uniV3Pool,\n uint32 epoch,\n uint32 skip,\n uint32 first\n ) external view returns (ExtensiveDistributionParameters[] memory, uint256 lastIndexDistribution) {\n uint32 roundedEpoch = _getRoundedEpoch(epoch);\n return _getPoolDistributionsBetweenEpochs(uniV3Pool, roundedEpoch, roundedEpoch + EPOCH_DURATION, skip, first);\n }\n\n /// @notice Returns the list of all distributions that were or will be live at some point between\n /// `epochStart` (included) and `epochEnd` (excluded) for a specific pool\n function getPoolDistributionsBetweenEpochs(\n address uniV3Pool,\n uint32 epochStart,\n uint32 epochEnd\n ) external view returns (ExtensiveDistributionParameters[] memory searchDistributions) {\n (searchDistributions, ) = _getPoolDistributionsBetweenEpochs(\n uniV3Pool,\n _getRoundedEpoch(epochStart),\n _getRoundedEpoch(epochEnd),\n 0,\n type(uint32).max\n );\n }\n\n /// @notice Similar to `getPoolDistributionsBetweenEpochs(address uniV3Pool,uint32 epochStart, uint32 epochEnd)` with additional parameters to prevent out of gas error\n /// @param skip Disregard distibutions with a global index lower than `skip`\n /// @param first Limit the length of the returned array to `first`\n /// @return searchDistributions Eligible distributions\n /// @return lastIndexDistribution Index of the last distribution assessed in the list of all distributions\n /// For pagniation purpose, in case of out of gas, you can call back the same function but with `skip` set to `lastIndexDistribution`\n function getPoolDistributionsBetweenEpochs(\n address uniV3Pool,\n uint32 epochStart,\n uint32 epochEnd,\n uint32 skip,\n uint32 first\n ) external view returns (ExtensiveDistributionParameters[] memory, uint256 lastIndexDistribution) {\n return\n _getPoolDistributionsBetweenEpochs(\n uniV3Pool,\n _getRoundedEpoch(epochStart),\n _getRoundedEpoch(epochEnd),\n skip,\n first\n );\n }\n\n /// @notice Returns the list of all distributions that were or will be live after `epochStart` (included)\n /// for a specific pool\n function getPoolDistributionsAfterEpoch(\n address uniV3Pool,\n uint32 epochStart\n ) external view returns (ExtensiveDistributionParameters[] memory searchDistributions) {\n (searchDistributions, ) = _getPoolDistributionsBetweenEpochs(\n uniV3Pool,\n _getRoundedEpoch(epochStart),\n type(uint32).max,\n 0,\n type(uint32).max\n );\n }\n\n /// @notice Similar to `getPoolDistributionsAfterEpoch(address uniV3Pool,uint32 epochStart)` with additional parameters to prevent out of gas error\n /// @param skip Disregard distibutions with a global index lower than `skip`\n /// @param first Limit the length of the returned array to `first`\n /// @return searchDistributions Eligible distributions\n /// @return lastIndexDistribution Index of the last distribution assessed in the list of all distributions\n /// For pagniation purpose, in case of out of gas, you can call back the same function but with `skip` set to `lastIndexDistribution`\n function getPoolDistributionsAfterEpoch(\n address uniV3Pool,\n uint32 epochStart,\n uint32 skip,\n uint32 first\n ) external view returns (ExtensiveDistributionParameters[] memory, uint256 lastIndexDistribution) {\n return\n _getPoolDistributionsBetweenEpochs(uniV3Pool, _getRoundedEpoch(epochStart), type(uint32).max, skip, first);\n }\n\n // ============================ GOVERNANCE FUNCTIONS ===========================\n\n /// @notice Sets a new `distributor` to which rewards should be distributed\n function setNewDistributor(address _distributor) external onlyGovernorOrGuardian {\n if (_distributor == address(0)) revert InvalidParam();\n distributor = _distributor;\n emit DistributorUpdated(_distributor);\n }\n\n /// @notice Sets the fees on deposit\n function setFees(uint256 _fees) external onlyGovernorOrGuardian {\n if (_fees >= BASE_9) revert InvalidParam();\n fees = _fees;\n emit FeesSet(_fees);\n }\n\n /// @notice Sets fee rebates for a given user\n function setUserFeeRebate(address user, uint256 userFeeRebate) external onlyGovernorOrGuardian {\n feeRebate[user] = userFeeRebate;\n emit FeeRebateUpdated(user, userFeeRebate);\n }\n\n /// @notice Toggles the fee whitelist for `token`\n function toggleTokenWhitelist(address token) external onlyGovernorOrGuardian {\n uint256 toggleStatus = 1 - isWhitelistedToken[token];\n isWhitelistedToken[token] = toggleStatus;\n emit TokenWhitelistToggled(token, toggleStatus);\n }\n\n /// @notice Recovers fees accrued on the contract for a list of `tokens`\n function recoverFees(IERC20[] calldata tokens, address to) external onlyGovernorOrGuardian {\n uint256 tokensLength = tokens.length;\n for (uint256 i; i < tokensLength; ) {\n tokens[i].safeTransfer(to, tokens[i].balanceOf(address(this)));\n unchecked {\n ++i;\n }\n }\n }\n\n /// @notice Sets the minimum amounts per distribution epoch for different reward tokens\n function setRewardTokenMinAmounts(\n address[] calldata tokens,\n uint256[] calldata amounts\n ) external onlyGovernorOrGuardian {\n uint256 tokensLength = tokens.length;\n if (tokensLength != amounts.length) revert InvalidLengths();\n for (uint256 i; i < tokensLength; ++i) {\n uint256 amount = amounts[i];\n // Basic logic check to make sure there are no duplicates in the `rewardTokens` table. If a token is\n // removed then re-added, it will appear as a duplicate in the list\n if (amount > 0 && rewardTokenMinAmounts[tokens[i]] == 0) rewardTokens.push(tokens[i]);\n rewardTokenMinAmounts[tokens[i]] = amount;\n emit RewardTokenMinimumAmountUpdated(tokens[i], amount);\n }\n }\n\n /// @notice Sets a new address to receive fees\n function setFeeRecipient(address _feeRecipient) external onlyGovernorOrGuardian {\n feeRecipient = _feeRecipient;\n emit FeeRecipientUpdated(_feeRecipient);\n }\n\n /// @notice Sets the message that needs to be signed by users before posting rewards\n function setMessage(string memory _message) external onlyGovernorOrGuardian {\n message = _message;\n bytes32 _messageHash = ECDSA.toEthSignedMessageHash(bytes(_message));\n messageHash = _messageHash;\n emit MessageUpdated(_messageHash);\n }\n\n /// @notice Toggles the whitelist status for `user` when it comes to signing messages before depositing rewards.\n function toggleSigningWhitelist(address user) external onlyGovernorOrGuardian {\n uint256 whitelistStatus = 1 - userSignatureWhitelist[user];\n userSignatureWhitelist[user] = whitelistStatus;\n emit UserSigningWhitelistToggled(user, whitelistStatus);\n }\n\n // ============================== INTERNAL HELPERS =============================\n\n /// @notice Rounds an `epoch` timestamp to the start of the corresponding period\n function _getRoundedEpoch(uint32 epoch) internal pure returns (uint32) {\n return (epoch / EPOCH_DURATION) * EPOCH_DURATION;\n }\n\n /// @notice Checks whether `distribution` was live between `roundedEpochStart` and `roundedEpochEnd`\n function _isDistributionLiveBetweenEpochs(\n DistributionParameters memory distribution,\n uint32 roundedEpochStart,\n uint32 roundedEpochEnd\n ) internal pure returns (bool) {\n uint256 distributionEpochStart = distribution.epochStart;\n return (distributionEpochStart + distribution.numEpoch * EPOCH_DURATION > roundedEpochStart &&\n distributionEpochStart < roundedEpochEnd);\n }\n\n /// @notice Fetches data for `token` on the Uniswap `pool`\n function _getUniswapTokenData(\n IERC20Metadata token,\n address pool\n ) internal view returns (UniswapTokenData memory data) {\n data.add = address(token);\n data.decimals = token.decimals();\n data.symbol = token.symbol();\n data.poolBalance = token.balanceOf(pool);\n }\n\n /// @notice Fetches extra data about the parameters in a distribution\n function getExtensiveDistributionParameters(\n DistributionParameters memory distribution\n ) external view returns (ExtensiveDistributionParameters memory extensiveParams) {\n extensiveParams.base = distribution;\n try IUniswapV3Pool(distribution.uniV3Pool).fee() returns (uint24 fee) {\n extensiveParams.poolFee = fee;\n } catch {\n extensiveParams.poolFee = 0;\n }\n extensiveParams.token0 = _getUniswapTokenData(\n IERC20Metadata(IUniswapV3Pool(distribution.uniV3Pool).token0()),\n distribution.uniV3Pool\n );\n extensiveParams.token1 = _getUniswapTokenData(\n IERC20Metadata(IUniswapV3Pool(distribution.uniV3Pool).token1()),\n distribution.uniV3Pool\n );\n extensiveParams.rewardTokenSymbol = IERC20Metadata(distribution.rewardToken).symbol();\n extensiveParams.rewardTokenDecimals = IERC20Metadata(distribution.rewardToken).decimals();\n }\n\n /// @notice Tries to fetch extra data about the parameters in a distribution\n function tryGetExtensiveDistributionParameters(\n DistributionParameters memory distribution\n ) external returns (bool success, ExtensiveDistributionParameters memory extensiveParams) {\n (bool callSuccess, bytes memory returndata) = address(this).delegatecall(\n abi.encodeWithSelector(DistributionCreator.getExtensiveDistributionParameters.selector, distribution)\n );\n success = callSuccess;\n if (success) {\n extensiveParams = abi.decode(returndata, (ExtensiveDistributionParameters));\n }\n return (success, extensiveParams);\n }\n\n /// @notice Gets the list of all the distributions for `uniV3Pool` that have been active between `epochStart` and `epochEnd` (excluded)\n /// @dev If the `uniV3Pool` parameter is equal to 0, then this function will return the distributions for all pools\n function _getPoolDistributionsBetweenEpochs(\n address uniV3Pool,\n uint32 epochStart,\n uint32 epochEnd,\n uint32 skip,\n uint32 first\n ) internal view returns (ExtensiveDistributionParameters[] memory, uint256) {\n uint256 length;\n uint256 distributionListLength = distributionList.length;\n uint256 returnSize = first > distributionListLength ? distributionListLength : first;\n ExtensiveDistributionParameters[] memory activeRewards = new ExtensiveDistributionParameters[](returnSize);\n uint32 i = skip;\n while (i < distributionListLength) {\n DistributionParameters memory distribution = distributionList[i];\n if (\n _isDistributionLiveBetweenEpochs(distribution, epochStart, epochEnd) &&\n (uniV3Pool == address(0) || distribution.uniV3Pool == uniV3Pool)\n ) {\n (bool success, ExtensiveDistributionParameters memory extensiveParams) = IDistributionCreator(\n address(this)\n ).tryGetExtensiveDistributionParameters(distribution);\n if (success) {\n activeRewards[length] = extensiveParams;\n length += 1;\n }\n }\n unchecked {\n ++i;\n }\n if (length == returnSize) break;\n }\n assembly {\n mstore(activeRewards, length)\n }\n return (activeRewards, i);\n }\n}\n" + }, + "contracts/interfaces/external/uniswap/IUniswapV3Pool.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity >=0.5.0;\n\n/// @title Pool state that never changes\n/// @notice These parameters are fixed for a pool forever, i.e., the methods will always return the same values\ninterface IUniswapV3Pool {\n /// @notice The first of the two tokens of the pool, sorted by address\n /// @return The token contract address\n function token0() external view returns (address);\n\n /// @notice The second of the two tokens of the pool, sorted by address\n /// @return The token contract address\n function token1() external view returns (address);\n\n /// @notice The pool's fee in hundredths of a bip, i.e. 1e-6\n /// @return The fee\n function fee() external view returns (uint24);\n}\n" + }, + "contracts/interfaces/ICore.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\n/// @title ICore\n/// @author Angle Labs, Inc.\n/// @notice Interface for the `Core` contracts of smart contract modules used in Angle Labs contracts\ninterface ICore {\n /// @notice Checks whether an address is governor\n /// @param admin Address to check\n /// @return Whether the address has the `GOVERNOR_ROLE` or not\n function isGovernor(address admin) external view returns (bool);\n\n /// @notice Checks whether an address is a governor or a guardian of a module\n /// @param admin Address to check\n /// @return Whether the address has the `GUARDIAN_ROLE` or not\n /// @dev Governance should make sure when adding a governor to also give this governor the guardian\n /// role by calling the `addGovernor` function\n function isGovernorOrGuardian(address admin) external view returns (bool);\n}\n" + }, + "contracts/struct/DistributionParameters.sol": { + "content": "// SPDX-License-Identifier: BUSL-1.1\n\npragma solidity ^0.8.17;\n\nstruct DistributionParameters {\n // ID of the reward (populated once created)\n bytes32 rewardId;\n // Address of the UniswapV3 pool that needs to be incentivized\n address uniV3Pool;\n // Address of the reward token for the incentives\n address rewardToken;\n // Amount of `rewardToken` to distribute across all the epochs\n // Amount distributed per epoch is `amount/numEpoch`\n uint256 amount;\n // List of all position wrappers to consider or not for this contract. Some wrappers like Gamma or Arrakis\n // are automatically detected and so there is no need to specify them here. Check out the docs to find out\n // which need to be specified and which are not automatically detected.\n address[] positionWrappers;\n // Type (Arrakis, Gamma, Blacklist, ...) encoded as a `uint32` for each wrapper in the list above. Mapping between\n // wrapper types and their corresponding `uint32` value can be found in Angle Docs\n uint32[] wrapperTypes;\n // In the incentivization formula, how much of the fees should go to holders of token0\n // in base 10**4\n uint32 propToken0;\n // Proportion for holding token1 (in base 10**4)\n uint32 propToken1;\n // Proportion for providing a useful liquidity (in base 10**4) that generates fees\n uint32 propFees;\n // Timestamp at which the incentivization should start\n uint32 epochStart;\n // Amount of epochs for which incentivization should last\n uint32 numEpoch;\n // Whether out of range liquidity should still be incentivized or not\n // This should be equal to 1 if out of range liquidity should still be incentivized\n // and 0 otherwise\n uint32 isOutOfRangeIncentivized;\n // How much more addresses with a maximum boost can get with respect to addresses\n // which do not have a boost (in base 4). In the case of Curve where addresses get 2.5x more\n // this would be 25000\n uint32 boostedReward;\n // Address of the token which dictates who gets boosted rewards or not. This is optional\n // and if the zero address is given no boost will be taken into account\n address boostingAddress;\n // Additional data passed when distributing rewards. This parameter may be used in case\n // the reward distribution script needs to look into other parameters beyond the ones above.\n bytes additionalData;\n}\n" + }, + "contracts/struct/ExtensiveDistributionParameters.sol": { + "content": "// SPDX-License-Identifier: BUSL-1.1\n\npragma solidity ^0.8.17;\n\nimport { DistributionParameters } from \"./DistributionParameters.sol\";\n\nstruct UniswapTokenData {\n address add;\n uint8 decimals;\n string symbol;\n uint256 poolBalance;\n}\n\nstruct ExtensiveDistributionParameters {\n DistributionParameters base;\n // Uniswap pool data\n uint24 poolFee;\n UniswapTokenData token0;\n UniswapTokenData token1;\n // rewardToken data\n string rewardTokenSymbol;\n uint8 rewardTokenDecimals;\n}\n" + }, + "contracts/struct/RewardTokenAmounts.sol": { + "content": "// SPDX-License-Identifier: BUSL-1.1\n\npragma solidity ^0.8.17;\n\nstruct RewardTokenAmounts {\n address token;\n uint256 minimumAmountPerEpoch;\n}\n" + }, + "contracts/utils/Errors.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nerror InvalidDispute();\nerror InvalidLengths();\nerror InvalidParam();\nerror InvalidParams();\nerror InvalidProof();\nerror InvalidUninitializedRoot();\nerror InvalidReward();\nerror InvalidSignature();\nerror NoDispute();\nerror NotGovernor();\nerror NotGovernorOrGuardian();\nerror NotSigned();\nerror NotTrusted();\nerror NotWhitelisted();\nerror UnresolvedDispute();\nerror ZeroAddress();\n" + }, + "contracts/utils/UUPSHelper.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\n/*\n * █ \n ***** ▓▓▓ \n * ▓▓▓▓▓▓▓ \n * ///. ▓▓▓▓▓▓▓▓▓▓▓▓▓ \n ***** //////// ▓▓▓▓▓▓▓ \n * ///////////// ▓▓▓ \n ▓▓ ////////////////// █ ▓▓ \n ▓▓ ▓▓ /////////////////////// ▓▓ ▓▓ \n ▓▓ ▓▓ //////////////////////////// ▓▓ ▓▓ \n ▓▓ ▓▓ /////////▓▓▓///////▓▓▓///////// ▓▓ ▓▓ \n ▓▓ ,////////////////////////////////////// ▓▓ ▓▓ \n ▓▓ ////////////////////////////////////////// ▓▓ \n ▓▓ //////////////////////▓▓▓▓///////////////////// \n ,//////////////////////////////////////////////////// \n .////////////////////////////////////////////////////////// \n .//////////////////////////██.,//////////////////////////█ \n .//////////////////////████..,./////////////////////██ \n ...////////////////███████.....,.////////////////███ \n ,.,////////////████████ ........,///////////████ \n .,.,//////█████████ ,.......///////████ \n ,..//████████ ........./████ \n ..,██████ .....,███ \n .██ ,.,█ \n \n \n \n ▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓ ▓▓▓▓▓▓▓▓▓▓ \n ▓▓▓▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓ ▓▓ ▓▓▓▓ \n ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓ ▓▓▓▓▓ \n ▓▓▓ ▓▓ ▓▓▓ ▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ \n*/\n\npragma solidity ^0.8.17;\n\nimport { UUPSUpgradeable } from \"@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol\";\n\nimport { ICore } from \"../interfaces/ICore.sol\";\nimport \"../utils/Errors.sol\";\n\n/// @title UUPSHelper\n/// @notice Helper contract for UUPSUpgradeable contracts where the upgradeability is controlled by a specific address\n/// @author Angle Labs., Inc\n/// @dev The 0 address check in the modifier allows the use of these modifiers during initialization\nabstract contract UUPSHelper is UUPSUpgradeable {\n modifier onlyGuardianUpgrader(ICore _core) {\n if (address(_core) != address(0) && !_core.isGovernorOrGuardian(msg.sender)) revert NotGovernorOrGuardian();\n _;\n }\n\n modifier onlyGovernorUpgrader(ICore _core) {\n if (address(_core) != address(0) && !_core.isGovernor(msg.sender)) revert NotGovernor();\n _;\n }\n\n constructor() initializer {}\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 100 + }, + "viaIR": false, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata" + ], + "": [ + "ast" + ] + } + } + } +} \ No newline at end of file diff --git a/deployments/thundercore/solcInputs/e77f17fbb4334e4df730b35bdfde2517.json b/deployments/thundercore/solcInputs/e77f17fbb4334e4df730b35bdfde2517.json new file mode 100644 index 0000000..00dbd19 --- /dev/null +++ b/deployments/thundercore/solcInputs/e77f17fbb4334e4df730b35bdfde2517.json @@ -0,0 +1,213 @@ +{ + "language": "Solidity", + "sources": { + "@openzeppelin/contracts-upgradeable/interfaces/draft-IERC1822Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\n * proxy whose upgrades are fully controlled by the current implementation.\n */\ninterface IERC1822ProxiableUpgradeable {\n /**\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\n * address.\n *\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\n * function revert if invoked through a proxy.\n */\n function proxiableUUID() external view returns (bytes32);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/proxy/beacon/IBeaconUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\n */\ninterface IBeaconUpgradeable {\n /**\n * @dev Must return an address that can be used as a delegate call target.\n *\n * {BeaconProxy} will check that this address is a contract.\n */\n function implementation() external view returns (address);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/proxy/ERC1967/ERC1967UpgradeUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (proxy/ERC1967/ERC1967Upgrade.sol)\n\npragma solidity ^0.8.2;\n\nimport \"../beacon/IBeaconUpgradeable.sol\";\nimport \"../../interfaces/draft-IERC1822Upgradeable.sol\";\nimport \"../../utils/AddressUpgradeable.sol\";\nimport \"../../utils/StorageSlotUpgradeable.sol\";\nimport \"../utils/Initializable.sol\";\n\n/**\n * @dev This abstract contract provides getters and event emitting update functions for\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\n *\n * _Available since v4.1._\n *\n * @custom:oz-upgrades-unsafe-allow delegatecall\n */\nabstract contract ERC1967UpgradeUpgradeable is Initializable {\n function __ERC1967Upgrade_init() internal onlyInitializing {\n }\n\n function __ERC1967Upgrade_init_unchained() internal onlyInitializing {\n }\n // This is the keccak-256 hash of \"eip1967.proxy.rollback\" subtracted by 1\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\n\n /**\n * @dev Storage slot with the address of the current implementation.\n * This is the keccak-256 hash of \"eip1967.proxy.implementation\" subtracted by 1, and is\n * validated in the constructor.\n */\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n\n /**\n * @dev Emitted when the implementation is upgraded.\n */\n event Upgraded(address indexed implementation);\n\n /**\n * @dev Returns the current implementation address.\n */\n function _getImplementation() internal view returns (address) {\n return StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value;\n }\n\n /**\n * @dev Stores a new address in the EIP1967 implementation slot.\n */\n function _setImplementation(address newImplementation) private {\n require(AddressUpgradeable.isContract(newImplementation), \"ERC1967: new implementation is not a contract\");\n StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\n }\n\n /**\n * @dev Perform implementation upgrade\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeTo(address newImplementation) internal {\n _setImplementation(newImplementation);\n emit Upgraded(newImplementation);\n }\n\n /**\n * @dev Perform implementation upgrade with additional setup call.\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeToAndCall(\n address newImplementation,\n bytes memory data,\n bool forceCall\n ) internal {\n _upgradeTo(newImplementation);\n if (data.length > 0 || forceCall) {\n _functionDelegateCall(newImplementation, data);\n }\n }\n\n /**\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeToAndCallUUPS(\n address newImplementation,\n bytes memory data,\n bool forceCall\n ) internal {\n // Upgrades from old implementations will perform a rollback test. This test requires the new\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\n // this special case will break upgrade paths from old UUPS implementation to new ones.\n if (StorageSlotUpgradeable.getBooleanSlot(_ROLLBACK_SLOT).value) {\n _setImplementation(newImplementation);\n } else {\n try IERC1822ProxiableUpgradeable(newImplementation).proxiableUUID() returns (bytes32 slot) {\n require(slot == _IMPLEMENTATION_SLOT, \"ERC1967Upgrade: unsupported proxiableUUID\");\n } catch {\n revert(\"ERC1967Upgrade: new implementation is not UUPS\");\n }\n _upgradeToAndCall(newImplementation, data, forceCall);\n }\n }\n\n /**\n * @dev Storage slot with the admin of the contract.\n * This is the keccak-256 hash of \"eip1967.proxy.admin\" subtracted by 1, and is\n * validated in the constructor.\n */\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\n\n /**\n * @dev Emitted when the admin account has changed.\n */\n event AdminChanged(address previousAdmin, address newAdmin);\n\n /**\n * @dev Returns the current admin.\n */\n function _getAdmin() internal view returns (address) {\n return StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value;\n }\n\n /**\n * @dev Stores a new address in the EIP1967 admin slot.\n */\n function _setAdmin(address newAdmin) private {\n require(newAdmin != address(0), \"ERC1967: new admin is the zero address\");\n StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\n }\n\n /**\n * @dev Changes the admin of the proxy.\n *\n * Emits an {AdminChanged} event.\n */\n function _changeAdmin(address newAdmin) internal {\n emit AdminChanged(_getAdmin(), newAdmin);\n _setAdmin(newAdmin);\n }\n\n /**\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\n */\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\n\n /**\n * @dev Emitted when the beacon is upgraded.\n */\n event BeaconUpgraded(address indexed beacon);\n\n /**\n * @dev Returns the current beacon.\n */\n function _getBeacon() internal view returns (address) {\n return StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value;\n }\n\n /**\n * @dev Stores a new beacon in the EIP1967 beacon slot.\n */\n function _setBeacon(address newBeacon) private {\n require(AddressUpgradeable.isContract(newBeacon), \"ERC1967: new beacon is not a contract\");\n require(\n AddressUpgradeable.isContract(IBeaconUpgradeable(newBeacon).implementation()),\n \"ERC1967: beacon implementation is not a contract\"\n );\n StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value = newBeacon;\n }\n\n /**\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\n *\n * Emits a {BeaconUpgraded} event.\n */\n function _upgradeBeaconToAndCall(\n address newBeacon,\n bytes memory data,\n bool forceCall\n ) internal {\n _setBeacon(newBeacon);\n emit BeaconUpgraded(newBeacon);\n if (data.length > 0 || forceCall) {\n _functionDelegateCall(IBeaconUpgradeable(newBeacon).implementation(), data);\n }\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function _functionDelegateCall(address target, bytes memory data) private returns (bytes memory) {\n require(AddressUpgradeable.isContract(target), \"Address: delegate call to non-contract\");\n\n // solhint-disable-next-line avoid-low-level-calls\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return AddressUpgradeable.verifyCallResult(success, returndata, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.1) (proxy/utils/Initializable.sol)\n\npragma solidity ^0.8.2;\n\nimport \"../../utils/AddressUpgradeable.sol\";\n\n/**\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\n *\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\n * reused. This mechanism prevents re-execution of each \"step\" but allows the creation of new initialization steps in\n * case an upgrade adds a module that needs to be initialized.\n *\n * For example:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * contract MyToken is ERC20Upgradeable {\n * function initialize() initializer public {\n * __ERC20_init(\"MyToken\", \"MTK\");\n * }\n * }\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\n * function initializeV2() reinitializer(2) public {\n * __ERC20Permit_init(\"MyToken\");\n * }\n * }\n * ```\n *\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\n *\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\n *\n * [CAUTION]\n * ====\n * Avoid leaving a contract uninitialized.\n *\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * /// @custom:oz-upgrades-unsafe-allow constructor\n * constructor() {\n * _disableInitializers();\n * }\n * ```\n * ====\n */\nabstract contract Initializable {\n /**\n * @dev Indicates that the contract has been initialized.\n * @custom:oz-retyped-from bool\n */\n uint8 private _initialized;\n\n /**\n * @dev Indicates that the contract is in the process of being initialized.\n */\n bool private _initializing;\n\n /**\n * @dev Triggered when the contract has been initialized or reinitialized.\n */\n event Initialized(uint8 version);\n\n /**\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\n * `onlyInitializing` functions can be used to initialize parent contracts.\n *\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\n * constructor.\n *\n * Emits an {Initialized} event.\n */\n modifier initializer() {\n bool isTopLevelCall = !_initializing;\n require(\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\n \"Initializable: contract is already initialized\"\n );\n _initialized = 1;\n if (isTopLevelCall) {\n _initializing = true;\n }\n _;\n if (isTopLevelCall) {\n _initializing = false;\n emit Initialized(1);\n }\n }\n\n /**\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\n * used to initialize parent contracts.\n *\n * A reinitializer may be used after the original initialization step. This is essential to configure modules that\n * are added through upgrades and that require initialization.\n *\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\n * cannot be nested. If one is invoked in the context of another, execution will revert.\n *\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\n * a contract, executing them in the right order is up to the developer or operator.\n *\n * WARNING: setting the version to 255 will prevent any future reinitialization.\n *\n * Emits an {Initialized} event.\n */\n modifier reinitializer(uint8 version) {\n require(!_initializing && _initialized < version, \"Initializable: contract is already initialized\");\n _initialized = version;\n _initializing = true;\n _;\n _initializing = false;\n emit Initialized(version);\n }\n\n /**\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\n */\n modifier onlyInitializing() {\n require(_initializing, \"Initializable: contract is not initializing\");\n _;\n }\n\n /**\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\n * through proxies.\n *\n * Emits an {Initialized} event the first time it is successfully executed.\n */\n function _disableInitializers() internal virtual {\n require(!_initializing, \"Initializable: contract is initializing\");\n if (_initialized < type(uint8).max) {\n _initialized = type(uint8).max;\n emit Initialized(type(uint8).max);\n }\n }\n\n /**\n * @dev Returns the highest version that has been initialized. See {reinitializer}.\n */\n function _getInitializedVersion() internal view returns (uint8) {\n return _initialized;\n }\n\n /**\n * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.\n */\n function _isInitializing() internal view returns (bool) {\n return _initializing;\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (proxy/utils/UUPSUpgradeable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../interfaces/draft-IERC1822Upgradeable.sol\";\nimport \"../ERC1967/ERC1967UpgradeUpgradeable.sol\";\nimport \"./Initializable.sol\";\n\n/**\n * @dev An upgradeability mechanism designed for UUPS proxies. The functions included here can perform an upgrade of an\n * {ERC1967Proxy}, when this contract is set as the implementation behind such a proxy.\n *\n * A security mechanism ensures that an upgrade does not turn off upgradeability accidentally, although this risk is\n * reinstated if the upgrade retains upgradeability but removes the security mechanism, e.g. by replacing\n * `UUPSUpgradeable` with a custom implementation of upgrades.\n *\n * The {_authorizeUpgrade} function must be overridden to include access restriction to the upgrade mechanism.\n *\n * _Available since v4.1._\n */\nabstract contract UUPSUpgradeable is Initializable, IERC1822ProxiableUpgradeable, ERC1967UpgradeUpgradeable {\n function __UUPSUpgradeable_init() internal onlyInitializing {\n }\n\n function __UUPSUpgradeable_init_unchained() internal onlyInitializing {\n }\n /// @custom:oz-upgrades-unsafe-allow state-variable-immutable state-variable-assignment\n address private immutable __self = address(this);\n\n /**\n * @dev Check that the execution is being performed through a delegatecall call and that the execution context is\n * a proxy contract with an implementation (as defined in ERC1967) pointing to self. This should only be the case\n * for UUPS and transparent proxies that are using the current contract as their implementation. Execution of a\n * function through ERC1167 minimal proxies (clones) would not normally pass this test, but is not guaranteed to\n * fail.\n */\n modifier onlyProxy() {\n require(address(this) != __self, \"Function must be called through delegatecall\");\n require(_getImplementation() == __self, \"Function must be called through active proxy\");\n _;\n }\n\n /**\n * @dev Check that the execution is not being performed through a delegate call. This allows a function to be\n * callable on the implementing contract but not through proxies.\n */\n modifier notDelegated() {\n require(address(this) == __self, \"UUPSUpgradeable: must not be called through delegatecall\");\n _;\n }\n\n /**\n * @dev Implementation of the ERC1822 {proxiableUUID} function. This returns the storage slot used by the\n * implementation. It is used to validate the implementation's compatibility when performing an upgrade.\n *\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\n * function revert if invoked through a proxy. This is guaranteed by the `notDelegated` modifier.\n */\n function proxiableUUID() external view virtual override notDelegated returns (bytes32) {\n return _IMPLEMENTATION_SLOT;\n }\n\n /**\n * @dev Upgrade the implementation of the proxy to `newImplementation`.\n *\n * Calls {_authorizeUpgrade}.\n *\n * Emits an {Upgraded} event.\n */\n function upgradeTo(address newImplementation) external virtual onlyProxy {\n _authorizeUpgrade(newImplementation);\n _upgradeToAndCallUUPS(newImplementation, new bytes(0), false);\n }\n\n /**\n * @dev Upgrade the implementation of the proxy to `newImplementation`, and subsequently execute the function call\n * encoded in `data`.\n *\n * Calls {_authorizeUpgrade}.\n *\n * Emits an {Upgraded} event.\n */\n function upgradeToAndCall(address newImplementation, bytes memory data) external payable virtual onlyProxy {\n _authorizeUpgrade(newImplementation);\n _upgradeToAndCallUUPS(newImplementation, data, true);\n }\n\n /**\n * @dev Function that should revert when `msg.sender` is not authorized to upgrade the contract. Called by\n * {upgradeTo} and {upgradeToAndCall}.\n *\n * Normally, this function will use an xref:access.adoc[access control] modifier such as {Ownable-onlyOwner}.\n *\n * ```solidity\n * function _authorizeUpgrade(address) internal override onlyOwner {}\n * ```\n */\n function _authorizeUpgrade(address newImplementation) internal virtual;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (security/ReentrancyGuard.sol)\n\npragma solidity ^0.8.0;\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Contract module that helps prevent reentrant calls to a function.\n *\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\n * available, which can be applied to functions to make sure there are no nested\n * (reentrant) calls to them.\n *\n * Note that because there is a single `nonReentrant` guard, functions marked as\n * `nonReentrant` may not call one another. This can be worked around by making\n * those functions `private`, and then adding `external` `nonReentrant` entry\n * points to them.\n *\n * TIP: If you would like to learn more about reentrancy and alternative ways\n * to protect against it, check out our blog post\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\n */\nabstract contract ReentrancyGuardUpgradeable is Initializable {\n // Booleans are more expensive than uint256 or any type that takes up a full\n // word because each write operation emits an extra SLOAD to first read the\n // slot's contents, replace the bits taken up by the boolean, and then write\n // back. This is the compiler's defense against contract upgrades and\n // pointer aliasing, and it cannot be disabled.\n\n // The values being non-zero value makes deployment a bit more expensive,\n // but in exchange the refund on every call to nonReentrant will be lower in\n // amount. Since refunds are capped to a percentage of the total\n // transaction's gas, it is best to keep them low in cases like this one, to\n // increase the likelihood of the full refund coming into effect.\n uint256 private constant _NOT_ENTERED = 1;\n uint256 private constant _ENTERED = 2;\n\n uint256 private _status;\n\n function __ReentrancyGuard_init() internal onlyInitializing {\n __ReentrancyGuard_init_unchained();\n }\n\n function __ReentrancyGuard_init_unchained() internal onlyInitializing {\n _status = _NOT_ENTERED;\n }\n\n /**\n * @dev Prevents a contract from calling itself, directly or indirectly.\n * Calling a `nonReentrant` function from another `nonReentrant`\n * function is not supported. It is possible to prevent this from happening\n * by making the `nonReentrant` function external, and making it call a\n * `private` function that does the actual work.\n */\n modifier nonReentrant() {\n _nonReentrantBefore();\n _;\n _nonReentrantAfter();\n }\n\n function _nonReentrantBefore() private {\n // On the first call to nonReentrant, _status will be _NOT_ENTERED\n require(_status != _ENTERED, \"ReentrancyGuard: reentrant call\");\n\n // Any calls to nonReentrant after this point will fail\n _status = _ENTERED;\n }\n\n function _nonReentrantAfter() private {\n // By storing the original value once again, a refund is triggered (see\n // https://eips.ethereum.org/EIPS/eip-2200)\n _status = _NOT_ENTERED;\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[49] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20Upgradeable {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary AddressUpgradeable {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/math/MathUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary MathUpgradeable {\n enum Rounding {\n Down, // Toward negative infinity\n Up, // Toward infinity\n Zero // Toward zero\n }\n\n /**\n * @dev Returns the largest of two numbers.\n */\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two numbers.\n */\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two numbers. The result is rounded towards\n * zero.\n */\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b) / 2 can overflow.\n return (a & b) + (a ^ b) / 2;\n }\n\n /**\n * @dev Returns the ceiling of the division of two numbers.\n *\n * This differs from standard division with `/` in that it rounds up instead\n * of rounding down.\n */\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b - 1) / b can overflow on addition, so we distribute.\n return a == 0 ? 0 : (a - 1) / b + 1;\n }\n\n /**\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\n * with further edits by Uniswap Labs also under MIT license.\n */\n function mulDiv(\n uint256 x,\n uint256 y,\n uint256 denominator\n ) internal pure returns (uint256 result) {\n unchecked {\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\n // variables such that product = prod1 * 2^256 + prod0.\n uint256 prod0; // Least significant 256 bits of the product\n uint256 prod1; // Most significant 256 bits of the product\n assembly {\n let mm := mulmod(x, y, not(0))\n prod0 := mul(x, y)\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n }\n\n // Handle non-overflow cases, 256 by 256 division.\n if (prod1 == 0) {\n return prod0 / denominator;\n }\n\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\n require(denominator > prod1);\n\n ///////////////////////////////////////////////\n // 512 by 256 division.\n ///////////////////////////////////////////////\n\n // Make division exact by subtracting the remainder from [prod1 prod0].\n uint256 remainder;\n assembly {\n // Compute remainder using mulmod.\n remainder := mulmod(x, y, denominator)\n\n // Subtract 256 bit number from 512 bit number.\n prod1 := sub(prod1, gt(remainder, prod0))\n prod0 := sub(prod0, remainder)\n }\n\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\n // See https://cs.stackexchange.com/q/138556/92363.\n\n // Does not overflow because the denominator cannot be zero at this stage in the function.\n uint256 twos = denominator & (~denominator + 1);\n assembly {\n // Divide denominator by twos.\n denominator := div(denominator, twos)\n\n // Divide [prod1 prod0] by twos.\n prod0 := div(prod0, twos)\n\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\n twos := add(div(sub(0, twos), twos), 1)\n }\n\n // Shift in bits from prod1 into prod0.\n prod0 |= prod1 * twos;\n\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\n // four bits. That is, denominator * inv = 1 mod 2^4.\n uint256 inverse = (3 * denominator) ^ 2;\n\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\n // in modular arithmetic, doubling the correct bits in each step.\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\n\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\n // is no longer required.\n result = prod0 * inverse;\n return result;\n }\n }\n\n /**\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\n */\n function mulDiv(\n uint256 x,\n uint256 y,\n uint256 denominator,\n Rounding rounding\n ) internal pure returns (uint256) {\n uint256 result = mulDiv(x, y, denominator);\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\n result += 1;\n }\n return result;\n }\n\n /**\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\n *\n * Inspired by Henry S. Warren, Jr.'s \"Hacker's Delight\" (Chapter 11).\n */\n function sqrt(uint256 a) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\n //\n // We know that the \"msb\" (most significant bit) of our target number `a` is a power of 2 such that we have\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\n //\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\n // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\n // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\n //\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\n uint256 result = 1 << (log2(a) >> 1);\n\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\n // into the expected uint128 result.\n unchecked {\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n return min(result, a / result);\n }\n }\n\n /**\n * @notice Calculates sqrt(a), following the selected rounding direction.\n */\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = sqrt(a);\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 2, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 128;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 64;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 32;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 16;\n }\n if (value >> 8 > 0) {\n value >>= 8;\n result += 8;\n }\n if (value >> 4 > 0) {\n value >>= 4;\n result += 4;\n }\n if (value >> 2 > 0) {\n value >>= 2;\n result += 2;\n }\n if (value >> 1 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log2(value);\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 10, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >= 10**64) {\n value /= 10**64;\n result += 64;\n }\n if (value >= 10**32) {\n value /= 10**32;\n result += 32;\n }\n if (value >= 10**16) {\n value /= 10**16;\n result += 16;\n }\n if (value >= 10**8) {\n value /= 10**8;\n result += 8;\n }\n if (value >= 10**4) {\n value /= 10**4;\n result += 4;\n }\n if (value >= 10**2) {\n value /= 10**2;\n result += 2;\n }\n if (value >= 10**1) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log10(value);\n return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 256, rounded down, of a positive value.\n * Returns 0 if given 0.\n *\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\n */\n function log256(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 16;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 8;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 4;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 2;\n }\n if (value >> 8 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log256(value);\n return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0);\n }\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/StorageSlotUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/StorageSlot.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Library for reading and writing primitive types to specific storage slots.\n *\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\n * This library helps with reading and writing to such slots without the need for inline assembly.\n *\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\n *\n * Example usage to set ERC1967 implementation slot:\n * ```\n * contract ERC1967 {\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n *\n * function _getImplementation() internal view returns (address) {\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\n * }\n *\n * function _setImplementation(address newImplementation) internal {\n * require(Address.isContract(newImplementation), \"ERC1967: new implementation is not a contract\");\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\n * }\n * }\n * ```\n *\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\n */\nlibrary StorageSlotUpgradeable {\n struct AddressSlot {\n address value;\n }\n\n struct BooleanSlot {\n bool value;\n }\n\n struct Bytes32Slot {\n bytes32 value;\n }\n\n struct Uint256Slot {\n uint256 value;\n }\n\n /**\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\n */\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\n */\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\n */\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\n */\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./math/MathUpgradeable.sol\";\n\n/**\n * @dev String operations.\n */\nlibrary StringsUpgradeable {\n bytes16 private constant _SYMBOLS = \"0123456789abcdef\";\n uint8 private constant _ADDRESS_LENGTH = 20;\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n */\n function toString(uint256 value) internal pure returns (string memory) {\n unchecked {\n uint256 length = MathUpgradeable.log10(value) + 1;\n string memory buffer = new string(length);\n uint256 ptr;\n /// @solidity memory-safe-assembly\n assembly {\n ptr := add(buffer, add(32, length))\n }\n while (true) {\n ptr--;\n /// @solidity memory-safe-assembly\n assembly {\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\n }\n value /= 10;\n if (value == 0) break;\n }\n return buffer;\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n */\n function toHexString(uint256 value) internal pure returns (string memory) {\n unchecked {\n return toHexString(value, MathUpgradeable.log256(value) + 1);\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n */\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n bytes memory buffer = new bytes(2 * length + 2);\n buffer[0] = \"0\";\n buffer[1] = \"x\";\n for (uint256 i = 2 * length + 1; i > 1; --i) {\n buffer[i] = _SYMBOLS[value & 0xf];\n value >>= 4;\n }\n require(value == 0, \"Strings: hex length insufficient\");\n return string(buffer);\n }\n\n /**\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\n */\n function toHexString(address addr) internal pure returns (string memory) {\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\n }\n}\n" + }, + "@openzeppelin/contracts/access/Ownable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n constructor() {\n _transferOwnership(_msgSender());\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n _checkOwner();\n _;\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if the sender is not the owner.\n */\n function _checkOwner() internal view virtual {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions anymore. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby removing any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n" + }, + "@openzeppelin/contracts/interfaces/draft-IERC1822.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\n * proxy whose upgrades are fully controlled by the current implementation.\n */\ninterface IERC1822Proxiable {\n /**\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\n * address.\n *\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\n * function revert if invoked through a proxy.\n */\n function proxiableUUID() external view returns (bytes32);\n}\n" + }, + "@openzeppelin/contracts/proxy/beacon/IBeacon.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\n */\ninterface IBeacon {\n /**\n * @dev Must return an address that can be used as a delegate call target.\n *\n * {BeaconProxy} will check that this address is a contract.\n */\n function implementation() external view returns (address);\n}\n" + }, + "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/ERC1967/ERC1967Proxy.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../Proxy.sol\";\nimport \"./ERC1967Upgrade.sol\";\n\n/**\n * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an\n * implementation address that can be changed. This address is stored in storage in the location specified by\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the\n * implementation behind the proxy.\n */\ncontract ERC1967Proxy is Proxy, ERC1967Upgrade {\n /**\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.\n *\n * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded\n * function call, and allows initializing the storage of the proxy like a Solidity constructor.\n */\n constructor(address _logic, bytes memory _data) payable {\n _upgradeToAndCall(_logic, _data, false);\n }\n\n /**\n * @dev Returns the current implementation address.\n */\n function _implementation() internal view virtual override returns (address impl) {\n return ERC1967Upgrade._getImplementation();\n }\n}\n" + }, + "@openzeppelin/contracts/proxy/ERC1967/ERC1967Upgrade.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (proxy/ERC1967/ERC1967Upgrade.sol)\n\npragma solidity ^0.8.2;\n\nimport \"../beacon/IBeacon.sol\";\nimport \"../../interfaces/draft-IERC1822.sol\";\nimport \"../../utils/Address.sol\";\nimport \"../../utils/StorageSlot.sol\";\n\n/**\n * @dev This abstract contract provides getters and event emitting update functions for\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\n *\n * _Available since v4.1._\n *\n * @custom:oz-upgrades-unsafe-allow delegatecall\n */\nabstract contract ERC1967Upgrade {\n // This is the keccak-256 hash of \"eip1967.proxy.rollback\" subtracted by 1\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\n\n /**\n * @dev Storage slot with the address of the current implementation.\n * This is the keccak-256 hash of \"eip1967.proxy.implementation\" subtracted by 1, and is\n * validated in the constructor.\n */\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n\n /**\n * @dev Emitted when the implementation is upgraded.\n */\n event Upgraded(address indexed implementation);\n\n /**\n * @dev Returns the current implementation address.\n */\n function _getImplementation() internal view returns (address) {\n return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\n }\n\n /**\n * @dev Stores a new address in the EIP1967 implementation slot.\n */\n function _setImplementation(address newImplementation) private {\n require(Address.isContract(newImplementation), \"ERC1967: new implementation is not a contract\");\n StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\n }\n\n /**\n * @dev Perform implementation upgrade\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeTo(address newImplementation) internal {\n _setImplementation(newImplementation);\n emit Upgraded(newImplementation);\n }\n\n /**\n * @dev Perform implementation upgrade with additional setup call.\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeToAndCall(\n address newImplementation,\n bytes memory data,\n bool forceCall\n ) internal {\n _upgradeTo(newImplementation);\n if (data.length > 0 || forceCall) {\n Address.functionDelegateCall(newImplementation, data);\n }\n }\n\n /**\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeToAndCallUUPS(\n address newImplementation,\n bytes memory data,\n bool forceCall\n ) internal {\n // Upgrades from old implementations will perform a rollback test. This test requires the new\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\n // this special case will break upgrade paths from old UUPS implementation to new ones.\n if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) {\n _setImplementation(newImplementation);\n } else {\n try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {\n require(slot == _IMPLEMENTATION_SLOT, \"ERC1967Upgrade: unsupported proxiableUUID\");\n } catch {\n revert(\"ERC1967Upgrade: new implementation is not UUPS\");\n }\n _upgradeToAndCall(newImplementation, data, forceCall);\n }\n }\n\n /**\n * @dev Storage slot with the admin of the contract.\n * This is the keccak-256 hash of \"eip1967.proxy.admin\" subtracted by 1, and is\n * validated in the constructor.\n */\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\n\n /**\n * @dev Emitted when the admin account has changed.\n */\n event AdminChanged(address previousAdmin, address newAdmin);\n\n /**\n * @dev Returns the current admin.\n */\n function _getAdmin() internal view returns (address) {\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\n }\n\n /**\n * @dev Stores a new address in the EIP1967 admin slot.\n */\n function _setAdmin(address newAdmin) private {\n require(newAdmin != address(0), \"ERC1967: new admin is the zero address\");\n StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\n }\n\n /**\n * @dev Changes the admin of the proxy.\n *\n * Emits an {AdminChanged} event.\n */\n function _changeAdmin(address newAdmin) internal {\n emit AdminChanged(_getAdmin(), newAdmin);\n _setAdmin(newAdmin);\n }\n\n /**\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\n */\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\n\n /**\n * @dev Emitted when the beacon is upgraded.\n */\n event BeaconUpgraded(address indexed beacon);\n\n /**\n * @dev Returns the current beacon.\n */\n function _getBeacon() internal view returns (address) {\n return StorageSlot.getAddressSlot(_BEACON_SLOT).value;\n }\n\n /**\n * @dev Stores a new beacon in the EIP1967 beacon slot.\n */\n function _setBeacon(address newBeacon) private {\n require(Address.isContract(newBeacon), \"ERC1967: new beacon is not a contract\");\n require(\n Address.isContract(IBeacon(newBeacon).implementation()),\n \"ERC1967: beacon implementation is not a contract\"\n );\n StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon;\n }\n\n /**\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\n *\n * Emits a {BeaconUpgraded} event.\n */\n function _upgradeBeaconToAndCall(\n address newBeacon,\n bytes memory data,\n bool forceCall\n ) internal {\n _setBeacon(newBeacon);\n emit BeaconUpgraded(newBeacon);\n if (data.length > 0 || forceCall) {\n Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/proxy/Proxy.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (proxy/Proxy.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\n * be specified by overriding the virtual {_implementation} function.\n *\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\n * different contract through the {_delegate} function.\n *\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\n */\nabstract contract Proxy {\n /**\n * @dev Delegates the current call to `implementation`.\n *\n * This function does not return to its internal call site, it will return directly to the external caller.\n */\n function _delegate(address implementation) internal virtual {\n assembly {\n // Copy msg.data. We take full control of memory in this inline assembly\n // block because it will not return to Solidity code. We overwrite the\n // Solidity scratch pad at memory position 0.\n calldatacopy(0, 0, calldatasize())\n\n // Call the implementation.\n // out and outsize are 0 because we don't know the size yet.\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\n\n // Copy the returned data.\n returndatacopy(0, 0, returndatasize())\n\n switch result\n // delegatecall returns 0 on error.\n case 0 {\n revert(0, returndatasize())\n }\n default {\n return(0, returndatasize())\n }\n }\n }\n\n /**\n * @dev This is a virtual function that should be overridden so it returns the address to which the fallback function\n * and {_fallback} should delegate.\n */\n function _implementation() internal view virtual returns (address);\n\n /**\n * @dev Delegates the current call to the address returned by `_implementation()`.\n *\n * This function does not return to its internal call site, it will return directly to the external caller.\n */\n function _fallback() internal virtual {\n _beforeFallback();\n _delegate(_implementation());\n }\n\n /**\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\n * function in the contract matches the call data.\n */\n fallback() external payable virtual {\n _fallback();\n }\n\n /**\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data\n * is empty.\n */\n receive() external payable virtual {\n _fallback();\n }\n\n /**\n * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`\n * call, or as part of the Solidity `fallback` or `receive` functions.\n *\n * If overridden should call `super._beforeFallback()`.\n */\n function _beforeFallback() internal virtual {}\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/ERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/ERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC20.sol\";\nimport \"./extensions/IERC20Metadata.sol\";\nimport \"../../utils/Context.sol\";\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n * For a generic mechanism see {ERC20PresetMinterPauser}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\n * instead returning `false` on failure. This behavior is nonetheless\n * conventional and does not conflict with the expectations of ERC20\n * applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the EIP may not emit\n * these events, as it isn't required by the specification.\n *\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\n * functions have been added to mitigate the well-known issues around setting\n * allowances. See {IERC20-approve}.\n */\ncontract ERC20 is Context, IERC20, IERC20Metadata {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n\n /**\n * @dev Sets the values for {name} and {symbol}.\n *\n * The default value of {decimals} is 18. To select a different value for\n * {decimals} you should overload it.\n *\n * All two of these values are immutable: they can only be set once during\n * construction.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev Returns the name of the token.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev Returns the number of decimals used to get its user representation.\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\n *\n * Tokens usually opt for a value of 18, imitating the relationship between\n * Ether and Wei. This is the value {ERC20} uses, unless this function is\n * overridden;\n *\n * NOTE: This information is only used for _display_ purposes: it in\n * no way affects any of the arithmetic of the contract, including\n * {IERC20-balanceOf} and {IERC20-transfer}.\n */\n function decimals() public view virtual override returns (uint8) {\n return 18;\n }\n\n /**\n * @dev See {IERC20-totalSupply}.\n */\n function totalSupply() public view virtual override returns (uint256) {\n return _totalSupply;\n }\n\n /**\n * @dev See {IERC20-balanceOf}.\n */\n function balanceOf(address account) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n /**\n * @dev See {IERC20-transfer}.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - the caller must have a balance of at least `amount`.\n */\n function transfer(address to, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _transfer(owner, to, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-allowance}.\n */\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n /**\n * @dev See {IERC20-approve}.\n *\n * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on\n * `transferFrom`. This is semantically equivalent to an infinite approval.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-transferFrom}.\n *\n * Emits an {Approval} event indicating the updated allowance. This is not\n * required by the EIP. See the note at the beginning of {ERC20}.\n *\n * NOTE: Does not update the allowance if the current allowance\n * is the maximum `uint256`.\n *\n * Requirements:\n *\n * - `from` and `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n * - the caller must have allowance for ``from``'s tokens of at least\n * `amount`.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) public virtual override returns (bool) {\n address spender = _msgSender();\n _spendAllowance(from, spender, amount);\n _transfer(from, to, amount);\n return true;\n }\n\n /**\n * @dev Atomically increases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, allowance(owner, spender) + addedValue);\n return true;\n }\n\n /**\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `spender` must have allowance for the caller of at least\n * `subtractedValue`.\n */\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\n address owner = _msgSender();\n uint256 currentAllowance = allowance(owner, spender);\n require(currentAllowance >= subtractedValue, \"ERC20: decreased allowance below zero\");\n unchecked {\n _approve(owner, spender, currentAllowance - subtractedValue);\n }\n\n return true;\n }\n\n /**\n * @dev Moves `amount` of tokens from `from` to `to`.\n *\n * This internal function is equivalent to {transfer}, and can be used to\n * e.g. implement automatic token fees, slashing mechanisms, etc.\n *\n * Emits a {Transfer} event.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n */\n function _transfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, amount);\n\n uint256 fromBalance = _balances[from];\n require(fromBalance >= amount, \"ERC20: transfer amount exceeds balance\");\n unchecked {\n _balances[from] = fromBalance - amount;\n // Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by\n // decrementing then incrementing.\n _balances[to] += amount;\n }\n\n emit Transfer(from, to, amount);\n\n _afterTokenTransfer(from, to, amount);\n }\n\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\n * the total supply.\n *\n * Emits a {Transfer} event with `from` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _beforeTokenTransfer(address(0), account, amount);\n\n _totalSupply += amount;\n unchecked {\n // Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above.\n _balances[account] += amount;\n }\n emit Transfer(address(0), account, amount);\n\n _afterTokenTransfer(address(0), account, amount);\n }\n\n /**\n * @dev Destroys `amount` tokens from `account`, reducing the\n * total supply.\n *\n * Emits a {Transfer} event with `to` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n * - `account` must have at least `amount` tokens.\n */\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n _beforeTokenTransfer(account, address(0), amount);\n\n uint256 accountBalance = _balances[account];\n require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n unchecked {\n _balances[account] = accountBalance - amount;\n // Overflow not possible: amount <= accountBalance <= totalSupply.\n _totalSupply -= amount;\n }\n\n emit Transfer(account, address(0), amount);\n\n _afterTokenTransfer(account, address(0), amount);\n }\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\n *\n * This internal function is equivalent to `approve`, and can be used to\n * e.g. set automatic allowances for certain subsystems, etc.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `owner` cannot be the zero address.\n * - `spender` cannot be the zero address.\n */\n function _approve(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n emit Approval(owner, spender, amount);\n }\n\n /**\n * @dev Updates `owner` s allowance for `spender` based on spent `amount`.\n *\n * Does not update the allowance amount in case of infinite allowance.\n * Revert if not enough allowance is available.\n *\n * Might emit an {Approval} event.\n */\n function _spendAllowance(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n uint256 currentAllowance = allowance(owner, spender);\n if (currentAllowance != type(uint256).max) {\n require(currentAllowance >= amount, \"ERC20: insufficient allowance\");\n unchecked {\n _approve(owner, spender, currentAllowance - amount);\n }\n }\n }\n\n /**\n * @dev Hook that is called before any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * will be transferred to `to`.\n * - when `from` is zero, `amount` tokens will be minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n\n /**\n * @dev Hook that is called after any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * has been transferred to `to`.\n * - when `from` is zero, `amount` tokens have been minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens have been burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/draft-ERC20Permit.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/extensions/draft-ERC20Permit.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./draft-IERC20Permit.sol\";\nimport \"../ERC20.sol\";\nimport \"../../../utils/cryptography/ECDSA.sol\";\nimport \"../../../utils/cryptography/EIP712.sol\";\nimport \"../../../utils/Counters.sol\";\n\n/**\n * @dev Implementation of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on `{IERC20-approve}`, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n *\n * _Available since v3.4._\n */\nabstract contract ERC20Permit is ERC20, IERC20Permit, EIP712 {\n using Counters for Counters.Counter;\n\n mapping(address => Counters.Counter) private _nonces;\n\n // solhint-disable-next-line var-name-mixedcase\n bytes32 private constant _PERMIT_TYPEHASH =\n keccak256(\"Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)\");\n /**\n * @dev In previous versions `_PERMIT_TYPEHASH` was declared as `immutable`.\n * However, to ensure consistency with the upgradeable transpiler, we will continue\n * to reserve a slot.\n * @custom:oz-renamed-from _PERMIT_TYPEHASH\n */\n // solhint-disable-next-line var-name-mixedcase\n bytes32 private _PERMIT_TYPEHASH_DEPRECATED_SLOT;\n\n /**\n * @dev Initializes the {EIP712} domain separator using the `name` parameter, and setting `version` to `\"1\"`.\n *\n * It's a good idea to use the same `name` that is defined as the ERC20 token name.\n */\n constructor(string memory name) EIP712(name, \"1\") {}\n\n /**\n * @dev See {IERC20Permit-permit}.\n */\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) public virtual override {\n require(block.timestamp <= deadline, \"ERC20Permit: expired deadline\");\n\n bytes32 structHash = keccak256(abi.encode(_PERMIT_TYPEHASH, owner, spender, value, _useNonce(owner), deadline));\n\n bytes32 hash = _hashTypedDataV4(structHash);\n\n address signer = ECDSA.recover(hash, v, r, s);\n require(signer == owner, \"ERC20Permit: invalid signature\");\n\n _approve(owner, spender, value);\n }\n\n /**\n * @dev See {IERC20Permit-nonces}.\n */\n function nonces(address owner) public view virtual override returns (uint256) {\n return _nonces[owner].current();\n }\n\n /**\n * @dev See {IERC20Permit-DOMAIN_SEPARATOR}.\n */\n // solhint-disable-next-line func-name-mixedcase\n function DOMAIN_SEPARATOR() external view override returns (bytes32) {\n return _domainSeparatorV4();\n }\n\n /**\n * @dev \"Consume a nonce\": return the current value and increment.\n *\n * _Available since v4.1._\n */\n function _useNonce(address owner) internal virtual returns (uint256 current) {\n Counters.Counter storage nonce = _nonces[owner];\n current = nonce.current();\n nonce.increment();\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n */\ninterface IERC20Permit {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also apply here.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `deadline` must be a timestamp in the future.\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\n * over the EIP712-formatted function arguments.\n * - the signature must use ``owner``'s current nonce (see {nonces}).\n *\n * For more information on the signature format, see the\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\n * section].\n */\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n\n /**\n * @dev Returns the current nonce for `owner`. This value must be\n * included whenever a signature is generated for {permit}.\n *\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\n * prevents a signature from being used multiple times.\n */\n function nonces(address owner) external view returns (uint256);\n\n /**\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\n */\n // solhint-disable-next-line func-name-mixedcase\n function DOMAIN_SEPARATOR() external view returns (bytes32);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20Metadata is IERC20 {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/IERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\nimport \"../extensions/draft-IERC20Permit.sol\";\nimport \"../../../utils/Address.sol\";\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n using Address for address;\n\n function safeTransfer(\n IERC20 token,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n function safeTransferFrom(\n IERC20 token,\n address from,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\n }\n\n /**\n * @dev Deprecated. This function has issues similar to the ones found in\n * {IERC20-approve}, and its usage is discouraged.\n *\n * Whenever possible, use {safeIncreaseAllowance} and\n * {safeDecreaseAllowance} instead.\n */\n function safeApprove(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n // safeApprove should only be called when setting an initial allowance,\n // or when resetting it to zero. To increase and decrease it, use\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\n require(\n (value == 0) || (token.allowance(address(this), spender) == 0),\n \"SafeERC20: approve from non-zero to non-zero allowance\"\n );\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\n }\n\n function safeIncreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n uint256 newAllowance = token.allowance(address(this), spender) + value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n\n function safeDecreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n unchecked {\n uint256 oldAllowance = token.allowance(address(this), spender);\n require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\n uint256 newAllowance = oldAllowance - value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n }\n\n function safePermit(\n IERC20Permit token,\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal {\n uint256 nonceBefore = token.nonces(owner);\n token.permit(owner, spender, value, deadline, v, r, s);\n uint256 nonceAfter = token.nonces(owner);\n require(nonceAfter == nonceBefore + 1, \"SafeERC20: permit did not succeed\");\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data, \"SafeERC20: low-level call failed\");\n if (returndata.length > 0) {\n // Return data is optional\n require(abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Address.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Context.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Counters.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Counters.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @title Counters\n * @author Matt Condon (@shrugs)\n * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number\n * of elements in a mapping, issuing ERC721 ids, or counting request ids.\n *\n * Include with `using Counters for Counters.Counter;`\n */\nlibrary Counters {\n struct Counter {\n // This variable should never be directly accessed by users of the library: interactions must be restricted to\n // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add\n // this feature: see https://github.com/ethereum/solidity/issues/4637\n uint256 _value; // default: 0\n }\n\n function current(Counter storage counter) internal view returns (uint256) {\n return counter._value;\n }\n\n function increment(Counter storage counter) internal {\n unchecked {\n counter._value += 1;\n }\n }\n\n function decrement(Counter storage counter) internal {\n uint256 value = counter._value;\n require(value > 0, \"Counter: decrement overflow\");\n unchecked {\n counter._value = value - 1;\n }\n }\n\n function reset(Counter storage counter) internal {\n counter._value = 0;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/cryptography/ECDSA.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/ECDSA.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../Strings.sol\";\n\n/**\n * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.\n *\n * These functions can be used to verify that a message was signed by the holder\n * of the private keys of a given address.\n */\nlibrary ECDSA {\n enum RecoverError {\n NoError,\n InvalidSignature,\n InvalidSignatureLength,\n InvalidSignatureS,\n InvalidSignatureV // Deprecated in v4.8\n }\n\n function _throwError(RecoverError error) private pure {\n if (error == RecoverError.NoError) {\n return; // no error: do nothing\n } else if (error == RecoverError.InvalidSignature) {\n revert(\"ECDSA: invalid signature\");\n } else if (error == RecoverError.InvalidSignatureLength) {\n revert(\"ECDSA: invalid signature length\");\n } else if (error == RecoverError.InvalidSignatureS) {\n revert(\"ECDSA: invalid signature 's' value\");\n }\n }\n\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with\n * `signature` or error string. This address can then be used for verification purposes.\n *\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {toEthSignedMessageHash} on it.\n *\n * Documentation for signature generation:\n * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]\n * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]\n *\n * _Available since v4.3._\n */\n function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {\n if (signature.length == 65) {\n bytes32 r;\n bytes32 s;\n uint8 v;\n // ecrecover takes the signature parameters, and the only way to get them\n // currently is to use assembly.\n /// @solidity memory-safe-assembly\n assembly {\n r := mload(add(signature, 0x20))\n s := mload(add(signature, 0x40))\n v := byte(0, mload(add(signature, 0x60)))\n }\n return tryRecover(hash, v, r, s);\n } else {\n return (address(0), RecoverError.InvalidSignatureLength);\n }\n }\n\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with\n * `signature`. This address can then be used for verification purposes.\n *\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {toEthSignedMessageHash} on it.\n */\n function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, signature);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.\n *\n * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]\n *\n * _Available since v4.3._\n */\n function tryRecover(\n bytes32 hash,\n bytes32 r,\n bytes32 vs\n ) internal pure returns (address, RecoverError) {\n bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);\n uint8 v = uint8((uint256(vs) >> 255) + 27);\n return tryRecover(hash, v, r, s);\n }\n\n /**\n * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.\n *\n * _Available since v4.2._\n */\n function recover(\n bytes32 hash,\n bytes32 r,\n bytes32 vs\n ) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, r, vs);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Overload of {ECDSA-tryRecover} that receives the `v`,\n * `r` and `s` signature fields separately.\n *\n * _Available since v4.3._\n */\n function tryRecover(\n bytes32 hash,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal pure returns (address, RecoverError) {\n // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature\n // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines\n // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most\n // signatures from current libraries generate a unique signature with an s-value in the lower half order.\n //\n // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value\n // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or\n // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept\n // these malleable signatures as well.\n if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {\n return (address(0), RecoverError.InvalidSignatureS);\n }\n\n // If the signature is valid (and not malleable), return the signer address\n address signer = ecrecover(hash, v, r, s);\n if (signer == address(0)) {\n return (address(0), RecoverError.InvalidSignature);\n }\n\n return (signer, RecoverError.NoError);\n }\n\n /**\n * @dev Overload of {ECDSA-recover} that receives the `v`,\n * `r` and `s` signature fields separately.\n */\n function recover(\n bytes32 hash,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, v, r, s);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Returns an Ethereum Signed Message, created from a `hash`. This\n * produces hash corresponding to the one signed with the\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n * JSON-RPC method as part of EIP-191.\n *\n * See {recover}.\n */\n function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {\n // 32 is the length in bytes of hash,\n // enforced by the type signature above\n return keccak256(abi.encodePacked(\"\\x19Ethereum Signed Message:\\n32\", hash));\n }\n\n /**\n * @dev Returns an Ethereum Signed Message, created from `s`. This\n * produces hash corresponding to the one signed with the\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n * JSON-RPC method as part of EIP-191.\n *\n * See {recover}.\n */\n function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(\"\\x19Ethereum Signed Message:\\n\", Strings.toString(s.length), s));\n }\n\n /**\n * @dev Returns an Ethereum Signed Typed Data, created from a\n * `domainSeparator` and a `structHash`. This produces hash corresponding\n * to the one signed with the\n * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]\n * JSON-RPC method as part of EIP-712.\n *\n * See {recover}.\n */\n function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(\"\\x19\\x01\", domainSeparator, structHash));\n }\n}\n" + }, + "@openzeppelin/contracts/utils/cryptography/EIP712.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/EIP712.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./ECDSA.sol\";\n\n/**\n * @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data.\n *\n * The encoding specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible,\n * thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding\n * they need in their contracts using a combination of `abi.encode` and `keccak256`.\n *\n * This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding\n * scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA\n * ({_hashTypedDataV4}).\n *\n * The implementation of the domain separator was designed to be as efficient as possible while still properly updating\n * the chain id to protect against replay attacks on an eventual fork of the chain.\n *\n * NOTE: This contract implements the version of the encoding known as \"v4\", as implemented by the JSON RPC method\n * https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask].\n *\n * _Available since v3.4._\n */\nabstract contract EIP712 {\n /* solhint-disable var-name-mixedcase */\n // Cache the domain separator as an immutable value, but also store the chain id that it corresponds to, in order to\n // invalidate the cached domain separator if the chain id changes.\n bytes32 private immutable _CACHED_DOMAIN_SEPARATOR;\n uint256 private immutable _CACHED_CHAIN_ID;\n address private immutable _CACHED_THIS;\n\n bytes32 private immutable _HASHED_NAME;\n bytes32 private immutable _HASHED_VERSION;\n bytes32 private immutable _TYPE_HASH;\n\n /* solhint-enable var-name-mixedcase */\n\n /**\n * @dev Initializes the domain separator and parameter caches.\n *\n * The meaning of `name` and `version` is specified in\n * https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]:\n *\n * - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol.\n * - `version`: the current major version of the signing domain.\n *\n * NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart\n * contract upgrade].\n */\n constructor(string memory name, string memory version) {\n bytes32 hashedName = keccak256(bytes(name));\n bytes32 hashedVersion = keccak256(bytes(version));\n bytes32 typeHash = keccak256(\n \"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)\"\n );\n _HASHED_NAME = hashedName;\n _HASHED_VERSION = hashedVersion;\n _CACHED_CHAIN_ID = block.chainid;\n _CACHED_DOMAIN_SEPARATOR = _buildDomainSeparator(typeHash, hashedName, hashedVersion);\n _CACHED_THIS = address(this);\n _TYPE_HASH = typeHash;\n }\n\n /**\n * @dev Returns the domain separator for the current chain.\n */\n function _domainSeparatorV4() internal view returns (bytes32) {\n if (address(this) == _CACHED_THIS && block.chainid == _CACHED_CHAIN_ID) {\n return _CACHED_DOMAIN_SEPARATOR;\n } else {\n return _buildDomainSeparator(_TYPE_HASH, _HASHED_NAME, _HASHED_VERSION);\n }\n }\n\n function _buildDomainSeparator(\n bytes32 typeHash,\n bytes32 nameHash,\n bytes32 versionHash\n ) private view returns (bytes32) {\n return keccak256(abi.encode(typeHash, nameHash, versionHash, block.chainid, address(this)));\n }\n\n /**\n * @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this\n * function returns the hash of the fully encoded EIP712 message for this domain.\n *\n * This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example:\n *\n * ```solidity\n * bytes32 digest = _hashTypedDataV4(keccak256(abi.encode(\n * keccak256(\"Mail(address to,string contents)\"),\n * mailTo,\n * keccak256(bytes(mailContents))\n * )));\n * address signer = ECDSA.recover(digest, signature);\n * ```\n */\n function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) {\n return ECDSA.toTypedDataHash(_domainSeparatorV4(), structHash);\n }\n}\n" + }, + "@openzeppelin/contracts/utils/math/Math.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary Math {\n enum Rounding {\n Down, // Toward negative infinity\n Up, // Toward infinity\n Zero // Toward zero\n }\n\n /**\n * @dev Returns the largest of two numbers.\n */\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two numbers.\n */\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two numbers. The result is rounded towards\n * zero.\n */\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b) / 2 can overflow.\n return (a & b) + (a ^ b) / 2;\n }\n\n /**\n * @dev Returns the ceiling of the division of two numbers.\n *\n * This differs from standard division with `/` in that it rounds up instead\n * of rounding down.\n */\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b - 1) / b can overflow on addition, so we distribute.\n return a == 0 ? 0 : (a - 1) / b + 1;\n }\n\n /**\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\n * with further edits by Uniswap Labs also under MIT license.\n */\n function mulDiv(\n uint256 x,\n uint256 y,\n uint256 denominator\n ) internal pure returns (uint256 result) {\n unchecked {\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\n // variables such that product = prod1 * 2^256 + prod0.\n uint256 prod0; // Least significant 256 bits of the product\n uint256 prod1; // Most significant 256 bits of the product\n assembly {\n let mm := mulmod(x, y, not(0))\n prod0 := mul(x, y)\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n }\n\n // Handle non-overflow cases, 256 by 256 division.\n if (prod1 == 0) {\n return prod0 / denominator;\n }\n\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\n require(denominator > prod1);\n\n ///////////////////////////////////////////////\n // 512 by 256 division.\n ///////////////////////////////////////////////\n\n // Make division exact by subtracting the remainder from [prod1 prod0].\n uint256 remainder;\n assembly {\n // Compute remainder using mulmod.\n remainder := mulmod(x, y, denominator)\n\n // Subtract 256 bit number from 512 bit number.\n prod1 := sub(prod1, gt(remainder, prod0))\n prod0 := sub(prod0, remainder)\n }\n\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\n // See https://cs.stackexchange.com/q/138556/92363.\n\n // Does not overflow because the denominator cannot be zero at this stage in the function.\n uint256 twos = denominator & (~denominator + 1);\n assembly {\n // Divide denominator by twos.\n denominator := div(denominator, twos)\n\n // Divide [prod1 prod0] by twos.\n prod0 := div(prod0, twos)\n\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\n twos := add(div(sub(0, twos), twos), 1)\n }\n\n // Shift in bits from prod1 into prod0.\n prod0 |= prod1 * twos;\n\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\n // four bits. That is, denominator * inv = 1 mod 2^4.\n uint256 inverse = (3 * denominator) ^ 2;\n\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\n // in modular arithmetic, doubling the correct bits in each step.\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\n\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\n // is no longer required.\n result = prod0 * inverse;\n return result;\n }\n }\n\n /**\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\n */\n function mulDiv(\n uint256 x,\n uint256 y,\n uint256 denominator,\n Rounding rounding\n ) internal pure returns (uint256) {\n uint256 result = mulDiv(x, y, denominator);\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\n result += 1;\n }\n return result;\n }\n\n /**\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\n *\n * Inspired by Henry S. Warren, Jr.'s \"Hacker's Delight\" (Chapter 11).\n */\n function sqrt(uint256 a) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\n //\n // We know that the \"msb\" (most significant bit) of our target number `a` is a power of 2 such that we have\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\n //\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\n // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\n // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\n //\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\n uint256 result = 1 << (log2(a) >> 1);\n\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\n // into the expected uint128 result.\n unchecked {\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n return min(result, a / result);\n }\n }\n\n /**\n * @notice Calculates sqrt(a), following the selected rounding direction.\n */\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = sqrt(a);\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 2, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 128;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 64;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 32;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 16;\n }\n if (value >> 8 > 0) {\n value >>= 8;\n result += 8;\n }\n if (value >> 4 > 0) {\n value >>= 4;\n result += 4;\n }\n if (value >> 2 > 0) {\n value >>= 2;\n result += 2;\n }\n if (value >> 1 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log2(value);\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 10, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >= 10**64) {\n value /= 10**64;\n result += 64;\n }\n if (value >= 10**32) {\n value /= 10**32;\n result += 32;\n }\n if (value >= 10**16) {\n value /= 10**16;\n result += 16;\n }\n if (value >= 10**8) {\n value /= 10**8;\n result += 8;\n }\n if (value >= 10**4) {\n value /= 10**4;\n result += 4;\n }\n if (value >= 10**2) {\n value /= 10**2;\n result += 2;\n }\n if (value >= 10**1) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log10(value);\n return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 256, rounded down, of a positive value.\n * Returns 0 if given 0.\n *\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\n */\n function log256(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 16;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 8;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 4;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 2;\n }\n if (value >> 8 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log256(value);\n return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/math/SafeCast.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SafeCast.sol)\n// This file was procedurally generated from scripts/generate/templates/SafeCast.js.\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Wrappers over Solidity's uintXX/intXX casting operators with added overflow\n * checks.\n *\n * Downcasting from uint256/int256 in Solidity does not revert on overflow. This can\n * easily result in undesired exploitation or bugs, since developers usually\n * assume that overflows raise errors. `SafeCast` restores this intuition by\n * reverting the transaction when such an operation overflows.\n *\n * Using this library instead of the unchecked operations eliminates an entire\n * class of bugs, so it's recommended to use it always.\n *\n * Can be combined with {SafeMath} and {SignedSafeMath} to extend it to smaller types, by performing\n * all math on `uint256` and `int256` and then downcasting.\n */\nlibrary SafeCast {\n /**\n * @dev Returns the downcasted uint248 from uint256, reverting on\n * overflow (when the input is greater than largest uint248).\n *\n * Counterpart to Solidity's `uint248` operator.\n *\n * Requirements:\n *\n * - input must fit into 248 bits\n *\n * _Available since v4.7._\n */\n function toUint248(uint256 value) internal pure returns (uint248) {\n require(value <= type(uint248).max, \"SafeCast: value doesn't fit in 248 bits\");\n return uint248(value);\n }\n\n /**\n * @dev Returns the downcasted uint240 from uint256, reverting on\n * overflow (when the input is greater than largest uint240).\n *\n * Counterpart to Solidity's `uint240` operator.\n *\n * Requirements:\n *\n * - input must fit into 240 bits\n *\n * _Available since v4.7._\n */\n function toUint240(uint256 value) internal pure returns (uint240) {\n require(value <= type(uint240).max, \"SafeCast: value doesn't fit in 240 bits\");\n return uint240(value);\n }\n\n /**\n * @dev Returns the downcasted uint232 from uint256, reverting on\n * overflow (when the input is greater than largest uint232).\n *\n * Counterpart to Solidity's `uint232` operator.\n *\n * Requirements:\n *\n * - input must fit into 232 bits\n *\n * _Available since v4.7._\n */\n function toUint232(uint256 value) internal pure returns (uint232) {\n require(value <= type(uint232).max, \"SafeCast: value doesn't fit in 232 bits\");\n return uint232(value);\n }\n\n /**\n * @dev Returns the downcasted uint224 from uint256, reverting on\n * overflow (when the input is greater than largest uint224).\n *\n * Counterpart to Solidity's `uint224` operator.\n *\n * Requirements:\n *\n * - input must fit into 224 bits\n *\n * _Available since v4.2._\n */\n function toUint224(uint256 value) internal pure returns (uint224) {\n require(value <= type(uint224).max, \"SafeCast: value doesn't fit in 224 bits\");\n return uint224(value);\n }\n\n /**\n * @dev Returns the downcasted uint216 from uint256, reverting on\n * overflow (when the input is greater than largest uint216).\n *\n * Counterpart to Solidity's `uint216` operator.\n *\n * Requirements:\n *\n * - input must fit into 216 bits\n *\n * _Available since v4.7._\n */\n function toUint216(uint256 value) internal pure returns (uint216) {\n require(value <= type(uint216).max, \"SafeCast: value doesn't fit in 216 bits\");\n return uint216(value);\n }\n\n /**\n * @dev Returns the downcasted uint208 from uint256, reverting on\n * overflow (when the input is greater than largest uint208).\n *\n * Counterpart to Solidity's `uint208` operator.\n *\n * Requirements:\n *\n * - input must fit into 208 bits\n *\n * _Available since v4.7._\n */\n function toUint208(uint256 value) internal pure returns (uint208) {\n require(value <= type(uint208).max, \"SafeCast: value doesn't fit in 208 bits\");\n return uint208(value);\n }\n\n /**\n * @dev Returns the downcasted uint200 from uint256, reverting on\n * overflow (when the input is greater than largest uint200).\n *\n * Counterpart to Solidity's `uint200` operator.\n *\n * Requirements:\n *\n * - input must fit into 200 bits\n *\n * _Available since v4.7._\n */\n function toUint200(uint256 value) internal pure returns (uint200) {\n require(value <= type(uint200).max, \"SafeCast: value doesn't fit in 200 bits\");\n return uint200(value);\n }\n\n /**\n * @dev Returns the downcasted uint192 from uint256, reverting on\n * overflow (when the input is greater than largest uint192).\n *\n * Counterpart to Solidity's `uint192` operator.\n *\n * Requirements:\n *\n * - input must fit into 192 bits\n *\n * _Available since v4.7._\n */\n function toUint192(uint256 value) internal pure returns (uint192) {\n require(value <= type(uint192).max, \"SafeCast: value doesn't fit in 192 bits\");\n return uint192(value);\n }\n\n /**\n * @dev Returns the downcasted uint184 from uint256, reverting on\n * overflow (when the input is greater than largest uint184).\n *\n * Counterpart to Solidity's `uint184` operator.\n *\n * Requirements:\n *\n * - input must fit into 184 bits\n *\n * _Available since v4.7._\n */\n function toUint184(uint256 value) internal pure returns (uint184) {\n require(value <= type(uint184).max, \"SafeCast: value doesn't fit in 184 bits\");\n return uint184(value);\n }\n\n /**\n * @dev Returns the downcasted uint176 from uint256, reverting on\n * overflow (when the input is greater than largest uint176).\n *\n * Counterpart to Solidity's `uint176` operator.\n *\n * Requirements:\n *\n * - input must fit into 176 bits\n *\n * _Available since v4.7._\n */\n function toUint176(uint256 value) internal pure returns (uint176) {\n require(value <= type(uint176).max, \"SafeCast: value doesn't fit in 176 bits\");\n return uint176(value);\n }\n\n /**\n * @dev Returns the downcasted uint168 from uint256, reverting on\n * overflow (when the input is greater than largest uint168).\n *\n * Counterpart to Solidity's `uint168` operator.\n *\n * Requirements:\n *\n * - input must fit into 168 bits\n *\n * _Available since v4.7._\n */\n function toUint168(uint256 value) internal pure returns (uint168) {\n require(value <= type(uint168).max, \"SafeCast: value doesn't fit in 168 bits\");\n return uint168(value);\n }\n\n /**\n * @dev Returns the downcasted uint160 from uint256, reverting on\n * overflow (when the input is greater than largest uint160).\n *\n * Counterpart to Solidity's `uint160` operator.\n *\n * Requirements:\n *\n * - input must fit into 160 bits\n *\n * _Available since v4.7._\n */\n function toUint160(uint256 value) internal pure returns (uint160) {\n require(value <= type(uint160).max, \"SafeCast: value doesn't fit in 160 bits\");\n return uint160(value);\n }\n\n /**\n * @dev Returns the downcasted uint152 from uint256, reverting on\n * overflow (when the input is greater than largest uint152).\n *\n * Counterpart to Solidity's `uint152` operator.\n *\n * Requirements:\n *\n * - input must fit into 152 bits\n *\n * _Available since v4.7._\n */\n function toUint152(uint256 value) internal pure returns (uint152) {\n require(value <= type(uint152).max, \"SafeCast: value doesn't fit in 152 bits\");\n return uint152(value);\n }\n\n /**\n * @dev Returns the downcasted uint144 from uint256, reverting on\n * overflow (when the input is greater than largest uint144).\n *\n * Counterpart to Solidity's `uint144` operator.\n *\n * Requirements:\n *\n * - input must fit into 144 bits\n *\n * _Available since v4.7._\n */\n function toUint144(uint256 value) internal pure returns (uint144) {\n require(value <= type(uint144).max, \"SafeCast: value doesn't fit in 144 bits\");\n return uint144(value);\n }\n\n /**\n * @dev Returns the downcasted uint136 from uint256, reverting on\n * overflow (when the input is greater than largest uint136).\n *\n * Counterpart to Solidity's `uint136` operator.\n *\n * Requirements:\n *\n * - input must fit into 136 bits\n *\n * _Available since v4.7._\n */\n function toUint136(uint256 value) internal pure returns (uint136) {\n require(value <= type(uint136).max, \"SafeCast: value doesn't fit in 136 bits\");\n return uint136(value);\n }\n\n /**\n * @dev Returns the downcasted uint128 from uint256, reverting on\n * overflow (when the input is greater than largest uint128).\n *\n * Counterpart to Solidity's `uint128` operator.\n *\n * Requirements:\n *\n * - input must fit into 128 bits\n *\n * _Available since v2.5._\n */\n function toUint128(uint256 value) internal pure returns (uint128) {\n require(value <= type(uint128).max, \"SafeCast: value doesn't fit in 128 bits\");\n return uint128(value);\n }\n\n /**\n * @dev Returns the downcasted uint120 from uint256, reverting on\n * overflow (when the input is greater than largest uint120).\n *\n * Counterpart to Solidity's `uint120` operator.\n *\n * Requirements:\n *\n * - input must fit into 120 bits\n *\n * _Available since v4.7._\n */\n function toUint120(uint256 value) internal pure returns (uint120) {\n require(value <= type(uint120).max, \"SafeCast: value doesn't fit in 120 bits\");\n return uint120(value);\n }\n\n /**\n * @dev Returns the downcasted uint112 from uint256, reverting on\n * overflow (when the input is greater than largest uint112).\n *\n * Counterpart to Solidity's `uint112` operator.\n *\n * Requirements:\n *\n * - input must fit into 112 bits\n *\n * _Available since v4.7._\n */\n function toUint112(uint256 value) internal pure returns (uint112) {\n require(value <= type(uint112).max, \"SafeCast: value doesn't fit in 112 bits\");\n return uint112(value);\n }\n\n /**\n * @dev Returns the downcasted uint104 from uint256, reverting on\n * overflow (when the input is greater than largest uint104).\n *\n * Counterpart to Solidity's `uint104` operator.\n *\n * Requirements:\n *\n * - input must fit into 104 bits\n *\n * _Available since v4.7._\n */\n function toUint104(uint256 value) internal pure returns (uint104) {\n require(value <= type(uint104).max, \"SafeCast: value doesn't fit in 104 bits\");\n return uint104(value);\n }\n\n /**\n * @dev Returns the downcasted uint96 from uint256, reverting on\n * overflow (when the input is greater than largest uint96).\n *\n * Counterpart to Solidity's `uint96` operator.\n *\n * Requirements:\n *\n * - input must fit into 96 bits\n *\n * _Available since v4.2._\n */\n function toUint96(uint256 value) internal pure returns (uint96) {\n require(value <= type(uint96).max, \"SafeCast: value doesn't fit in 96 bits\");\n return uint96(value);\n }\n\n /**\n * @dev Returns the downcasted uint88 from uint256, reverting on\n * overflow (when the input is greater than largest uint88).\n *\n * Counterpart to Solidity's `uint88` operator.\n *\n * Requirements:\n *\n * - input must fit into 88 bits\n *\n * _Available since v4.7._\n */\n function toUint88(uint256 value) internal pure returns (uint88) {\n require(value <= type(uint88).max, \"SafeCast: value doesn't fit in 88 bits\");\n return uint88(value);\n }\n\n /**\n * @dev Returns the downcasted uint80 from uint256, reverting on\n * overflow (when the input is greater than largest uint80).\n *\n * Counterpart to Solidity's `uint80` operator.\n *\n * Requirements:\n *\n * - input must fit into 80 bits\n *\n * _Available since v4.7._\n */\n function toUint80(uint256 value) internal pure returns (uint80) {\n require(value <= type(uint80).max, \"SafeCast: value doesn't fit in 80 bits\");\n return uint80(value);\n }\n\n /**\n * @dev Returns the downcasted uint72 from uint256, reverting on\n * overflow (when the input is greater than largest uint72).\n *\n * Counterpart to Solidity's `uint72` operator.\n *\n * Requirements:\n *\n * - input must fit into 72 bits\n *\n * _Available since v4.7._\n */\n function toUint72(uint256 value) internal pure returns (uint72) {\n require(value <= type(uint72).max, \"SafeCast: value doesn't fit in 72 bits\");\n return uint72(value);\n }\n\n /**\n * @dev Returns the downcasted uint64 from uint256, reverting on\n * overflow (when the input is greater than largest uint64).\n *\n * Counterpart to Solidity's `uint64` operator.\n *\n * Requirements:\n *\n * - input must fit into 64 bits\n *\n * _Available since v2.5._\n */\n function toUint64(uint256 value) internal pure returns (uint64) {\n require(value <= type(uint64).max, \"SafeCast: value doesn't fit in 64 bits\");\n return uint64(value);\n }\n\n /**\n * @dev Returns the downcasted uint56 from uint256, reverting on\n * overflow (when the input is greater than largest uint56).\n *\n * Counterpart to Solidity's `uint56` operator.\n *\n * Requirements:\n *\n * - input must fit into 56 bits\n *\n * _Available since v4.7._\n */\n function toUint56(uint256 value) internal pure returns (uint56) {\n require(value <= type(uint56).max, \"SafeCast: value doesn't fit in 56 bits\");\n return uint56(value);\n }\n\n /**\n * @dev Returns the downcasted uint48 from uint256, reverting on\n * overflow (when the input is greater than largest uint48).\n *\n * Counterpart to Solidity's `uint48` operator.\n *\n * Requirements:\n *\n * - input must fit into 48 bits\n *\n * _Available since v4.7._\n */\n function toUint48(uint256 value) internal pure returns (uint48) {\n require(value <= type(uint48).max, \"SafeCast: value doesn't fit in 48 bits\");\n return uint48(value);\n }\n\n /**\n * @dev Returns the downcasted uint40 from uint256, reverting on\n * overflow (when the input is greater than largest uint40).\n *\n * Counterpart to Solidity's `uint40` operator.\n *\n * Requirements:\n *\n * - input must fit into 40 bits\n *\n * _Available since v4.7._\n */\n function toUint40(uint256 value) internal pure returns (uint40) {\n require(value <= type(uint40).max, \"SafeCast: value doesn't fit in 40 bits\");\n return uint40(value);\n }\n\n /**\n * @dev Returns the downcasted uint32 from uint256, reverting on\n * overflow (when the input is greater than largest uint32).\n *\n * Counterpart to Solidity's `uint32` operator.\n *\n * Requirements:\n *\n * - input must fit into 32 bits\n *\n * _Available since v2.5._\n */\n function toUint32(uint256 value) internal pure returns (uint32) {\n require(value <= type(uint32).max, \"SafeCast: value doesn't fit in 32 bits\");\n return uint32(value);\n }\n\n /**\n * @dev Returns the downcasted uint24 from uint256, reverting on\n * overflow (when the input is greater than largest uint24).\n *\n * Counterpart to Solidity's `uint24` operator.\n *\n * Requirements:\n *\n * - input must fit into 24 bits\n *\n * _Available since v4.7._\n */\n function toUint24(uint256 value) internal pure returns (uint24) {\n require(value <= type(uint24).max, \"SafeCast: value doesn't fit in 24 bits\");\n return uint24(value);\n }\n\n /**\n * @dev Returns the downcasted uint16 from uint256, reverting on\n * overflow (when the input is greater than largest uint16).\n *\n * Counterpart to Solidity's `uint16` operator.\n *\n * Requirements:\n *\n * - input must fit into 16 bits\n *\n * _Available since v2.5._\n */\n function toUint16(uint256 value) internal pure returns (uint16) {\n require(value <= type(uint16).max, \"SafeCast: value doesn't fit in 16 bits\");\n return uint16(value);\n }\n\n /**\n * @dev Returns the downcasted uint8 from uint256, reverting on\n * overflow (when the input is greater than largest uint8).\n *\n * Counterpart to Solidity's `uint8` operator.\n *\n * Requirements:\n *\n * - input must fit into 8 bits\n *\n * _Available since v2.5._\n */\n function toUint8(uint256 value) internal pure returns (uint8) {\n require(value <= type(uint8).max, \"SafeCast: value doesn't fit in 8 bits\");\n return uint8(value);\n }\n\n /**\n * @dev Converts a signed int256 into an unsigned uint256.\n *\n * Requirements:\n *\n * - input must be greater than or equal to 0.\n *\n * _Available since v3.0._\n */\n function toUint256(int256 value) internal pure returns (uint256) {\n require(value >= 0, \"SafeCast: value must be positive\");\n return uint256(value);\n }\n\n /**\n * @dev Returns the downcasted int248 from int256, reverting on\n * overflow (when the input is less than smallest int248 or\n * greater than largest int248).\n *\n * Counterpart to Solidity's `int248` operator.\n *\n * Requirements:\n *\n * - input must fit into 248 bits\n *\n * _Available since v4.7._\n */\n function toInt248(int256 value) internal pure returns (int248 downcasted) {\n downcasted = int248(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 248 bits\");\n }\n\n /**\n * @dev Returns the downcasted int240 from int256, reverting on\n * overflow (when the input is less than smallest int240 or\n * greater than largest int240).\n *\n * Counterpart to Solidity's `int240` operator.\n *\n * Requirements:\n *\n * - input must fit into 240 bits\n *\n * _Available since v4.7._\n */\n function toInt240(int256 value) internal pure returns (int240 downcasted) {\n downcasted = int240(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 240 bits\");\n }\n\n /**\n * @dev Returns the downcasted int232 from int256, reverting on\n * overflow (when the input is less than smallest int232 or\n * greater than largest int232).\n *\n * Counterpart to Solidity's `int232` operator.\n *\n * Requirements:\n *\n * - input must fit into 232 bits\n *\n * _Available since v4.7._\n */\n function toInt232(int256 value) internal pure returns (int232 downcasted) {\n downcasted = int232(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 232 bits\");\n }\n\n /**\n * @dev Returns the downcasted int224 from int256, reverting on\n * overflow (when the input is less than smallest int224 or\n * greater than largest int224).\n *\n * Counterpart to Solidity's `int224` operator.\n *\n * Requirements:\n *\n * - input must fit into 224 bits\n *\n * _Available since v4.7._\n */\n function toInt224(int256 value) internal pure returns (int224 downcasted) {\n downcasted = int224(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 224 bits\");\n }\n\n /**\n * @dev Returns the downcasted int216 from int256, reverting on\n * overflow (when the input is less than smallest int216 or\n * greater than largest int216).\n *\n * Counterpart to Solidity's `int216` operator.\n *\n * Requirements:\n *\n * - input must fit into 216 bits\n *\n * _Available since v4.7._\n */\n function toInt216(int256 value) internal pure returns (int216 downcasted) {\n downcasted = int216(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 216 bits\");\n }\n\n /**\n * @dev Returns the downcasted int208 from int256, reverting on\n * overflow (when the input is less than smallest int208 or\n * greater than largest int208).\n *\n * Counterpart to Solidity's `int208` operator.\n *\n * Requirements:\n *\n * - input must fit into 208 bits\n *\n * _Available since v4.7._\n */\n function toInt208(int256 value) internal pure returns (int208 downcasted) {\n downcasted = int208(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 208 bits\");\n }\n\n /**\n * @dev Returns the downcasted int200 from int256, reverting on\n * overflow (when the input is less than smallest int200 or\n * greater than largest int200).\n *\n * Counterpart to Solidity's `int200` operator.\n *\n * Requirements:\n *\n * - input must fit into 200 bits\n *\n * _Available since v4.7._\n */\n function toInt200(int256 value) internal pure returns (int200 downcasted) {\n downcasted = int200(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 200 bits\");\n }\n\n /**\n * @dev Returns the downcasted int192 from int256, reverting on\n * overflow (when the input is less than smallest int192 or\n * greater than largest int192).\n *\n * Counterpart to Solidity's `int192` operator.\n *\n * Requirements:\n *\n * - input must fit into 192 bits\n *\n * _Available since v4.7._\n */\n function toInt192(int256 value) internal pure returns (int192 downcasted) {\n downcasted = int192(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 192 bits\");\n }\n\n /**\n * @dev Returns the downcasted int184 from int256, reverting on\n * overflow (when the input is less than smallest int184 or\n * greater than largest int184).\n *\n * Counterpart to Solidity's `int184` operator.\n *\n * Requirements:\n *\n * - input must fit into 184 bits\n *\n * _Available since v4.7._\n */\n function toInt184(int256 value) internal pure returns (int184 downcasted) {\n downcasted = int184(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 184 bits\");\n }\n\n /**\n * @dev Returns the downcasted int176 from int256, reverting on\n * overflow (when the input is less than smallest int176 or\n * greater than largest int176).\n *\n * Counterpart to Solidity's `int176` operator.\n *\n * Requirements:\n *\n * - input must fit into 176 bits\n *\n * _Available since v4.7._\n */\n function toInt176(int256 value) internal pure returns (int176 downcasted) {\n downcasted = int176(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 176 bits\");\n }\n\n /**\n * @dev Returns the downcasted int168 from int256, reverting on\n * overflow (when the input is less than smallest int168 or\n * greater than largest int168).\n *\n * Counterpart to Solidity's `int168` operator.\n *\n * Requirements:\n *\n * - input must fit into 168 bits\n *\n * _Available since v4.7._\n */\n function toInt168(int256 value) internal pure returns (int168 downcasted) {\n downcasted = int168(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 168 bits\");\n }\n\n /**\n * @dev Returns the downcasted int160 from int256, reverting on\n * overflow (when the input is less than smallest int160 or\n * greater than largest int160).\n *\n * Counterpart to Solidity's `int160` operator.\n *\n * Requirements:\n *\n * - input must fit into 160 bits\n *\n * _Available since v4.7._\n */\n function toInt160(int256 value) internal pure returns (int160 downcasted) {\n downcasted = int160(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 160 bits\");\n }\n\n /**\n * @dev Returns the downcasted int152 from int256, reverting on\n * overflow (when the input is less than smallest int152 or\n * greater than largest int152).\n *\n * Counterpart to Solidity's `int152` operator.\n *\n * Requirements:\n *\n * - input must fit into 152 bits\n *\n * _Available since v4.7._\n */\n function toInt152(int256 value) internal pure returns (int152 downcasted) {\n downcasted = int152(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 152 bits\");\n }\n\n /**\n * @dev Returns the downcasted int144 from int256, reverting on\n * overflow (when the input is less than smallest int144 or\n * greater than largest int144).\n *\n * Counterpart to Solidity's `int144` operator.\n *\n * Requirements:\n *\n * - input must fit into 144 bits\n *\n * _Available since v4.7._\n */\n function toInt144(int256 value) internal pure returns (int144 downcasted) {\n downcasted = int144(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 144 bits\");\n }\n\n /**\n * @dev Returns the downcasted int136 from int256, reverting on\n * overflow (when the input is less than smallest int136 or\n * greater than largest int136).\n *\n * Counterpart to Solidity's `int136` operator.\n *\n * Requirements:\n *\n * - input must fit into 136 bits\n *\n * _Available since v4.7._\n */\n function toInt136(int256 value) internal pure returns (int136 downcasted) {\n downcasted = int136(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 136 bits\");\n }\n\n /**\n * @dev Returns the downcasted int128 from int256, reverting on\n * overflow (when the input is less than smallest int128 or\n * greater than largest int128).\n *\n * Counterpart to Solidity's `int128` operator.\n *\n * Requirements:\n *\n * - input must fit into 128 bits\n *\n * _Available since v3.1._\n */\n function toInt128(int256 value) internal pure returns (int128 downcasted) {\n downcasted = int128(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 128 bits\");\n }\n\n /**\n * @dev Returns the downcasted int120 from int256, reverting on\n * overflow (when the input is less than smallest int120 or\n * greater than largest int120).\n *\n * Counterpart to Solidity's `int120` operator.\n *\n * Requirements:\n *\n * - input must fit into 120 bits\n *\n * _Available since v4.7._\n */\n function toInt120(int256 value) internal pure returns (int120 downcasted) {\n downcasted = int120(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 120 bits\");\n }\n\n /**\n * @dev Returns the downcasted int112 from int256, reverting on\n * overflow (when the input is less than smallest int112 or\n * greater than largest int112).\n *\n * Counterpart to Solidity's `int112` operator.\n *\n * Requirements:\n *\n * - input must fit into 112 bits\n *\n * _Available since v4.7._\n */\n function toInt112(int256 value) internal pure returns (int112 downcasted) {\n downcasted = int112(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 112 bits\");\n }\n\n /**\n * @dev Returns the downcasted int104 from int256, reverting on\n * overflow (when the input is less than smallest int104 or\n * greater than largest int104).\n *\n * Counterpart to Solidity's `int104` operator.\n *\n * Requirements:\n *\n * - input must fit into 104 bits\n *\n * _Available since v4.7._\n */\n function toInt104(int256 value) internal pure returns (int104 downcasted) {\n downcasted = int104(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 104 bits\");\n }\n\n /**\n * @dev Returns the downcasted int96 from int256, reverting on\n * overflow (when the input is less than smallest int96 or\n * greater than largest int96).\n *\n * Counterpart to Solidity's `int96` operator.\n *\n * Requirements:\n *\n * - input must fit into 96 bits\n *\n * _Available since v4.7._\n */\n function toInt96(int256 value) internal pure returns (int96 downcasted) {\n downcasted = int96(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 96 bits\");\n }\n\n /**\n * @dev Returns the downcasted int88 from int256, reverting on\n * overflow (when the input is less than smallest int88 or\n * greater than largest int88).\n *\n * Counterpart to Solidity's `int88` operator.\n *\n * Requirements:\n *\n * - input must fit into 88 bits\n *\n * _Available since v4.7._\n */\n function toInt88(int256 value) internal pure returns (int88 downcasted) {\n downcasted = int88(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 88 bits\");\n }\n\n /**\n * @dev Returns the downcasted int80 from int256, reverting on\n * overflow (when the input is less than smallest int80 or\n * greater than largest int80).\n *\n * Counterpart to Solidity's `int80` operator.\n *\n * Requirements:\n *\n * - input must fit into 80 bits\n *\n * _Available since v4.7._\n */\n function toInt80(int256 value) internal pure returns (int80 downcasted) {\n downcasted = int80(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 80 bits\");\n }\n\n /**\n * @dev Returns the downcasted int72 from int256, reverting on\n * overflow (when the input is less than smallest int72 or\n * greater than largest int72).\n *\n * Counterpart to Solidity's `int72` operator.\n *\n * Requirements:\n *\n * - input must fit into 72 bits\n *\n * _Available since v4.7._\n */\n function toInt72(int256 value) internal pure returns (int72 downcasted) {\n downcasted = int72(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 72 bits\");\n }\n\n /**\n * @dev Returns the downcasted int64 from int256, reverting on\n * overflow (when the input is less than smallest int64 or\n * greater than largest int64).\n *\n * Counterpart to Solidity's `int64` operator.\n *\n * Requirements:\n *\n * - input must fit into 64 bits\n *\n * _Available since v3.1._\n */\n function toInt64(int256 value) internal pure returns (int64 downcasted) {\n downcasted = int64(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 64 bits\");\n }\n\n /**\n * @dev Returns the downcasted int56 from int256, reverting on\n * overflow (when the input is less than smallest int56 or\n * greater than largest int56).\n *\n * Counterpart to Solidity's `int56` operator.\n *\n * Requirements:\n *\n * - input must fit into 56 bits\n *\n * _Available since v4.7._\n */\n function toInt56(int256 value) internal pure returns (int56 downcasted) {\n downcasted = int56(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 56 bits\");\n }\n\n /**\n * @dev Returns the downcasted int48 from int256, reverting on\n * overflow (when the input is less than smallest int48 or\n * greater than largest int48).\n *\n * Counterpart to Solidity's `int48` operator.\n *\n * Requirements:\n *\n * - input must fit into 48 bits\n *\n * _Available since v4.7._\n */\n function toInt48(int256 value) internal pure returns (int48 downcasted) {\n downcasted = int48(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 48 bits\");\n }\n\n /**\n * @dev Returns the downcasted int40 from int256, reverting on\n * overflow (when the input is less than smallest int40 or\n * greater than largest int40).\n *\n * Counterpart to Solidity's `int40` operator.\n *\n * Requirements:\n *\n * - input must fit into 40 bits\n *\n * _Available since v4.7._\n */\n function toInt40(int256 value) internal pure returns (int40 downcasted) {\n downcasted = int40(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 40 bits\");\n }\n\n /**\n * @dev Returns the downcasted int32 from int256, reverting on\n * overflow (when the input is less than smallest int32 or\n * greater than largest int32).\n *\n * Counterpart to Solidity's `int32` operator.\n *\n * Requirements:\n *\n * - input must fit into 32 bits\n *\n * _Available since v3.1._\n */\n function toInt32(int256 value) internal pure returns (int32 downcasted) {\n downcasted = int32(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 32 bits\");\n }\n\n /**\n * @dev Returns the downcasted int24 from int256, reverting on\n * overflow (when the input is less than smallest int24 or\n * greater than largest int24).\n *\n * Counterpart to Solidity's `int24` operator.\n *\n * Requirements:\n *\n * - input must fit into 24 bits\n *\n * _Available since v4.7._\n */\n function toInt24(int256 value) internal pure returns (int24 downcasted) {\n downcasted = int24(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 24 bits\");\n }\n\n /**\n * @dev Returns the downcasted int16 from int256, reverting on\n * overflow (when the input is less than smallest int16 or\n * greater than largest int16).\n *\n * Counterpart to Solidity's `int16` operator.\n *\n * Requirements:\n *\n * - input must fit into 16 bits\n *\n * _Available since v3.1._\n */\n function toInt16(int256 value) internal pure returns (int16 downcasted) {\n downcasted = int16(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 16 bits\");\n }\n\n /**\n * @dev Returns the downcasted int8 from int256, reverting on\n * overflow (when the input is less than smallest int8 or\n * greater than largest int8).\n *\n * Counterpart to Solidity's `int8` operator.\n *\n * Requirements:\n *\n * - input must fit into 8 bits\n *\n * _Available since v3.1._\n */\n function toInt8(int256 value) internal pure returns (int8 downcasted) {\n downcasted = int8(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 8 bits\");\n }\n\n /**\n * @dev Converts an unsigned uint256 into a signed int256.\n *\n * Requirements:\n *\n * - input must be less than or equal to maxInt256.\n *\n * _Available since v3.0._\n */\n function toInt256(uint256 value) internal pure returns (int256) {\n // Note: Unsafe cast below is okay because `type(int256).max` is guaranteed to be positive\n require(value <= uint256(type(int256).max), \"SafeCast: value doesn't fit in an int256\");\n return int256(value);\n }\n}\n" + }, + "@openzeppelin/contracts/utils/StorageSlot.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/StorageSlot.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Library for reading and writing primitive types to specific storage slots.\n *\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\n * This library helps with reading and writing to such slots without the need for inline assembly.\n *\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\n *\n * Example usage to set ERC1967 implementation slot:\n * ```\n * contract ERC1967 {\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n *\n * function _getImplementation() internal view returns (address) {\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\n * }\n *\n * function _setImplementation(address newImplementation) internal {\n * require(Address.isContract(newImplementation), \"ERC1967: new implementation is not a contract\");\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\n * }\n * }\n * ```\n *\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\n */\nlibrary StorageSlot {\n struct AddressSlot {\n address value;\n }\n\n struct BooleanSlot {\n bool value;\n }\n\n struct Bytes32Slot {\n bytes32 value;\n }\n\n struct Uint256Slot {\n uint256 value;\n }\n\n /**\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\n */\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\n */\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\n */\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\n */\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Strings.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./math/Math.sol\";\n\n/**\n * @dev String operations.\n */\nlibrary Strings {\n bytes16 private constant _SYMBOLS = \"0123456789abcdef\";\n uint8 private constant _ADDRESS_LENGTH = 20;\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n */\n function toString(uint256 value) internal pure returns (string memory) {\n unchecked {\n uint256 length = Math.log10(value) + 1;\n string memory buffer = new string(length);\n uint256 ptr;\n /// @solidity memory-safe-assembly\n assembly {\n ptr := add(buffer, add(32, length))\n }\n while (true) {\n ptr--;\n /// @solidity memory-safe-assembly\n assembly {\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\n }\n value /= 10;\n if (value == 0) break;\n }\n return buffer;\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n */\n function toHexString(uint256 value) internal pure returns (string memory) {\n unchecked {\n return toHexString(value, Math.log256(value) + 1);\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n */\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n bytes memory buffer = new bytes(2 * length + 2);\n buffer[0] = \"0\";\n buffer[1] = \"x\";\n for (uint256 i = 2 * length + 1; i > 1; --i) {\n buffer[i] = _SYMBOLS[value & 0xf];\n value >>= 4;\n }\n require(value == 0, \"Strings: hex length insufficient\");\n return string(buffer);\n }\n\n /**\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\n */\n function toHexString(address addr) internal pure returns (string memory) {\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\n }\n}\n" + }, + "contracts/deprecated/OldDistributor.sol": { + "content": "// SPDX-License-Identifier: BUSL-1.1\n\n/*\n * █ \n ***** ▓▓▓ \n * ▓▓▓▓▓▓▓ \n * ///. ▓▓▓▓▓▓▓▓▓▓▓▓▓ \n ***** //////// ▓▓▓▓▓▓▓ \n * ///////////// ▓▓▓ \n ▓▓ ////////////////// █ ▓▓ \n ▓▓ ▓▓ /////////////////////// ▓▓ ▓▓ \n ▓▓ ▓▓ //////////////////////////// ▓▓ ▓▓ \n ▓▓ ▓▓ /////////▓▓▓///////▓▓▓///////// ▓▓ ▓▓ \n ▓▓ ,////////////////////////////////////// ▓▓ ▓▓ \n ▓▓ ////////////////////////////////////////// ▓▓ \n ▓▓ //////////////////////▓▓▓▓///////////////////// \n ,//////////////////////////////////////////////////// \n .////////////////////////////////////////////////////////// \n .//////////////////////////██.,//////////////////////////█ \n .//////////////////////████..,./////////////////////██ \n ...////////////////███████.....,.////////////////███ \n ,.,////////////████████ ........,///////////████ \n .,.,//////█████████ ,.......///////████ \n ,..//████████ ........./████ \n ..,██████ .....,███ \n .██ ,.,█ \n \n \n \n ▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓ ▓▓▓▓▓▓▓▓▓▓ \n ▓▓▓▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓ ▓▓ ▓▓▓▓ \n ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓ ▓▓▓▓▓ \n ▓▓▓ ▓▓ ▓▓▓ ▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ \n*/\n\npragma solidity ^0.8.17;\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport \"@openzeppelin/contracts/utils/math/SafeCast.sol\";\n\nimport \"../utils/UUPSHelper.sol\";\n\nstruct MerkleTree {\n // Root of a Merkle tree which leaves are `(address user, address token, uint amount)`\n // representing an amount of tokens accumulated by `user`.\n // The Merkle tree is assumed to have only increasing amounts: that is to say if a user can claim 1,\n // then after the amount associated in the Merkle tree for this token should be x > 1\n bytes32 merkleRoot;\n // Ipfs hash of the tree data\n bytes32 ipfsHash;\n}\n\nstruct Claim {\n uint208 amount;\n uint48 timestamp;\n}\n\n/// @title OldDistributor\n/// @notice Allows LPs on AMMs with concentrated liquidity to claim the rewards that were distributed to them\n/// @author Angle Labs. Inc\ncontract OldDistributor is UUPSHelper {\n using SafeERC20 for IERC20;\n\n // ================================= VARIABLES =================================\n\n /// @notice Tree of claimable tokens through this contract\n MerkleTree public tree;\n\n /// @notice Tree that was in place in the contract before the last `tree` update\n MerkleTree public lastTree;\n\n /// @notice Token to deposit to freeze the roots update\n IERC20 public disputeToken;\n\n /// @notice `Core` contract handling access control\n ICore public core;\n\n /// @notice Address which created the dispute\n /// @dev Used to store if there is an ongoing dispute\n address public disputer;\n\n /// @notice Last time the `tree` was updated\n uint48 public lastTreeUpdate;\n\n /// @notice Time before which a change in a tree becomes effective\n uint48 public disputePeriod;\n\n /// @notice Amount to deposit to freeze the roots update\n uint256 public disputeAmount;\n\n /// @notice Mapping user -> token -> amount to track claimed amounts\n mapping(address => mapping(address => Claim)) public claimed;\n\n /// @notice Trusted EOAs to update the Merkle root\n mapping(address => uint256) public canUpdateMerkleRoot;\n\n /// @notice Whether or not to disable permissionless claiming\n mapping(address => uint256) public onlyOperatorCanClaim;\n\n /// @notice user -> operator -> authorisation to claim\n mapping(address => mapping(address => uint256)) public operators;\n\n uint256[38] private __gap;\n\n // =================================== EVENTS ==================================\n\n event Claimed(address user, address token, uint256 amount);\n event Disputed(string reason);\n event DisputePeriodUpdated(uint48 _disputePeriod);\n event DisputeTokenUpdated(address indexed _disputeToken);\n event DisputeAmountUpdated(uint256 _disputeAmount);\n event DisputeResolved(bool valid);\n event OperatorClaimingToggled(address user, bool isEnabled);\n event OperatorToggled(address user, address operator, bool isWhitelisted);\n event Recovered(address indexed token, address indexed to, uint256 amount);\n event TreeUpdated(bytes32 merkleRoot, bytes32 ipfsHash);\n event TrustedToggled(address indexed eoa, bool trust);\n\n // ================================= MODIFIERS =================================\n\n /// @notice Checks whether the `msg.sender` has the governor role or the guardian role\n modifier onlyGovernorOrGuardian() {\n if (!core.isGovernorOrGuardian(msg.sender)) revert NotGovernorOrGuardian();\n _;\n }\n\n /// @notice Checks whether the `msg.sender` is the `user` address or is a trusted address\n modifier onlyTrustedOrUser(address user) {\n if (user != msg.sender && canUpdateMerkleRoot[msg.sender] != 1 && !core.isGovernorOrGuardian(msg.sender))\n revert NotTrusted();\n _;\n }\n\n // ================================ CONSTRUCTOR ================================\n\n constructor() initializer {}\n\n function initialize(ICore _core) external initializer {\n if (address(_core) == address(0)) revert ZeroAddress();\n core = _core;\n }\n\n /// @inheritdoc UUPSUpgradeable\n function _authorizeUpgrade(address) internal view override onlyGuardianUpgrader(core) {}\n\n // =============================== MAIN FUNCTION ===============================\n\n /// @notice Claims rewards for a given set of users\n /// @dev Anyone may call this function for anyone else, funds go to destination regardless, it's just a question of\n /// who provides the proof and pays the gas: `msg.sender` is used only for addresses that require a trusted operator\n /// @param users Recipient of tokens\n /// @param tokens ERC20 claimed\n /// @param amounts Amount of tokens that will be sent to the corresponding users\n /// @param proofs Array of hashes bridging from a leaf `(hash of user | token | amount)` to the Merkle root\n function claim(\n address[] calldata users,\n address[] calldata tokens,\n uint256[] calldata amounts,\n bytes32[][] calldata proofs\n ) external {\n uint256 usersLength = users.length;\n if (\n usersLength == 0 ||\n usersLength != tokens.length ||\n usersLength != amounts.length ||\n usersLength != proofs.length\n ) revert InvalidLengths();\n\n for (uint256 i; i < usersLength; ) {\n address user = users[i];\n address token = tokens[i];\n uint256 amount = amounts[i];\n\n // Checking if only an approved operator can claim for `user`\n if (onlyOperatorCanClaim[user] == 1 && operators[user][msg.sender] == 0) revert NotWhitelisted();\n\n // Verifying proof\n bytes32 leaf = keccak256(abi.encode(user, token, amount));\n if (!_verifyProof(leaf, proofs[i])) revert InvalidProof();\n\n // Closing reentrancy gate here\n uint256 toSend = amount - claimed[user][token].amount;\n claimed[user][token] = Claim(SafeCast.toUint208(amount), uint48(block.timestamp));\n\n IERC20(token).safeTransfer(user, toSend);\n emit Claimed(user, token, toSend);\n unchecked {\n ++i;\n }\n }\n }\n\n /// @notice Returns the MerkleRoot that is currently live for the contract\n function getMerkleRoot() public view returns (bytes32) {\n if (block.timestamp - lastTreeUpdate >= disputePeriod) return tree.merkleRoot;\n else return lastTree.merkleRoot;\n }\n\n // ============================ GOVERNANCE FUNCTIONS ===========================\n\n /// @notice Adds or removes EOAs which are trusted to update the Merkle root\n function toggleTrusted(address eoa) external onlyGovernorOrGuardian {\n uint256 trustedStatus = 1 - canUpdateMerkleRoot[eoa];\n canUpdateMerkleRoot[eoa] = trustedStatus;\n emit TrustedToggled(eoa, trustedStatus == 1);\n }\n\n /// @notice Updates Merkle Tree\n function updateTree(MerkleTree calldata _tree) external {\n if (\n disputer != address(0) ||\n // A trusted address cannot update a tree right after a precedent tree update otherwise it can de facto\n // validate a tree which has not passed the dispute period\n ((canUpdateMerkleRoot[msg.sender] != 1 || block.timestamp - lastTreeUpdate < disputePeriod) &&\n !core.isGovernorOrGuardian(msg.sender))\n ) revert NotTrusted();\n MerkleTree memory _lastTree = tree;\n tree = _tree;\n lastTree = _lastTree;\n lastTreeUpdate = uint48(block.timestamp);\n emit TreeUpdated(_tree.merkleRoot, _tree.ipfsHash);\n }\n\n /// @notice Freezes the Merkle tree update until the dispute is resolved\n /// @dev Requires a deposit of `disputeToken` that'll be slashed if the dispute is not accepted\n /// @dev It is only possible to create a dispute for `disputePeriod` after each tree update\n function disputeTree(string memory reason) external {\n if (block.timestamp - lastTreeUpdate >= disputePeriod) revert InvalidDispute();\n IERC20(disputeToken).safeTransferFrom(msg.sender, address(this), disputeAmount);\n disputer = msg.sender;\n emit Disputed(reason);\n }\n\n /// @notice Resolve the ongoing dispute, if any\n /// @param valid Whether the dispute was valid\n function resolveDispute(bool valid) external onlyGovernorOrGuardian {\n if (disputer == address(0)) revert NoDispute();\n if (valid) {\n IERC20(disputeToken).safeTransfer(disputer, disputeAmount);\n // If a dispute is valid, the contract falls back to the last tree that was updated\n _revokeTree();\n } else {\n IERC20(disputeToken).safeTransfer(msg.sender, disputeAmount);\n lastTreeUpdate = uint48(block.timestamp);\n }\n disputer = address(0);\n emit DisputeResolved(valid);\n }\n\n /// @notice Allows the governor or the guardian of this contract to fallback to the last version of the tree\n /// immediately\n function revokeTree() external onlyGovernorOrGuardian {\n if (disputer != address(0)) revert UnresolvedDispute();\n _revokeTree();\n }\n\n /// @notice Toggles permissioned claiming for a given user\n function toggleOnlyOperatorCanClaim(address user) external onlyTrustedOrUser(user) {\n uint256 oldValue = onlyOperatorCanClaim[user];\n onlyOperatorCanClaim[user] = 1 - oldValue;\n emit OperatorClaimingToggled(user, oldValue == 0);\n }\n\n /// @notice Toggles whitelisting for a given user and a given operator\n function toggleOperator(address user, address operator) external onlyTrustedOrUser(user) {\n uint256 oldValue = operators[user][operator];\n operators[user][operator] = 1 - oldValue;\n emit OperatorToggled(user, operator, oldValue == 0);\n }\n\n /// @notice Recovers any ERC20 token\n function recoverERC20(address tokenAddress, address to, uint256 amountToRecover) external onlyGovernorOrGuardian {\n IERC20(tokenAddress).safeTransfer(to, amountToRecover);\n emit Recovered(tokenAddress, to, amountToRecover);\n }\n\n /// @notice Sets the dispute period before which a tree update becomes effective\n function setDisputePeriod(uint48 _disputePeriod) external onlyGovernorOrGuardian {\n if (_disputePeriod > block.timestamp) revert InvalidParam();\n disputePeriod = uint48(_disputePeriod);\n emit DisputePeriodUpdated(_disputePeriod);\n }\n\n /// @notice Sets the token used as a caution during disputes\n function setDisputeToken(IERC20 _disputeToken) external onlyGovernorOrGuardian {\n if (disputer != address(0)) revert UnresolvedDispute();\n disputeToken = _disputeToken;\n emit DisputeTokenUpdated(address(_disputeToken));\n }\n\n /// @notice Sets the amount of `disputeToken` used as a caution during disputes\n function setDisputeAmount(uint256 _disputeAmount) external onlyGovernorOrGuardian {\n if (disputer != address(0)) revert UnresolvedDispute();\n disputeAmount = _disputeAmount;\n emit DisputeAmountUpdated(_disputeAmount);\n }\n\n // ============================= INTERNAL FUNCTIONS ============================\n\n /// @notice Fallback to the last version of the tree\n function _revokeTree() internal {\n MerkleTree memory _tree = lastTree;\n lastTreeUpdate = 0;\n tree = _tree;\n emit TreeUpdated(_tree.merkleRoot, _tree.ipfsHash);\n }\n\n /// @notice Checks the validity of a proof\n /// @param leaf Hashed leaf data, the starting point of the proof\n /// @param proof Array of hashes forming a hash chain from leaf to root\n /// @return true If proof is correct, else false\n function _verifyProof(bytes32 leaf, bytes32[] memory proof) internal view returns (bool) {\n bytes32 currentHash = leaf;\n uint256 proofLength = proof.length;\n for (uint256 i; i < proofLength; ) {\n if (currentHash < proof[i]) {\n currentHash = keccak256(abi.encode(currentHash, proof[i]));\n } else {\n currentHash = keccak256(abi.encode(proof[i], currentHash));\n }\n unchecked {\n ++i;\n }\n }\n bytes32 root = getMerkleRoot();\n if (root == bytes32(0)) revert InvalidUninitializedRoot();\n return currentHash == root;\n }\n}\n" + }, + "contracts/DistributionCreator.sol": { + "content": "// SPDX-License-Identifier: BUSL-1.1\n\n/*\n * █ \n ***** ▓▓▓ \n * ▓▓▓▓▓▓▓ \n * ///. ▓▓▓▓▓▓▓▓▓▓▓▓▓ \n ***** //////// ▓▓▓▓▓▓▓ \n * ///////////// ▓▓▓ \n ▓▓ ////////////////// █ ▓▓ \n ▓▓ ▓▓ /////////////////////// ▓▓ ▓▓ \n ▓▓ ▓▓ //////////////////////////// ▓▓ ▓▓ \n ▓▓ ▓▓ /////////▓▓▓///////▓▓▓///////// ▓▓ ▓▓ \n ▓▓ ,////////////////////////////////////// ▓▓ ▓▓ \n ▓▓ ////////////////////////////////////////// ▓▓ \n ▓▓ //////////////////////▓▓▓▓///////////////////// \n ,//////////////////////////////////////////////////// \n .////////////////////////////////////////////////////////// \n .//////////////////////////██.,//////////////////////////█ \n .//////////////////////████..,./////////////////////██ \n ...////////////////███████.....,.////////////////███ \n ,.,////////////████████ ........,///////////████ \n .,.,//////█████████ ,.......///////████ \n ,..//████████ ........./████ \n ..,██████ .....,███ \n .██ ,.,█ \n \n \n \n ▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓ ▓▓▓▓▓▓▓▓▓▓ \n ▓▓▓▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓ ▓▓ ▓▓▓▓ \n ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓ ▓▓▓▓▓ \n ▓▓▓ ▓▓ ▓▓▓ ▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ \n*/\n\npragma solidity ^0.8.17;\n\nimport { ReentrancyGuardUpgradeable } from \"@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol\";\nimport { IERC20, IERC20Metadata } from \"@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol\";\nimport { SafeERC20 } from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport { ECDSA } from \"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\";\n\nimport { IUniswapV3Pool } from \"./interfaces/external/uniswap/IUniswapV3Pool.sol\";\nimport { IAlgebraPool } from \"./interfaces/external/algebra/IAlgebraPool.sol\";\n\nimport \"./utils/UUPSHelper.sol\";\nimport { DistributionParameters } from \"./struct/DistributionParameters.sol\";\nimport { UniswapTokenData, ExtensiveDistributionParameters } from \"./struct/ExtensiveDistributionParameters.sol\";\nimport { RewardTokenAmounts } from \"./struct/RewardTokenAmounts.sol\";\n\ninterface IDistributionCreator {\n function tryGetExtensiveDistributionParameters(\n DistributionParameters memory distribution\n ) external view returns (bool success, ExtensiveDistributionParameters memory extensiveParams);\n}\n\n/// @title DistributionCreator\n/// @author Angle Labs, Inc.\n/// @notice Manages the distribution of rewards across different pools with concentrated liquidity (like on Uniswap V3)\n/// @dev This contract is mostly a helper for APIs built on top of Merkl\n/// @dev People depositing rewards must have signed a `message` with the conditions for using the\n/// product\n//solhint-disable\ncontract DistributionCreator is UUPSHelper, ReentrancyGuardUpgradeable {\n using SafeERC20 for IERC20;\n\n // =========================== CONSTANTS / VARIABLES ===========================\n\n /// @notice Epoch duration\n uint32 public constant EPOCH_DURATION = 3600;\n\n /// @notice Base for fee computation\n uint256 public constant BASE_9 = 1e9;\n\n /// @notice `Core` contract handling access control\n ICore public core;\n\n /// @notice User contract for distributing rewards\n address public distributor;\n\n /// @notice Address to which fees are forwarded\n address public feeRecipient;\n\n /// @notice Value (in base 10**9) of the fees taken when creating a distribution for a pool which do not\n /// have a whitelisted token in it\n uint256 public fees;\n\n /// @notice Message that needs to be acknowledged by users creating a distribution\n string public message;\n\n /// @notice Hash of the message that needs to be signed\n bytes32 public messageHash;\n\n /// @notice List of all rewards ever distributed or to be distributed in the contract\n /// @dev An attacker could try to populate this list. It shouldn't be an issue as only view functions\n /// iterate on it\n DistributionParameters[] public distributionList;\n\n /// @notice Maps an address to its fee rebate\n mapping(address => uint256) public feeRebate;\n\n /// @notice Maps a token to whether it is whitelisted or not. No fees are to be paid for incentives given\n /// on pools with whitelisted tokens\n mapping(address => uint256) public isWhitelistedToken;\n\n /// @notice Maps an address to its nonce for creating a distribution\n mapping(address => uint256) public nonces;\n\n /// @notice Maps an address to the last valid hash signed\n mapping(address => bytes32) public userSignatures;\n\n /// @notice Maps a user to whether it is whitelisted for not signing\n mapping(address => uint256) public userSignatureWhitelist;\n\n /// @notice Maps a token to the minimum amount that must be sent per epoch for a distribution to be valid\n /// @dev If `rewardTokenMinAmounts[token] == 0`, then `token` cannot be used as a reward\n mapping(address => uint256) public rewardTokenMinAmounts;\n\n /// @notice List of all reward tokens that have at some point been accepted\n address[] public rewardTokens;\n\n uint256[36] private __gap;\n\n // =================================== EVENTS ==================================\n\n event DistributorUpdated(address indexed _distributor);\n event FeeRebateUpdated(address indexed user, uint256 userFeeRebate);\n event FeeRecipientUpdated(address indexed _feeRecipient);\n event FeesSet(uint256 _fees);\n event MessageUpdated(bytes32 _messageHash);\n event NewDistribution(DistributionParameters distribution, address indexed sender);\n event RewardTokenMinimumAmountUpdated(address indexed token, uint256 amount);\n event TokenWhitelistToggled(address indexed token, uint256 toggleStatus);\n event UserSigned(bytes32 messageHash, address indexed user);\n event UserSigningWhitelistToggled(address indexed user, uint256 toggleStatus);\n\n // ================================= MODIFIERS =================================\n\n /// @notice Checks whether the `msg.sender` has the governor role or the guardian role\n modifier onlyGovernorOrGuardian() {\n if (!core.isGovernorOrGuardian(msg.sender)) revert NotGovernorOrGuardian();\n _;\n }\n\n /// @notice Checks whether an address has signed the message or not\n modifier hasSigned() {\n if (\n userSignatureWhitelist[msg.sender] == 0 &&\n userSignatures[msg.sender] != messageHash &&\n userSignatureWhitelist[tx.origin] == 0 &&\n userSignatures[tx.origin] != messageHash\n ) revert NotSigned();\n _;\n }\n\n // ================================ CONSTRUCTOR ================================\n\n function initialize(ICore _core, address _distributor, uint256 _fees) external initializer {\n if (address(_core) == address(0) || _distributor == address(0)) revert ZeroAddress();\n if (_fees >= BASE_9) revert InvalidParam();\n distributor = _distributor;\n core = _core;\n fees = _fees;\n }\n\n constructor() initializer {}\n\n /// @inheritdoc UUPSUpgradeable\n function _authorizeUpgrade(address) internal view override onlyGuardianUpgrader(core) {}\n\n // ============================== DEPOSIT FUNCTION =============================\n\n /// @notice Creates a `distribution` to incentivize a given pool for a specific period of time\n /// @return distributionAmount How many reward tokens are actually taken into consideration in the contract\n /// @dev If the address specified as a UniV3 pool is not effectively a pool, it will not be handled by the\n /// distribution script and rewards may be lost\n /// @dev Reward tokens sent as part of distributions must have been whitelisted before and amounts\n /// sent should be bigger than a minimum amount specific to each token\n /// @dev The `positionWrappers` specified in the `distribution` struct need to be supported by the script\n /// List of supported `positionWrappers` can be found in the docs.\n /// @dev If the pool incentivized contains one whitelisted token, then no fees are taken on the rewards\n /// @dev This function reverts if the sender has not signed the message `messageHash` once through one of\n /// the functions enabling to sign\n function createDistribution(\n DistributionParameters memory distribution\n ) external hasSigned returns (uint256 distributionAmount) {\n return _createDistribution(distribution);\n }\n\n /// @notice Same as the function above but for multiple distributions at once\n /// @return List of all the distribution amounts actually deposited for each `distribution` in the `distributions` list\n function createDistributions(\n DistributionParameters[] memory distributions\n ) external hasSigned returns (uint256[] memory) {\n uint256 distributionsLength = distributions.length;\n uint256[] memory distributionAmounts = new uint256[](distributionsLength);\n for (uint256 i; i < distributionsLength; ) {\n distributionAmounts[i] = _createDistribution(distributions[i]);\n unchecked {\n ++i;\n }\n }\n return distributionAmounts;\n }\n\n /// @notice Checks whether the `msg.sender`'s `signature` is compatible with the message\n /// to sign and stores the signature\n /// @dev If you signed the message once, and the message has not been modified, then you do not\n /// need to sign again\n function sign(bytes calldata signature) external {\n _sign(signature);\n }\n\n /// @notice Combines signing the message and creating a distribution\n function signAndCreateDistribution(\n DistributionParameters memory distribution,\n bytes calldata signature\n ) external returns (uint256 distributionAmount) {\n _sign(signature);\n return _createDistribution(distribution);\n }\n\n /// @notice Internal version of `createDistribution`\n function _createDistribution(\n DistributionParameters memory distribution\n ) internal nonReentrant returns (uint256 distributionAmount) {\n uint32 epochStart = _getRoundedEpoch(distribution.epochStart);\n uint256 minDistributionAmount = rewardTokenMinAmounts[distribution.rewardToken];\n distribution.epochStart = epochStart;\n // Reward are not accepted in the following conditions:\n if (\n // if epoch parameters lead to a past distribution\n epochStart + EPOCH_DURATION < block.timestamp ||\n // if the amount of epochs for which this distribution should last is zero\n distribution.numEpoch == 0 ||\n // if the distribution parameters are not correctly specified\n distribution.propFees + distribution.propToken0 + distribution.propToken1 != 1e4 ||\n // if boosted addresses get less than non-boosted addresses in case of\n (distribution.boostingAddress != address(0) && distribution.boostedReward < 1e4) ||\n // if the type of the position wrappers is not well specified\n distribution.positionWrappers.length != distribution.wrapperTypes.length ||\n // if the reward token is not whitelisted as an incentive token\n minDistributionAmount == 0 ||\n // if the amount distributed is too small with respect to what is allowed\n distribution.amount / distribution.numEpoch < minDistributionAmount\n ) revert InvalidReward();\n distributionAmount = distribution.amount;\n // Computing fees: these are waived for whitelisted addresses and if there is a whitelisted token in a pool\n uint256 userFeeRebate = feeRebate[msg.sender];\n if (\n userFeeRebate < BASE_9 &&\n // Algebra pools also have these `token0` and `token1` parameters\n isWhitelistedToken[IUniswapV3Pool(distribution.uniV3Pool).token0()] == 0 &&\n isWhitelistedToken[IUniswapV3Pool(distribution.uniV3Pool).token1()] == 0\n ) {\n uint256 _fees = (fees * (BASE_9 - userFeeRebate)) / BASE_9;\n uint256 distributionAmountMinusFees = (distributionAmount * (BASE_9 - _fees)) / BASE_9;\n address _feeRecipient = feeRecipient;\n _feeRecipient = _feeRecipient == address(0) ? address(this) : _feeRecipient;\n IERC20(distribution.rewardToken).safeTransferFrom(\n msg.sender,\n _feeRecipient,\n distributionAmount - distributionAmountMinusFees\n );\n distributionAmount = distributionAmountMinusFees;\n distribution.amount = distributionAmount;\n }\n\n IERC20(distribution.rewardToken).safeTransferFrom(msg.sender, distributor, distributionAmount);\n uint256 senderNonce = nonces[msg.sender];\n nonces[msg.sender] = senderNonce + 1;\n distribution.rewardId = bytes32(keccak256(abi.encodePacked(msg.sender, senderNonce)));\n distributionList.push(distribution);\n emit NewDistribution(distribution, msg.sender);\n }\n\n /// @notice Internal version of the `sign` function\n function _sign(bytes calldata signature) internal {\n bytes32 _messageHash = messageHash;\n if (ECDSA.recover(_messageHash, signature) != msg.sender) revert InvalidSignature();\n userSignatures[msg.sender] = _messageHash;\n emit UserSigned(_messageHash, msg.sender);\n }\n\n // ================================= UI HELPERS ================================\n // These functions are not to be queried on-chain and hence are not optimized for gas consumption\n\n /// @notice Returns the list of all distributions ever made or to be done in the future\n function getAllDistributions() external view returns (DistributionParameters[] memory) {\n return distributionList;\n }\n\n /// @notice Returns the list of all currently active distributions on pools of supported AMMs (like Uniswap V3)\n function getActiveDistributions()\n external\n view\n returns (ExtensiveDistributionParameters[] memory searchDistributions)\n {\n uint32 roundedEpoch = _getRoundedEpoch(uint32(block.timestamp));\n (searchDistributions, ) = _getPoolDistributionsBetweenEpochs(\n address(0),\n roundedEpoch,\n roundedEpoch + EPOCH_DURATION,\n 0,\n type(uint32).max\n );\n }\n\n /// @notice Similar to `getActiveDistributions()` with additional parameters to prevent out of gas error\n /// @param skip Disregard distibutions with a global index lower than `skip`\n /// @param first Limit the length of the returned array to `first`\n /// @return searchDistributions Eligible distributions\n /// @return lastIndexDistribution Index of the last distribution assessed in the list of all distributions\n /// For pagniation purpose, in case of out of gas, you can call back the same function but with `skip` set to `lastIndexDistribution`\n function getActiveDistributions(\n uint32 skip,\n uint32 first\n )\n external\n view\n returns (ExtensiveDistributionParameters[] memory searchDistributions, uint256 lastIndexDistribution)\n {\n uint32 roundedEpoch = _getRoundedEpoch(uint32(block.timestamp));\n return _getPoolDistributionsBetweenEpochs(address(0), roundedEpoch, roundedEpoch + EPOCH_DURATION, skip, first);\n }\n\n /// @notice Returns the list of all the reward tokens supported as well as their minimum amounts\n function getValidRewardTokens() external view returns (RewardTokenAmounts[] memory) {\n uint256 length;\n uint256 rewardTokenListLength = rewardTokens.length;\n RewardTokenAmounts[] memory validRewardTokens = new RewardTokenAmounts[](rewardTokenListLength);\n for (uint32 i; i < rewardTokenListLength; ) {\n address token = rewardTokens[i];\n uint256 minAmount = rewardTokenMinAmounts[token];\n if (minAmount > 0) {\n validRewardTokens[length] = RewardTokenAmounts(token, minAmount);\n length += 1;\n }\n unchecked {\n ++i;\n }\n }\n assembly {\n mstore(validRewardTokens, length)\n }\n return validRewardTokens;\n }\n\n /// @notice Returns the list of all the distributions that were or that are going to be live at\n /// a specific epoch\n function getDistributionsForEpoch(\n uint32 epoch\n ) external view returns (ExtensiveDistributionParameters[] memory searchDistributions) {\n uint32 roundedEpoch = _getRoundedEpoch(epoch);\n (searchDistributions, ) = _getPoolDistributionsBetweenEpochs(\n address(0),\n roundedEpoch,\n roundedEpoch + EPOCH_DURATION,\n 0,\n type(uint32).max\n );\n }\n\n /// @notice Similar to `getDistributionsForEpoch(uint256 epoch)` with additional parameters to prevent out of gas error\n /// @param skip Disregard distibutions with a global index lower than `skip`\n /// @param first Limit the length of the returned array to `first`\n /// @return searchDistributions Eligible distributions\n /// @return lastIndexDistribution Index of the last distribution assessed in the list of all distributions\n /// For pagniation purpose, in case of out of gas, you can call back the same function but with `skip` set to `lastIndexDistribution`\n function getDistributionsForEpoch(\n uint32 epoch,\n uint32 skip,\n uint32 first\n ) external view returns (ExtensiveDistributionParameters[] memory, uint256 lastIndexDistribution) {\n uint32 roundedEpoch = _getRoundedEpoch(epoch);\n return _getPoolDistributionsBetweenEpochs(address(0), roundedEpoch, roundedEpoch + EPOCH_DURATION, skip, first);\n }\n\n /// @notice Gets the distributions that were or will be live at some point between `epochStart` (included) and `epochEnd` (excluded)\n /// @dev If a distribution starts during `epochEnd`, it is not be returned by this function\n /// @dev Conversely, if a distribution starts after `epochStart` and ends before `epochEnd`, it is returned by this function\n function getDistributionsBetweenEpochs(\n uint32 epochStart,\n uint32 epochEnd\n ) external view returns (ExtensiveDistributionParameters[] memory searchDistributions) {\n (searchDistributions, ) = _getPoolDistributionsBetweenEpochs(\n address(0),\n _getRoundedEpoch(epochStart),\n _getRoundedEpoch(epochEnd),\n 0,\n type(uint32).max\n );\n }\n\n /// @notice Similar to `getDistributionsBetweenEpochs(uint256 epochStart, uint256 epochEnd)` with additional parameters to prevent out of gas error\n /// @param skip Disregard distibutions with a global index lower than `skip`\n /// @param first Limit the length of the returned array to `first`\n /// @return searchDistributions Eligible distributions\n /// @return lastIndexDistribution Index of the last distribution assessed in the list of all distributions\n /// For pagniation purpose, in case of out of gas, you can call back the same function but with `skip` set to `lastIndexDistribution`\n function getDistributionsBetweenEpochs(\n uint32 epochStart,\n uint32 epochEnd,\n uint32 skip,\n uint32 first\n ) external view returns (ExtensiveDistributionParameters[] memory, uint256 lastIndexDistribution) {\n return\n _getPoolDistributionsBetweenEpochs(\n address(0),\n _getRoundedEpoch(epochStart),\n _getRoundedEpoch(epochEnd),\n skip,\n first\n );\n }\n\n /// @notice Returns the list of all distributions that were or will be live after `epochStart` (included)\n function getDistributionsAfterEpoch(\n uint32 epochStart\n ) external view returns (ExtensiveDistributionParameters[] memory searchDistributions) {\n (searchDistributions, ) = _getPoolDistributionsBetweenEpochs(\n address(0),\n _getRoundedEpoch(epochStart),\n type(uint32).max,\n 0,\n type(uint32).max\n );\n }\n\n /// @notice Similar to `getDistributionsAfterEpoch(uint256 epochStart)` with additional parameters to prevent out of gas error\n /// @param skip Disregard distibutions with a global index lower than `skip`\n /// @param first Limit the length of the returned array to `first`\n /// @return searchDistributions Eligible distributions\n /// @return lastIndexDistribution Index of the last distribution assessed in the list of all distributions\n /// For pagniation purpose, in case of out of gas, you can call back the same function but with `skip` set to `lastIndexDistribution`\n function getDistributionsAfterEpoch(\n uint32 epochStart,\n uint32 skip,\n uint32 first\n ) external view returns (ExtensiveDistributionParameters[] memory, uint256 lastIndexDistribution) {\n return\n _getPoolDistributionsBetweenEpochs(address(0), _getRoundedEpoch(epochStart), type(uint32).max, skip, first);\n }\n\n /// @notice Returns the list of all currently active distributions for a specific UniswapV3 pool\n function getActivePoolDistributions(\n address uniV3Pool\n ) external view returns (ExtensiveDistributionParameters[] memory searchDistributions) {\n uint32 roundedEpoch = _getRoundedEpoch(uint32(block.timestamp));\n (searchDistributions, ) = _getPoolDistributionsBetweenEpochs(\n uniV3Pool,\n roundedEpoch,\n roundedEpoch + EPOCH_DURATION,\n 0,\n type(uint32).max\n );\n }\n\n /// @notice Similar to `getActivePoolDistributions(address uniV3Pool)` with additional parameters to prevent out of gas error\n /// @param skip Disregard distibutions with a global index lower than `skip`\n /// @param first Limit the length of the returned array to `first`\n /// @return searchDistributions Eligible distributions\n /// @return lastIndexDistribution Index of the last distribution assessed in the list of all distributions\n /// For pagniation purpose, in case of out of gas, you can call back the same function but with `skip` set to `lastIndexDistribution`\n function getActivePoolDistributions(\n address uniV3Pool,\n uint32 skip,\n uint32 first\n ) external view returns (ExtensiveDistributionParameters[] memory, uint256 lastIndexDistribution) {\n uint32 roundedEpoch = _getRoundedEpoch(uint32(block.timestamp));\n return _getPoolDistributionsBetweenEpochs(uniV3Pool, roundedEpoch, roundedEpoch + EPOCH_DURATION, skip, first);\n }\n\n /// @notice Returns the list of all the distributions that were or that are going to be live at a\n /// specific epoch and for a specific pool\n function getPoolDistributionsForEpoch(\n address uniV3Pool,\n uint32 epoch\n ) external view returns (ExtensiveDistributionParameters[] memory searchDistributions) {\n uint32 roundedEpoch = _getRoundedEpoch(epoch);\n (searchDistributions, ) = _getPoolDistributionsBetweenEpochs(\n uniV3Pool,\n roundedEpoch,\n roundedEpoch + EPOCH_DURATION,\n 0,\n type(uint32).max\n );\n }\n\n /// @notice Similar to `getPoolDistributionsForEpoch(address uniV3Pool,uint32 epoch)` with additional parameters to prevent out of gas error\n /// @param skip Disregard distibutions with a global index lower than `skip`\n /// @param first Limit the length of the returned array to `first`\n /// @return searchDistributions Eligible distributions\n /// @return lastIndexDistribution Index of the last distribution assessed in the list of all distributions\n /// For pagniation purpose, in case of out of gas, you can call back the same function but with `skip` set to `lastIndexDistribution`\n function getPoolDistributionsForEpoch(\n address uniV3Pool,\n uint32 epoch,\n uint32 skip,\n uint32 first\n ) external view returns (ExtensiveDistributionParameters[] memory, uint256 lastIndexDistribution) {\n uint32 roundedEpoch = _getRoundedEpoch(epoch);\n return _getPoolDistributionsBetweenEpochs(uniV3Pool, roundedEpoch, roundedEpoch + EPOCH_DURATION, skip, first);\n }\n\n /// @notice Returns the list of all distributions that were or will be live at some point between\n /// `epochStart` (included) and `epochEnd` (excluded) for a specific pool\n function getPoolDistributionsBetweenEpochs(\n address uniV3Pool,\n uint32 epochStart,\n uint32 epochEnd\n ) external view returns (ExtensiveDistributionParameters[] memory searchDistributions) {\n (searchDistributions, ) = _getPoolDistributionsBetweenEpochs(\n uniV3Pool,\n _getRoundedEpoch(epochStart),\n _getRoundedEpoch(epochEnd),\n 0,\n type(uint32).max\n );\n }\n\n /// @notice Similar to `getPoolDistributionsBetweenEpochs(address uniV3Pool,uint32 epochStart, uint32 epochEnd)` with additional parameters to prevent out of gas error\n /// @param skip Disregard distibutions with a global index lower than `skip`\n /// @param first Limit the length of the returned array to `first`\n /// @return searchDistributions Eligible distributions\n /// @return lastIndexDistribution Index of the last distribution assessed in the list of all distributions\n /// For pagniation purpose, in case of out of gas, you can call back the same function but with `skip` set to `lastIndexDistribution`\n function getPoolDistributionsBetweenEpochs(\n address uniV3Pool,\n uint32 epochStart,\n uint32 epochEnd,\n uint32 skip,\n uint32 first\n ) external view returns (ExtensiveDistributionParameters[] memory, uint256 lastIndexDistribution) {\n return\n _getPoolDistributionsBetweenEpochs(\n uniV3Pool,\n _getRoundedEpoch(epochStart),\n _getRoundedEpoch(epochEnd),\n skip,\n first\n );\n }\n\n /// @notice Returns the list of all distributions that were or will be live after `epochStart` (included)\n /// for a specific pool\n function getPoolDistributionsAfterEpoch(\n address uniV3Pool,\n uint32 epochStart\n ) external view returns (ExtensiveDistributionParameters[] memory searchDistributions) {\n (searchDistributions, ) = _getPoolDistributionsBetweenEpochs(\n uniV3Pool,\n _getRoundedEpoch(epochStart),\n type(uint32).max,\n 0,\n type(uint32).max\n );\n }\n\n /// @notice Similar to `getPoolDistributionsAfterEpoch(address uniV3Pool,uint32 epochStart)` with additional parameters to prevent out of gas error\n /// @param skip Disregard distibutions with a global index lower than `skip`\n /// @param first Limit the length of the returned array to `first`\n /// @return searchDistributions Eligible distributions\n /// @return lastIndexDistribution Index of the last distribution assessed in the list of all distributions\n /// For pagniation purpose, in case of out of gas, you can call back the same function but with `skip` set to `lastIndexDistribution`\n function getPoolDistributionsAfterEpoch(\n address uniV3Pool,\n uint32 epochStart,\n uint32 skip,\n uint32 first\n ) external view returns (ExtensiveDistributionParameters[] memory, uint256 lastIndexDistribution) {\n return\n _getPoolDistributionsBetweenEpochs(uniV3Pool, _getRoundedEpoch(epochStart), type(uint32).max, skip, first);\n }\n\n // ============================ GOVERNANCE FUNCTIONS ===========================\n\n /// @notice Sets a new `distributor` to which rewards should be distributed\n function setNewDistributor(address _distributor) external onlyGovernorOrGuardian {\n if (_distributor == address(0)) revert InvalidParam();\n distributor = _distributor;\n emit DistributorUpdated(_distributor);\n }\n\n /// @notice Sets the fees on deposit\n function setFees(uint256 _fees) external onlyGovernorOrGuardian {\n if (_fees >= BASE_9) revert InvalidParam();\n fees = _fees;\n emit FeesSet(_fees);\n }\n\n /// @notice Sets fee rebates for a given user\n function setUserFeeRebate(address user, uint256 userFeeRebate) external onlyGovernorOrGuardian {\n feeRebate[user] = userFeeRebate;\n emit FeeRebateUpdated(user, userFeeRebate);\n }\n\n /// @notice Toggles the fee whitelist for `token`\n function toggleTokenWhitelist(address token) external onlyGovernorOrGuardian {\n uint256 toggleStatus = 1 - isWhitelistedToken[token];\n isWhitelistedToken[token] = toggleStatus;\n emit TokenWhitelistToggled(token, toggleStatus);\n }\n\n /// @notice Recovers fees accrued on the contract for a list of `tokens`\n function recoverFees(IERC20[] calldata tokens, address to) external onlyGovernorOrGuardian {\n uint256 tokensLength = tokens.length;\n for (uint256 i; i < tokensLength; ) {\n tokens[i].safeTransfer(to, tokens[i].balanceOf(address(this)));\n unchecked {\n ++i;\n }\n }\n }\n\n /// @notice Sets the minimum amounts per distribution epoch for different reward tokens\n function setRewardTokenMinAmounts(\n address[] calldata tokens,\n uint256[] calldata amounts\n ) external onlyGovernorOrGuardian {\n uint256 tokensLength = tokens.length;\n if (tokensLength != amounts.length) revert InvalidLengths();\n for (uint256 i; i < tokensLength; ++i) {\n uint256 amount = amounts[i];\n // Basic logic check to make sure there are no duplicates in the `rewardTokens` table. If a token is\n // removed then re-added, it will appear as a duplicate in the list\n if (amount > 0 && rewardTokenMinAmounts[tokens[i]] == 0) rewardTokens.push(tokens[i]);\n rewardTokenMinAmounts[tokens[i]] = amount;\n emit RewardTokenMinimumAmountUpdated(tokens[i], amount);\n }\n }\n\n /// @notice Sets a new address to receive fees\n function setFeeRecipient(address _feeRecipient) external onlyGovernorOrGuardian {\n feeRecipient = _feeRecipient;\n emit FeeRecipientUpdated(_feeRecipient);\n }\n\n /// @notice Sets the message that needs to be signed by users before posting rewards\n function setMessage(string memory _message) external onlyGovernorOrGuardian {\n message = _message;\n bytes32 _messageHash = ECDSA.toEthSignedMessageHash(bytes(_message));\n messageHash = _messageHash;\n emit MessageUpdated(_messageHash);\n }\n\n /// @notice Toggles the whitelist status for `user` when it comes to signing messages before depositing rewards.\n function toggleSigningWhitelist(address user) external onlyGovernorOrGuardian {\n uint256 whitelistStatus = 1 - userSignatureWhitelist[user];\n userSignatureWhitelist[user] = whitelistStatus;\n emit UserSigningWhitelistToggled(user, whitelistStatus);\n }\n\n // ============================== INTERNAL HELPERS =============================\n\n /// @notice Rounds an `epoch` timestamp to the start of the corresponding period\n function _getRoundedEpoch(uint32 epoch) internal pure returns (uint32) {\n return (epoch / EPOCH_DURATION) * EPOCH_DURATION;\n }\n\n /// @notice Checks whether `distribution` was live between `roundedEpochStart` and `roundedEpochEnd`\n function _isDistributionLiveBetweenEpochs(\n DistributionParameters memory distribution,\n uint32 roundedEpochStart,\n uint32 roundedEpochEnd\n ) internal pure returns (bool) {\n uint256 distributionEpochStart = distribution.epochStart;\n return (distributionEpochStart + distribution.numEpoch * EPOCH_DURATION > roundedEpochStart &&\n distributionEpochStart < roundedEpochEnd);\n }\n\n /// @notice Fetches data for `token` on the Uniswap `pool`\n function _getUniswapTokenData(\n IERC20Metadata token,\n address pool\n ) internal view returns (UniswapTokenData memory data) {\n data.add = address(token);\n data.decimals = token.decimals();\n data.symbol = token.symbol();\n data.poolBalance = token.balanceOf(pool);\n }\n\n /// @notice Fetches extra data about the parameters in a distribution\n function getExtensiveDistributionParameters(\n DistributionParameters memory distribution\n ) external view returns (ExtensiveDistributionParameters memory extensiveParams) {\n extensiveParams.base = distribution;\n try IUniswapV3Pool(distribution.uniV3Pool).fee() returns (uint24 fee) {\n extensiveParams.poolFee = fee;\n } catch {\n extensiveParams.poolFee = 0;\n }\n extensiveParams.token0 = _getUniswapTokenData(\n IERC20Metadata(IUniswapV3Pool(distribution.uniV3Pool).token0()),\n distribution.uniV3Pool\n );\n extensiveParams.token1 = _getUniswapTokenData(\n IERC20Metadata(IUniswapV3Pool(distribution.uniV3Pool).token1()),\n distribution.uniV3Pool\n );\n extensiveParams.rewardTokenSymbol = IERC20Metadata(distribution.rewardToken).symbol();\n extensiveParams.rewardTokenDecimals = IERC20Metadata(distribution.rewardToken).decimals();\n }\n\n /// @notice Tries to fetch extra data about the parameters in a distribution\n function tryGetExtensiveDistributionParameters(\n DistributionParameters memory distribution\n ) external returns (bool success, ExtensiveDistributionParameters memory extensiveParams) {\n (bool callSuccess, bytes memory returndata) = address(this).delegatecall(\n abi.encodeWithSelector(DistributionCreator.getExtensiveDistributionParameters.selector, distribution)\n );\n success = callSuccess;\n if (success) {\n extensiveParams = abi.decode(returndata, (ExtensiveDistributionParameters));\n }\n return (success, extensiveParams);\n }\n\n /// @notice Gets the list of all the distributions for `uniV3Pool` that have been active between `epochStart` and `epochEnd` (excluded)\n /// @dev If the `uniV3Pool` parameter is equal to 0, then this function will return the distributions for all pools\n function _getPoolDistributionsBetweenEpochs(\n address uniV3Pool,\n uint32 epochStart,\n uint32 epochEnd,\n uint32 skip,\n uint32 first\n ) internal view returns (ExtensiveDistributionParameters[] memory, uint256) {\n uint256 length;\n uint256 distributionListLength = distributionList.length;\n uint256 returnSize = first > distributionListLength ? distributionListLength : first;\n ExtensiveDistributionParameters[] memory activeRewards = new ExtensiveDistributionParameters[](returnSize);\n uint32 i = skip;\n while (i < distributionListLength) {\n DistributionParameters memory distribution = distributionList[i];\n if (\n _isDistributionLiveBetweenEpochs(distribution, epochStart, epochEnd) &&\n (uniV3Pool == address(0) || distribution.uniV3Pool == uniV3Pool)\n ) {\n (bool success, ExtensiveDistributionParameters memory extensiveParams) = IDistributionCreator(\n address(this)\n ).tryGetExtensiveDistributionParameters(distribution);\n if (success) {\n activeRewards[length] = extensiveParams;\n length += 1;\n }\n }\n unchecked {\n ++i;\n }\n if (length == returnSize) break;\n }\n assembly {\n mstore(activeRewards, length)\n }\n return (activeRewards, i);\n }\n}\n" + }, + "contracts/Distributor.sol": { + "content": "// SPDX-License-Identifier: BUSL-1.1\n\n/*\n * █ \n ***** ▓▓▓ \n * ▓▓▓▓▓▓▓ \n * ///. ▓▓▓▓▓▓▓▓▓▓▓▓▓ \n ***** //////// ▓▓▓▓▓▓▓ \n * ///////////// ▓▓▓ \n ▓▓ ////////////////// █ ▓▓ \n ▓▓ ▓▓ /////////////////////// ▓▓ ▓▓ \n ▓▓ ▓▓ //////////////////////////// ▓▓ ▓▓ \n ▓▓ ▓▓ /////////▓▓▓///////▓▓▓///////// ▓▓ ▓▓ \n ▓▓ ,////////////////////////////////////// ▓▓ ▓▓ \n ▓▓ ////////////////////////////////////////// ▓▓ \n ▓▓ //////////////////////▓▓▓▓///////////////////// \n ,//////////////////////////////////////////////////// \n .////////////////////////////////////////////////////////// \n .//////////////////////////██.,//////////////////////////█ \n .//////////////////////████..,./////////////////////██ \n ...////////////////███████.....,.////////////////███ \n ,.,////////////████████ ........,///////////████ \n .,.,//////█████████ ,.......///////████ \n ,..//████████ ........./████ \n ..,██████ .....,███ \n .██ ,.,█ \n \n \n \n ▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓ ▓▓▓▓▓▓▓▓▓▓ \n ▓▓▓▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓ ▓▓ ▓▓▓▓ \n ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓ ▓▓▓▓▓ \n ▓▓▓ ▓▓ ▓▓▓ ▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ \n*/\n\npragma solidity ^0.8.17;\n\nimport { IERC20 } from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport { SafeERC20 } from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport { SafeCast } from \"@openzeppelin/contracts/utils/math/SafeCast.sol\";\n\nimport \"./utils/UUPSHelper.sol\";\n\nstruct MerkleTree {\n // Root of a Merkle tree which leaves are `(address user, address token, uint amount)`\n // representing an amount of tokens accumulated by `user`.\n // The Merkle tree is assumed to have only increasing amounts: that is to say if a user can claim 1,\n // then after the amount associated in the Merkle tree for this token should be x > 1\n bytes32 merkleRoot;\n // Ipfs hash of the tree data\n bytes32 ipfsHash;\n}\n\nstruct Claim {\n uint208 amount;\n uint48 timestamp;\n bytes32 merkleRoot;\n}\n\n/// @title Distributor\n/// @notice Allows LPs on AMMs with concentrated liquidity to claim the rewards that were distributed to them\n/// @author Angle Labs. Inc\ncontract Distributor is UUPSHelper {\n using SafeERC20 for IERC20;\n\n /// @notice Epoch duration\n uint32 internal constant _EPOCH_DURATION = 3600;\n\n // ================================= VARIABLES =================================\n\n /// @notice Tree of claimable tokens through this contract\n MerkleTree public tree;\n\n /// @notice Tree that was in place in the contract before the last `tree` update\n MerkleTree public lastTree;\n\n /// @notice Token to deposit to freeze the roots update\n IERC20 public disputeToken;\n\n /// @notice `Core` contract handling access control\n ICore public core;\n\n /// @notice Address which created the dispute\n /// @dev Used to store if there is an ongoing dispute\n address public disputer;\n\n /// @notice When the current tree will become valid\n uint48 public endOfDisputePeriod;\n\n /// @notice Time after which a change in a tree becomes effective, in EPOCH_DURATION\n uint48 public disputePeriod;\n\n /// @notice Amount to deposit to freeze the roots update\n uint256 public disputeAmount;\n\n /// @notice Mapping user -> token -> amount to track claimed amounts\n mapping(address => mapping(address => Claim)) public claimed;\n\n /// @notice Trusted EOAs to update the Merkle root\n mapping(address => uint256) public canUpdateMerkleRoot;\n\n /// @notice Whether or not to disable permissionless claiming\n mapping(address => uint256) public onlyOperatorCanClaim;\n\n /// @notice user -> operator -> authorisation to claim\n mapping(address => mapping(address => uint256)) public operators;\n\n uint256[38] private __gap;\n\n // =================================== EVENTS ==================================\n\n event Claimed(address indexed user, address indexed token, uint256 amount);\n event DisputeAmountUpdated(uint256 _disputeAmount);\n event Disputed(string reason);\n event DisputePeriodUpdated(uint48 _disputePeriod);\n event DisputeResolved(bool valid);\n event DisputeTokenUpdated(address indexed _disputeToken);\n event OperatorClaimingToggled(address indexed user, bool isEnabled);\n event OperatorToggled(address indexed user, address indexed operator, bool isWhitelisted);\n event Recovered(address indexed token, address indexed to, uint256 amount);\n event Revoked(); // With this event an indexer could maintain a table (timestamp, merkleRootUpdate)\n event TreeUpdated(bytes32 merkleRoot, bytes32 ipfsHash, uint48 endOfDisputePeriod);\n event TrustedToggled(address indexed eoa, bool trust);\n\n // ================================= MODIFIERS =================================\n\n /// @notice Checks whether the `msg.sender` has the governor role or the guardian role\n modifier onlyGovernorOrGuardian() {\n if (!core.isGovernorOrGuardian(msg.sender)) revert NotGovernorOrGuardian();\n _;\n }\n\n /// @notice Checks whether the `msg.sender` is the `user` address or is a trusted address\n modifier onlyTrustedOrUser(address user) {\n if (user != msg.sender && canUpdateMerkleRoot[msg.sender] != 1 && !core.isGovernorOrGuardian(msg.sender))\n revert NotTrusted();\n _;\n }\n\n // ================================ CONSTRUCTOR ================================\n\n constructor() initializer {}\n\n function initialize(ICore _core) external initializer {\n if (address(_core) == address(0)) revert ZeroAddress();\n core = _core;\n }\n\n /// @inheritdoc UUPSUpgradeable\n function _authorizeUpgrade(address) internal view override onlyGuardianUpgrader(core) {}\n\n // =============================== MAIN FUNCTION ===============================\n\n /// @notice Claims rewards for a given set of users\n /// @dev Anyone may call this function for anyone else, funds go to destination regardless, it's just a question of\n /// who provides the proof and pays the gas: `msg.sender` is used only for addresses that require a trusted operator\n /// @param users Recipient of tokens\n /// @param tokens ERC20 claimed\n /// @param amounts Amount of tokens that will be sent to the corresponding users\n /// @param proofs Array of hashes bridging from a leaf `(hash of user | token | amount)` to the Merkle root\n function claim(\n address[] calldata users,\n address[] calldata tokens,\n uint256[] calldata amounts,\n bytes32[][] calldata proofs\n ) external {\n uint256 usersLength = users.length;\n if (\n usersLength == 0 ||\n usersLength != tokens.length ||\n usersLength != amounts.length ||\n usersLength != proofs.length\n ) revert InvalidLengths();\n\n for (uint256 i; i < usersLength; ) {\n address user = users[i];\n address token = tokens[i];\n uint256 amount = amounts[i];\n\n // Checking if only an approved operator can claim for `user`\n if (onlyOperatorCanClaim[user] == 1 && operators[user][msg.sender] == 0) revert NotWhitelisted();\n\n // Verifying proof\n bytes32 leaf = keccak256(abi.encode(user, token, amount));\n if (!_verifyProof(leaf, proofs[i])) revert InvalidProof();\n\n // Closing reentrancy gate here\n uint256 toSend = amount - claimed[user][token].amount;\n claimed[user][token] = Claim(SafeCast.toUint208(amount), uint48(block.timestamp), getMerkleRoot());\n\n IERC20(token).safeTransfer(user, toSend);\n emit Claimed(user, token, toSend);\n unchecked {\n ++i;\n }\n }\n }\n\n /// @notice Returns the MerkleRoot that is currently live for the contract\n function getMerkleRoot() public view returns (bytes32) {\n if (block.timestamp >= endOfDisputePeriod && disputer == address(0)) return tree.merkleRoot;\n else return lastTree.merkleRoot;\n }\n\n // ============================ GOVERNANCE FUNCTIONS ===========================\n\n /// @notice Adds or removes EOAs which are trusted to update the Merkle root\n function toggleTrusted(address eoa) external onlyGovernorOrGuardian {\n uint256 trustedStatus = 1 - canUpdateMerkleRoot[eoa];\n canUpdateMerkleRoot[eoa] = trustedStatus;\n emit TrustedToggled(eoa, trustedStatus == 1);\n }\n\n /// @notice Updates Merkle Tree\n function updateTree(MerkleTree calldata _tree) external {\n if (\n disputer != address(0) ||\n // A trusted address cannot update a tree right after a precedent tree update otherwise it can de facto\n // validate a tree which has not passed the dispute period\n ((canUpdateMerkleRoot[msg.sender] != 1 || block.timestamp < endOfDisputePeriod) &&\n !core.isGovernorOrGuardian(msg.sender))\n ) revert NotTrusted();\n MerkleTree memory _lastTree = tree;\n tree = _tree;\n lastTree = _lastTree;\n\n uint48 _endOfPeriod = _endOfDisputePeriod(uint48(block.timestamp));\n endOfDisputePeriod = _endOfPeriod;\n emit TreeUpdated(_tree.merkleRoot, _tree.ipfsHash, _endOfPeriod);\n }\n\n /// @notice Freezes the Merkle tree update until the dispute is resolved\n /// @dev Requires a deposit of `disputeToken` that'll be slashed if the dispute is not accepted\n /// @dev It is only possible to create a dispute within `disputePeriod` after each tree update\n function disputeTree(string memory reason) external {\n if (disputer != address(0)) revert UnresolvedDispute();\n if (block.timestamp >= endOfDisputePeriod) revert InvalidDispute();\n IERC20(disputeToken).safeTransferFrom(msg.sender, address(this), disputeAmount);\n disputer = msg.sender;\n emit Disputed(reason);\n }\n\n /// @notice Resolve the ongoing dispute, if any\n /// @param valid Whether the dispute was valid\n function resolveDispute(bool valid) external onlyGovernorOrGuardian {\n if (disputer == address(0)) revert NoDispute();\n if (valid) {\n IERC20(disputeToken).safeTransfer(disputer, disputeAmount);\n // If a dispute is valid, the contract falls back to the last tree that was updated\n _revokeTree();\n } else {\n IERC20(disputeToken).safeTransfer(msg.sender, disputeAmount);\n endOfDisputePeriod = _endOfDisputePeriod(uint48(block.timestamp));\n }\n disputer = address(0);\n emit DisputeResolved(valid);\n }\n\n /// @notice Allows the governor or the guardian of this contract to fallback to the last version of the tree\n /// immediately\n function revokeTree() external onlyGovernorOrGuardian {\n if (disputer != address(0)) revert UnresolvedDispute();\n _revokeTree();\n }\n\n /// @notice Toggles permissioned claiming for a given user\n function toggleOnlyOperatorCanClaim(address user) external onlyTrustedOrUser(user) {\n uint256 oldValue = onlyOperatorCanClaim[user];\n onlyOperatorCanClaim[user] = 1 - oldValue;\n emit OperatorClaimingToggled(user, oldValue == 0);\n }\n\n /// @notice Toggles whitelisting for a given user and a given operator\n function toggleOperator(address user, address operator) external onlyTrustedOrUser(user) {\n uint256 oldValue = operators[user][operator];\n operators[user][operator] = 1 - oldValue;\n emit OperatorToggled(user, operator, oldValue == 0);\n }\n\n /// @notice Recovers any ERC20 token\n function recoverERC20(address tokenAddress, address to, uint256 amountToRecover) external onlyGovernorOrGuardian {\n IERC20(tokenAddress).safeTransfer(to, amountToRecover);\n emit Recovered(tokenAddress, to, amountToRecover);\n }\n\n /// @notice Sets the dispute period after which a tree update becomes effective\n function setDisputePeriod(uint48 _disputePeriod) external onlyGovernorOrGuardian {\n disputePeriod = uint48(_disputePeriod);\n emit DisputePeriodUpdated(_disputePeriod);\n }\n\n /// @notice Sets the token used as a caution during disputes\n function setDisputeToken(IERC20 _disputeToken) external onlyGovernorOrGuardian {\n if (disputer != address(0)) revert UnresolvedDispute();\n disputeToken = _disputeToken;\n emit DisputeTokenUpdated(address(_disputeToken));\n }\n\n /// @notice Sets the amount of `disputeToken` used as a caution during disputes\n function setDisputeAmount(uint256 _disputeAmount) external onlyGovernorOrGuardian {\n if (disputer != address(0)) revert UnresolvedDispute();\n disputeAmount = _disputeAmount;\n emit DisputeAmountUpdated(_disputeAmount);\n }\n\n // ============================= INTERNAL FUNCTIONS ============================\n\n /// @notice Fallback to the last version of the tree\n function _revokeTree() internal {\n MerkleTree memory _tree = lastTree;\n endOfDisputePeriod = 0;\n tree = _tree;\n emit Revoked();\n emit TreeUpdated(\n _tree.merkleRoot,\n _tree.ipfsHash,\n (uint48(block.timestamp) / _EPOCH_DURATION) * (_EPOCH_DURATION) // Last hour\n );\n }\n\n /// @notice Returns the end of the dispute period\n /// @dev treeUpdate is rounded up to next hour and then `disputePeriod` hours are added\n function _endOfDisputePeriod(uint48 treeUpdate) internal view returns (uint48) {\n return ((treeUpdate - 1) / _EPOCH_DURATION + 1 + disputePeriod) * (_EPOCH_DURATION);\n }\n\n /// @notice Checks the validity of a proof\n /// @param leaf Hashed leaf data, the starting point of the proof\n /// @param proof Array of hashes forming a hash chain from leaf to root\n /// @return true If proof is correct, else false\n function _verifyProof(bytes32 leaf, bytes32[] memory proof) internal view returns (bool) {\n bytes32 currentHash = leaf;\n uint256 proofLength = proof.length;\n for (uint256 i; i < proofLength; ) {\n if (currentHash < proof[i]) {\n currentHash = keccak256(abi.encode(currentHash, proof[i]));\n } else {\n currentHash = keccak256(abi.encode(proof[i], currentHash));\n }\n unchecked {\n ++i;\n }\n }\n bytes32 root = getMerkleRoot();\n if (root == bytes32(0)) revert InvalidUninitializedRoot();\n return currentHash == root;\n }\n}\n" + }, + "contracts/external/AccessControlUpgradeable.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.7;\n\nimport \"@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\n\n/**\n * @dev This contract is fully forked from OpenZeppelin `AccessControlUpgradeable`.\n * The only difference is the removal of the ERC165 implementation as it's not\n * needed in Angle.\n *\n * Contract module that allows children to implement role-based access\n * control mechanisms. This is a lightweight version that doesn't allow enumerating role\n * members except through off-chain means by accessing the contract event logs. Some\n * applications may benefit from on-chain enumerability, for those cases see\n * {AccessControlEnumerable}.\n *\n * Roles are referred to by their `bytes32` identifier. These should be exposed\n * in the external API and be unique. The best way to achieve this is by\n * using `public constant` hash digests:\n *\n * ```\n * bytes32 public constant MY_ROLE = keccak256(\"MY_ROLE\");\n * ```\n *\n * Roles can be used to represent a set of permissions. To restrict access to a\n * function call, use {hasRole}:\n *\n * ```\n * function foo() public {\n * require(hasRole(MY_ROLE, msg.sender));\n * ...\n * }\n * ```\n *\n * Roles can be granted and revoked dynamically via the {grantRole} and\n * {revokeRole} functions. Each role has an associated admin role, and only\n * accounts that have a role's admin role can call {grantRole} and {revokeRole}.\n *\n * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means\n * that only accounts with this role will be able to grant or revoke other\n * roles. More complex role relationships can be created by using\n * {_setRoleAdmin}.\n *\n * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to\n * grant and revoke this role. Extra precautions should be taken to secure\n * accounts that have been granted it.\n */\n//solhint-disable\nabstract contract AccessControlUpgradeable is Initializable {\n function __AccessControl_init() internal initializer {\n __AccessControl_init_unchained();\n }\n\n function __AccessControl_init_unchained() internal initializer {}\n\n struct RoleData {\n mapping(address => bool) members;\n bytes32 adminRole;\n }\n\n mapping(bytes32 => RoleData) private _roles;\n\n bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;\n\n /**\n * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`\n *\n * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite\n * {RoleAdminChanged} not being emitted signaling this.\n *\n * _Available since v3.1._\n */\n event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);\n\n /**\n * @dev Emitted when `account` is granted `role`.\n *\n * `sender` is the account that originated the contract call, an admin role\n * bearer except when using {_setupRole}.\n */\n event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);\n\n /**\n * @dev Emitted when `account` is revoked `role`.\n *\n * `sender` is the account that originated the contract call:\n * - if using `revokeRole`, it is the admin role bearer\n * - if using `renounceRole`, it is the role bearer (i.e. `account`)\n */\n event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);\n\n /**\n * @dev Modifier that checks that an account has a specific role. Reverts\n * with a standardized message including the required role.\n *\n * The format of the revert reason is given by the following regular expression:\n *\n * /^AccessControl: account (0x[0-9a-f]{20}) is missing role (0x[0-9a-f]{32})$/\n *\n * _Available since v4.1._\n */\n modifier onlyRole(bytes32 role) {\n _checkRole(role, msg.sender);\n _;\n }\n\n /**\n * @dev Returns `true` if `account` has been granted `role`.\n */\n function hasRole(bytes32 role, address account) public view returns (bool) {\n return _roles[role].members[account];\n }\n\n /**\n * @dev Revert with a standard message if `account` is missing `role`.\n *\n * The format of the revert reason is given by the following regular expression:\n *\n * /^AccessControl: account (0x[0-9a-f]{20}) is missing role (0x[0-9a-f]{32})$/\n */\n function _checkRole(bytes32 role, address account) internal view {\n if (!hasRole(role, account)) {\n revert(\n string(\n abi.encodePacked(\n \"AccessControl: account \",\n StringsUpgradeable.toHexString(uint160(account), 20),\n \" is missing role \",\n StringsUpgradeable.toHexString(uint256(role), 32)\n )\n )\n );\n }\n }\n\n /**\n * @dev Returns the admin role that controls `role`. See {grantRole} and\n * {revokeRole}.\n *\n * To change a role's admin, use {_setRoleAdmin}.\n */\n function getRoleAdmin(bytes32 role) public view returns (bytes32) {\n return _roles[role].adminRole;\n }\n\n /**\n * @dev Grants `role` to `account`.\n *\n * If `account` had not been already granted `role`, emits a {RoleGranted}\n * event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n */\n function grantRole(bytes32 role, address account) external onlyRole(getRoleAdmin(role)) {\n _grantRole(role, account);\n }\n\n /**\n * @dev Revokes `role` from `account`.\n *\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n */\n function revokeRole(bytes32 role, address account) external onlyRole(getRoleAdmin(role)) {\n _revokeRole(role, account);\n }\n\n /**\n * @dev Revokes `role` from the calling account.\n *\n * Roles are often managed via {grantRole} and {revokeRole}: this function's\n * purpose is to provide a mechanism for accounts to lose their privileges\n * if they are compromised (such as when a trusted device is misplaced).\n *\n * If the calling account had been granted `role`, emits a {RoleRevoked}\n * event.\n *\n * Requirements:\n *\n * - the caller must be `account`.\n */\n function renounceRole(bytes32 role, address account) external {\n require(account == msg.sender, \"71\");\n\n _revokeRole(role, account);\n }\n\n /**\n * @dev Grants `role` to `account`.\n *\n * If `account` had not been already granted `role`, emits a {RoleGranted}\n * event. Note that unlike {grantRole}, this function doesn't perform any\n * checks on the calling account.\n *\n * [WARNING]\n * ====\n * This function should only be called from the constructor when setting\n * up the initial roles for the system.\n *\n * Using this function in any other way is effectively circumventing the admin\n * system imposed by {AccessControl}.\n * ====\n */\n function _setupRole(bytes32 role, address account) internal {\n _grantRole(role, account);\n }\n\n /**\n * @dev Sets `adminRole` as ``role``'s admin role.\n *\n * Emits a {RoleAdminChanged} event.\n */\n function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal {\n emit RoleAdminChanged(role, getRoleAdmin(role), adminRole);\n _roles[role].adminRole = adminRole;\n }\n\n function _grantRole(bytes32 role, address account) internal {\n if (!hasRole(role, account)) {\n _roles[role].members[account] = true;\n emit RoleGranted(role, account, msg.sender);\n }\n }\n\n function _revokeRole(bytes32 role, address account) internal {\n if (hasRole(role, account)) {\n _roles[role].members[account] = false;\n emit RoleRevoked(role, account, msg.sender);\n }\n }\n\n uint256[49] private __gap;\n}\n" + }, + "contracts/external/ProxyAdmin.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"./TransparentUpgradeableProxy.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\n/**\n * @dev This is an auxiliary contract meant to be assigned as the admin of a {TransparentUpgradeableProxy}. For an\n * explanation of why you would want to use this see the documentation for {TransparentUpgradeableProxy}.\n * This contract was fully forked from OpenZeppelin `ProxyAdmin`\n */\ncontract ProxyAdmin is Ownable {\n /**\n * @dev Returns the current implementation of `proxy`.\n *\n * Requirements:\n *\n * - This contract must be the admin of `proxy`.\n */\n function getProxyImplementation(TransparentUpgradeableProxy proxy) public view virtual returns (address) {\n // We need to manually run the static call since the getter cannot be flagged as view\n // bytes4(keccak256(\"implementation()\")) == 0x5c60da1b\n (bool success, bytes memory returndata) = address(proxy).staticcall(hex\"5c60da1b\");\n require(success);\n return abi.decode(returndata, (address));\n }\n\n /**\n * @dev Returns the current admin of `proxy`.\n *\n * Requirements:\n *\n * - This contract must be the admin of `proxy`.\n */\n function getProxyAdmin(TransparentUpgradeableProxy proxy) public view virtual returns (address) {\n // We need to manually run the static call since the getter cannot be flagged as view\n // bytes4(keccak256(\"admin()\")) == 0xf851a440\n (bool success, bytes memory returndata) = address(proxy).staticcall(hex\"f851a440\");\n require(success);\n return abi.decode(returndata, (address));\n }\n\n /**\n * @dev Changes the admin of `proxy` to `newAdmin`.\n *\n * Requirements:\n *\n * - This contract must be the current admin of `proxy`.\n */\n function changeProxyAdmin(TransparentUpgradeableProxy proxy, address newAdmin) public virtual onlyOwner {\n proxy.changeAdmin(newAdmin);\n }\n\n /**\n * @dev Upgrades `proxy` to `implementation`. See {TransparentUpgradeableProxy-upgradeTo}.\n *\n * Requirements:\n *\n * - This contract must be the admin of `proxy`.\n */\n function upgrade(TransparentUpgradeableProxy proxy, address implementation) public virtual onlyOwner {\n proxy.upgradeTo(implementation);\n }\n\n /**\n * @dev Upgrades `proxy` to `implementation` and calls a function on the new implementation. See\n * {TransparentUpgradeableProxy-upgradeToAndCall}.\n *\n * Requirements:\n *\n * - This contract must be the admin of `proxy`.\n */\n function upgradeAndCall(\n TransparentUpgradeableProxy proxy,\n address implementation,\n bytes memory data\n ) public payable virtual onlyOwner {\n proxy.upgradeToAndCall{ value: msg.value }(implementation, data);\n }\n}\n" + }, + "contracts/external/TransparentUpgradeableProxy.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol\";\n\n/**\n * @dev This contract implements a proxy that is upgradeable by an admin. It is fully forked from OpenZeppelin\n * `TransparentUpgradeableProxy`\n *\n * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector\n * clashing], which can potentially be used in an attack, this contract uses the\n * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two\n * things that go hand in hand:\n *\n * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if\n * that call matches one of the admin functions exposed by the proxy itself.\n * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the\n * implementation. If the admin tries to call a function on the implementation it will fail with an error that says\n * \"admin cannot fallback to proxy target\".\n *\n * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing\n * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due\n * to sudden errors when trying to call a function from the proxy implementation.\n *\n * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,\n * you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\n */\ncontract TransparentUpgradeableProxy is ERC1967Proxy {\n /**\n * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.\n */\n modifier ifAdmin() {\n if (msg.sender == _getAdmin()) {\n _;\n } else {\n _fallback();\n }\n }\n\n /**\n * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and\n * optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\n */\n constructor(\n address _logic,\n address admin_,\n bytes memory _data\n ) payable ERC1967Proxy(_logic, _data) {\n assert(_ADMIN_SLOT == bytes32(uint256(keccak256(\"eip1967.proxy.admin\")) - 1));\n _changeAdmin(admin_);\n }\n\n /**\n * @dev Returns the current admin.\n *\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.\n *\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\n */\n function admin() external ifAdmin returns (address admin_) {\n admin_ = _getAdmin();\n }\n\n /**\n * @dev Returns the current implementation.\n *\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.\n *\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\n * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\n */\n function implementation() external ifAdmin returns (address implementation_) {\n implementation_ = _implementation();\n }\n\n /**\n * @dev Changes the admin of the proxy.\n *\n * Emits an {AdminChanged} event.\n *\n * NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\n */\n function changeAdmin(address newAdmin) external virtual ifAdmin {\n _changeAdmin(newAdmin);\n }\n\n /**\n * @dev Upgrade the implementation of the proxy.\n *\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\n */\n function upgradeTo(address newImplementation) external ifAdmin {\n _upgradeToAndCall(newImplementation, bytes(\"\"), false);\n }\n\n /**\n * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified\n * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the\n * proxied contract.\n *\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\n */\n function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {\n _upgradeToAndCall(newImplementation, data, true);\n }\n\n /**\n * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.\n */\n function _beforeFallback() internal virtual override {\n require(msg.sender != _getAdmin(), \"TransparentUpgradeableProxy: admin cannot fallback to proxy target\");\n super._beforeFallback();\n }\n\n /**\n * @dev Returns the current admin.\n */\n function _admin() internal view virtual returns (address) {\n return _getAdmin();\n }\n}\n" + }, + "contracts/interfaces/CoreModuleInterfaces.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.7;\n\n/// @title IAngleMiddlemanGauge\n/// @author Angle Core Team\n/// @notice Interface for the `AngleMiddleman` contract\ninterface IAngleMiddlemanGauge {\n function notifyReward(address gauge, uint256 amount) external;\n}\n\ninterface IStakingRewards {\n function notifyRewardAmount(uint256 reward) external;\n}\n\ninterface IGaugeController {\n //solhint-disable-next-line\n function gauge_types(address addr) external view returns (int128);\n\n //solhint-disable-next-line\n function gauge_relative_weight_write(address addr, uint256 timestamp) external returns (uint256);\n\n //solhint-disable-next-line\n function gauge_relative_weight(address addr, uint256 timestamp) external view returns (uint256);\n}\n\ninterface ILiquidityGauge {\n // solhint-disable-next-line\n function deposit_reward_token(address _rewardToken, uint256 _amount) external;\n}\n" + }, + "contracts/interfaces/external/algebra/IAlgebraPool.sol": { + "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title IAlgebraPool\n/// @dev Copied from: https://github.com/cryptoalgebra/Algebra/blob/master/src/core/contracts/interfaces/pool/IAlgebraPoolState.sol\ninterface IAlgebraPool {\n /**\n * @notice The globalState structure in the pool stores many values but requires only one slot\n * and is exposed as a single method to save gas when accessed externally.\n * @return price The current price of the pool as a sqrt(token1/token0) Q64.96 value;\n * Returns tick The current tick of the pool, i.e. according to the last tick transition that was run;\n * Returns This value may not always be equal to SqrtTickMath.getTickAtSqrtRatio(price) if the price is on a tick\n * boundary;\n * Returns fee The last pool fee value in hundredths of a bip, i.e. 1e-6;\n * Returns timepointIndex The index of the last written timepoint;\n * Returns communityFeeToken0 The community fee percentage of the swap fee in thousandths (1e-3) for token0;\n * Returns communityFeeToken1 The community fee percentage of the swap fee in thousandths (1e-3) for token1;\n * Returns unlocked Whether the pool is currently locked to reentrancy;\n */\n function globalState()\n external\n view\n returns (\n uint160 price,\n int24 tick,\n uint16 fee,\n uint16 timepointIndex,\n uint8 communityFeeToken0,\n uint8 communityFeeToken1,\n bool unlocked\n );\n}\n" + }, + "contracts/interfaces/external/uniswap/IUniswapV3Pool.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity >=0.5.0;\n\n/// @title Pool state that never changes\n/// @notice These parameters are fixed for a pool forever, i.e., the methods will always return the same values\ninterface IUniswapV3Pool {\n /// @notice The first of the two tokens of the pool, sorted by address\n /// @return The token contract address\n function token0() external view returns (address);\n\n /// @notice The second of the two tokens of the pool, sorted by address\n /// @return The token contract address\n function token1() external view returns (address);\n\n /// @notice The pool's fee in hundredths of a bip, i.e. 1e-6\n /// @return The fee\n function fee() external view returns (uint24);\n}\n" + }, + "contracts/interfaces/IAgToken.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\";\n\n/// @title IAgToken\n/// @author Angle Core Team\n/// @notice Interface for the stablecoins `AgToken` contracts\n/// @dev This interface only contains functions of the `AgToken` contract which are called by other contracts\n/// of this module or of the first module of the Angle Protocol\ninterface IAgToken is IERC20Upgradeable {\n // ======================= Minter Role Only Functions ===========================\n\n /// @notice Lets the `StableMaster` contract or another whitelisted contract mint agTokens\n /// @param account Address to mint to\n /// @param amount Amount to mint\n /// @dev The contracts allowed to issue agTokens are the `StableMaster` contract, `VaultManager` contracts\n /// associated to this stablecoin as well as the flash loan module (if activated) and potentially contracts\n /// whitelisted by governance\n function mint(address account, uint256 amount) external;\n\n /// @notice Burns `amount` tokens from a `burner` address after being asked to by `sender`\n /// @param amount Amount of tokens to burn\n /// @param burner Address to burn from\n /// @param sender Address which requested the burn from `burner`\n /// @dev This method is to be called by a contract with the minter right after being requested\n /// to do so by a `sender` address willing to burn tokens from another `burner` address\n /// @dev The method checks the allowance between the `sender` and the `burner`\n function burnFrom(uint256 amount, address burner, address sender) external;\n\n /// @notice Burns `amount` tokens from a `burner` address\n /// @param amount Amount of tokens to burn\n /// @param burner Address to burn from\n /// @dev This method is to be called by a contract with a minter right on the AgToken after being\n /// requested to do so by an address willing to burn tokens from its address\n function burnSelf(uint256 amount, address burner) external;\n\n // ========================= Treasury Only Functions ===========================\n\n /// @notice Adds a minter in the contract\n /// @param minter Minter address to add\n /// @dev Zero address checks are performed directly in the `Treasury` contract\n function addMinter(address minter) external;\n\n /// @notice Removes a minter from the contract\n /// @param minter Minter address to remove\n /// @dev This function can also be called by a minter wishing to revoke itself\n function removeMinter(address minter) external;\n\n /// @notice Sets a new treasury contract\n /// @param _treasury New treasury address\n function setTreasury(address _treasury) external;\n\n // ========================= External functions ================================\n\n /// @notice Checks whether an address has the right to mint agTokens\n /// @param minter Address for which the minting right should be checked\n /// @return Whether the address has the right to mint agTokens or not\n function isMinter(address minter) external view returns (bool);\n}\n" + }, + "contracts/interfaces/ICore.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\n/// @title ICore\n/// @author Angle Labs, Inc.\n/// @notice Interface for the `Core` contracts of smart contract modules used in Angle Labs contracts\ninterface ICore {\n /// @notice Checks whether an address is governor\n /// @param admin Address to check\n /// @return Whether the address has the `GOVERNOR_ROLE` or not\n function isGovernor(address admin) external view returns (bool);\n\n /// @notice Checks whether an address is a governor or a guardian of a module\n /// @param admin Address to check\n /// @return Whether the address has the `GUARDIAN_ROLE` or not\n /// @dev Governance should make sure when adding a governor to also give this governor the guardian\n /// role by calling the `addGovernor` function\n function isGovernorOrGuardian(address admin) external view returns (bool);\n}\n" + }, + "contracts/interfaces/ITreasury.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"./IAgToken.sol\";\nimport \"./ICore.sol\";\n\n/// @title ITreasury\n/// @author Angle Core Team\n/// @notice Interface for the `Treasury` contract\n/// @dev This interface only contains functions of the `Treasury` which are called by other contracts\n/// of this module\ninterface ITreasury {\n /// @notice Stablecoin handled by this `treasury` contract\n function stablecoin() external view returns (IAgToken);\n\n /// @notice Checks whether a given address has the governor role\n /// @param admin Address to check\n /// @return Whether the address has the governor role\n /// @dev Access control is only kept in the `CoreBorrow` contract\n function isGovernor(address admin) external view returns (bool);\n\n /// @notice Checks whether a given address has the guardian or the governor role\n /// @param admin Address to check\n /// @return Whether the address has the guardian or the governor role\n /// @dev Access control is only kept in the `CoreBorrow` contract which means that this function\n /// queries the `CoreBorrow` contract\n function isGovernorOrGuardian(address admin) external view returns (bool);\n}\n" + }, + "contracts/middleman/MerklGaugeMiddleman.sol": { + "content": "// SPDX-License-Identifier: BUSL-1.1\n\n/*\n * █ \n ***** ▓▓▓ \n * ▓▓▓▓▓▓▓ \n * ///. ▓▓▓▓▓▓▓▓▓▓▓▓▓ \n ***** //////// ▓▓▓▓▓▓▓ \n * ///////////// ▓▓▓ \n ▓▓ ////////////////// █ ▓▓ \n ▓▓ ▓▓ /////////////////////// ▓▓ ▓▓ \n ▓▓ ▓▓ //////////////////////////// ▓▓ ▓▓ \n ▓▓ ▓▓ /////////▓▓▓///////▓▓▓///////// ▓▓ ▓▓ \n ▓▓ ,////////////////////////////////////// ▓▓ ▓▓ \n ▓▓ ////////////////////////////////////////// ▓▓ \n ▓▓ //////////////////////▓▓▓▓///////////////////// \n ,//////////////////////////////////////////////////// \n .////////////////////////////////////////////////////////// \n .//////////////////////////██.,//////////////////////////█ \n .//////////////////////████..,./////////////////////██ \n ...////////////////███████.....,.////////////////███ \n ,.,////////////████████ ........,///////////████ \n .,.,//////█████████ ,.......///////████ \n ,..//████████ ........./████ \n ..,██████ .....,███ \n .██ ,.,█ \n \n \n \n ▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓ ▓▓▓▓▓▓▓▓▓▓ \n ▓▓▓▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓ ▓▓ ▓▓▓▓ \n ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓ ▓▓▓▓▓ \n ▓▓▓ ▓▓ ▓▓▓ ▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ \n*/\n\npragma solidity ^0.8.17;\n\nimport { IERC20 } from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport { SafeERC20 } from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\n\nimport \"../DistributionCreator.sol\";\n\n/// @title MerklGaugeMiddleman\n/// @author Angle Labs, Inc.\n/// @notice Manages the transfer of ANGLE rewards to the `DistributionCreator` contract\n/// @dev This contract is built under the assumption that the `DistributionCreator` contract has already whitelisted\n/// this contract for it to distribute rewards without having to sign a message\n/// @dev Transient funds left in this contract after a call may be exploited\ncontract MerklGaugeMiddleman {\n using SafeERC20 for IERC20;\n\n // ================================= PARAMETERS ================================\n\n /// @notice Contract handling access control\n ICore public accessControlManager;\n\n /// @notice Maps a gauge to its reward parameters\n mapping(address => DistributionParameters) public gaugeParams;\n\n // =================================== EVENT ===================================\n\n event GaugeSet(address indexed gauge);\n\n constructor(ICore _accessControlManager) {\n if (address(_accessControlManager) == address(0)) revert ZeroAddress();\n accessControlManager = _accessControlManager;\n IERC20 _angle = angle();\n // Condition left here for testing purposes\n if (address(_angle) != address(0))\n _angle.safeIncreaseAllowance(address(merklDistributionCreator()), type(uint256).max);\n }\n\n // ================================= REFERENCES ================================\n\n /// @notice Address of the ANGLE token\n function angle() public view virtual returns (IERC20) {\n return IERC20(0x31429d1856aD1377A8A0079410B297e1a9e214c2);\n }\n\n /// @notice Address of the Merkl contract managing rewards to be distributed\n /// @dev Address is the same across the different chains on which it is deployed\n function merklDistributionCreator() public view virtual returns (DistributionCreator) {\n return DistributionCreator(0x8BB4C975Ff3c250e0ceEA271728547f3802B36Fd);\n }\n\n // ============================= EXTERNAL FUNCTIONS ============================\n\n /// @notice Restores the allowance for the ANGLE token to the `DistributionCreator` contract\n function setAngleAllowance() external {\n IERC20 _angle = angle();\n address manager = address(merklDistributionCreator());\n uint256 currentAllowance = _angle.allowance(address(this), manager);\n if (currentAllowance < type(uint256).max)\n _angle.safeIncreaseAllowance(manager, type(uint256).max - currentAllowance);\n }\n\n /// @notice Specifies the reward distribution parameters for `gauge`\n function setGauge(address gauge, DistributionParameters memory params) external {\n if (!accessControlManager.isGovernorOrGuardian(msg.sender)) revert NotGovernorOrGuardian();\n DistributionCreator manager = merklDistributionCreator();\n if (\n gauge == address(0) ||\n params.rewardToken != address(angle()) ||\n (manager.isWhitelistedToken(IUniswapV3Pool(params.uniV3Pool).token0()) == 0 &&\n manager.isWhitelistedToken(IUniswapV3Pool(params.uniV3Pool).token1()) == 0)\n ) revert InvalidParams();\n gaugeParams[gauge] = params;\n emit GaugeSet(gauge);\n }\n\n /// @notice Transmits rewards from the `AngleDistributor` to the `DistributionCreator` with the correct\n /// parameters\n /// @dev Callable by any contract\n /// @dev This method can be used to recover leftover ANGLE tokens in the contract\n function notifyReward(address gauge, uint256 amount) public {\n DistributionParameters memory params = gaugeParams[gauge];\n if (params.uniV3Pool == address(0)) revert InvalidParams();\n if (amount == 0) amount = angle().balanceOf(address(this));\n params.epochStart = uint32(block.timestamp);\n params.amount = amount;\n DistributionCreator creator = merklDistributionCreator();\n if (amount > 0) {\n // Need to deal with minimum distribution amounts\n if (amount > creator.rewardTokenMinAmounts(address(angle())) * params.numEpoch) {\n merklDistributionCreator().createDistribution(params);\n } else {\n // Sending leftover ANGLE tokens to the `msg.sender`\n angle().safeTransfer(msg.sender, amount);\n }\n }\n }\n\n /// @notice Fetches tokens and transmits rewards in the same transaction\n function notifyRewardWithTransfer(address gauge, uint256 amount) external {\n angle().safeTransferFrom(msg.sender, address(this), amount);\n notifyReward(gauge, amount);\n }\n}\n" + }, + "contracts/middleman/MerklGaugeMiddlemanPolygon.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"./MerklGaugeMiddleman.sol\";\n\n/// @title MerklGaugeMiddlemanPolygon\n/// @author Angle Labs, Inc.\ncontract MerklGaugeMiddlemanPolygon is MerklGaugeMiddleman {\n constructor(ICore _accessControlManager) MerklGaugeMiddleman(_accessControlManager) {}\n\n function angle() public pure override returns (IERC20) {\n return IERC20(0x900F717EA076E1E7a484ad9DD2dB81CEEc60eBF1);\n }\n}\n" + }, + "contracts/mock/AngleDistributor.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.7;\n\nimport \"./AngleDistributorEvents.sol\";\n\n/// @title AngleDistributor\n/// @author Forked from contracts developed by Curve and Frax and adapted by Angle Core Team\n/// - ERC20CRV.vy (https://github.com/curvefi/curve-dao-contracts/blob/master/contracts/ERC20CRV.vy)\n/// - FraxGaugeFXSRewardsDistributor.sol (https://github.com/FraxFinance/frax-solidity/blob/master/src/hardhat/contracts/Curve/FraxGaugeFXSRewardsDistributor.sol)\n/// @notice All the events used in `AngleDistributor` contract\ncontract AngleDistributor is AngleDistributorEvents, ReentrancyGuardUpgradeable, AccessControlUpgradeable {\n using SafeERC20 for IERC20;\n\n /// @notice Role for governors only\n bytes32 public constant GOVERNOR_ROLE = keccak256(\"GOVERNOR_ROLE\");\n /// @notice Role for the guardian\n bytes32 public constant GUARDIAN_ROLE = keccak256(\"GUARDIAN_ROLE\");\n\n /// @notice Length of a week in seconds\n uint256 public constant WEEK = 3600 * 24 * 7;\n\n /// @notice Time at which the emission rate is updated\n uint256 public constant RATE_REDUCTION_TIME = WEEK;\n\n /// @notice Reduction of the emission rate\n uint256 public constant RATE_REDUCTION_COEFFICIENT = 1007827884862117171; // 1.5 ^ (1/52) * 10**18\n\n /// @notice Base used for computation\n uint256 public constant BASE = 10**18;\n\n /// @notice Maps the address of a gauge to the last time this gauge received rewards\n mapping(address => uint256) public lastTimeGaugePaid;\n\n /// @notice Maps the address of a gauge to whether it was killed or not\n /// A gauge killed in this contract cannot receive any rewards\n mapping(address => bool) public killedGauges;\n\n /// @notice Maps the address of a type >= 2 gauge to a delegate address responsible\n /// for giving rewards to the actual gauge\n mapping(address => address) public delegateGauges;\n\n /// @notice Maps the address of a gauge delegate to whether this delegate supports the `notifyReward` interface\n /// and is therefore built for automation\n mapping(address => bool) public isInterfaceKnown;\n\n /// @notice Address of the ANGLE token given as a reward\n IERC20 public rewardToken;\n\n /// @notice Address of the `GaugeController` contract\n IGaugeController public controller;\n\n /// @notice Address responsible for pulling rewards of type >= 2 gauges and distributing it to the\n /// associated contracts if there is not already an address delegated for this specific contract\n address public delegateGauge;\n\n /// @notice ANGLE current emission rate, it is first defined in the initializer and then updated every week\n uint256 public rate;\n\n /// @notice Timestamp at which the current emission epoch started\n uint256 public startEpochTime;\n\n /// @notice Amount of ANGLE tokens distributed through staking at the start of the epoch\n /// This is an informational variable used to track how much has been distributed through liquidity mining\n uint256 public startEpochSupply;\n\n /// @notice Index of the current emission epoch\n /// Here also, this variable is not useful per se inside the smart contracts of the protocol, it is\n /// just an informational variable\n uint256 public miningEpoch;\n\n /// @notice Whether ANGLE distribution through this contract is on or no\n bool public distributionsOn;\n\n /// @notice Constructor of the contract\n /// @param _rewardToken Address of the ANGLE token\n /// @param _controller Address of the GaugeController\n /// @param _initialRate Initial ANGLE emission rate\n /// @param _startEpochSupply Amount of ANGLE tokens already distributed via liquidity mining\n /// @param governor Governor address of the contract\n /// @param guardian Address of the guardian of this contract\n /// @param _delegateGauge Address that will be used to pull rewards for type 2 gauges\n /// @dev After this contract is created, the correct amount of ANGLE tokens should be transferred to the contract\n /// @dev The `_delegateGauge` can be the zero address\n function initialize(\n address _rewardToken,\n address _controller,\n uint256 _initialRate,\n uint256 _startEpochSupply,\n address governor,\n address guardian,\n address _delegateGauge\n ) external initializer {\n require(\n _controller != address(0) && _rewardToken != address(0) && guardian != address(0) && governor != address(0),\n \"0\"\n );\n rewardToken = IERC20(_rewardToken);\n controller = IGaugeController(_controller);\n startEpochSupply = _startEpochSupply;\n miningEpoch = 0;\n // Some ANGLE tokens should be sent to the contract directly after initialization\n rate = _initialRate;\n delegateGauge = _delegateGauge;\n distributionsOn = false;\n startEpochTime = block.timestamp;\n _setRoleAdmin(GOVERNOR_ROLE, GOVERNOR_ROLE);\n _setRoleAdmin(GUARDIAN_ROLE, GOVERNOR_ROLE);\n _setupRole(GUARDIAN_ROLE, guardian);\n _setupRole(GOVERNOR_ROLE, governor);\n _setupRole(GUARDIAN_ROLE, governor);\n }\n\n /// @custom:oz-upgrades-unsafe-allow constructor\n constructor() initializer {}\n\n // ======================== Internal Functions =================================\n\n /// @notice Internal function to distribute rewards to a gauge\n /// @param gaugeAddr Address of the gauge to distribute rewards to\n /// @return weeksElapsed Weeks elapsed since the last call\n /// @return rewardTally Amount of rewards distributed to the gauge\n /// @dev The reason for having an internal function is that it's called by the `distributeReward` and the\n /// `distributeRewardToMultipleGauges`\n /// @dev Although they would need to be performed all the time this function is called, this function does not\n /// contain checks on whether distribution is on, and on whether rate should be reduced. These are done in each external\n /// function calling this function for gas efficiency\n function _distributeReward(address gaugeAddr) internal returns (uint256 weeksElapsed, uint256 rewardTally) {\n // Checking if the gauge has been added or if it still possible to distribute rewards to this gauge\n int128 gaugeType = IGaugeController(controller).gauge_types(gaugeAddr);\n require(gaugeType >= 0 && !killedGauges[gaugeAddr], \"110\");\n\n // Calculate the elapsed time in weeks.\n uint256 lastTimePaid = lastTimeGaugePaid[gaugeAddr];\n\n // Edge case for first reward for this gauge\n if (lastTimePaid == 0) {\n weeksElapsed = 1;\n if (gaugeType == 0) {\n // We give a full approval for the gauges with type zero which correspond to the staking\n // contracts of the protocol\n rewardToken.safeApprove(gaugeAddr, type(uint256).max);\n }\n } else {\n // Truncation desired\n weeksElapsed = (block.timestamp - lastTimePaid) / WEEK;\n // Return early here for 0 weeks instead of throwing, as it could have bad effects in other contracts\n if (weeksElapsed == 0) {\n return (0, 0);\n }\n }\n rewardTally = 0;\n // We use this variable to keep track of the emission rate across different weeks\n uint256 weeklyRate = rate;\n for (uint256 i = 0; i < weeksElapsed; i++) {\n uint256 relWeightAtWeek;\n if (i == 0) {\n // Mutative, for the current week: makes sure the weight is checkpointed. Also returns the weight.\n relWeightAtWeek = controller.gauge_relative_weight_write(gaugeAddr, block.timestamp);\n } else {\n // View\n relWeightAtWeek = controller.gauge_relative_weight(gaugeAddr, (block.timestamp - WEEK * i));\n }\n rewardTally += (weeklyRate * relWeightAtWeek * WEEK) / BASE;\n\n // To get the rate of the week prior from the current rate we just have to multiply by the weekly division\n // factor\n // There may be some precisions error: inferred previous values of the rate may be different to what we would\n // have had if the rate had been computed correctly in these weeks: we expect from empirical observations\n // this `weeklyRate` to be inferior to what the `rate` would have been\n weeklyRate = (weeklyRate * RATE_REDUCTION_COEFFICIENT) / BASE;\n }\n\n // Update the last time paid, rounded to the closest week\n // in order not to have an ever moving time on when to call this function\n lastTimeGaugePaid[gaugeAddr] = (block.timestamp / WEEK) * WEEK;\n\n // If the `gaugeType >= 2`, this means that the gauge is a gauge on another chain (and corresponds to tokens\n // that need to be bridged) or is associated to an external contract of the Angle Protocol\n if (gaugeType >= 2) {\n // If it is defined, we use the specific delegate attached to the gauge\n address delegate = delegateGauges[gaugeAddr];\n if (delegate == address(0)) {\n // If not, we check if a delegate common to all gauges with type >= 2 can be used\n delegate = delegateGauge;\n }\n if (delegate != address(0)) {\n _sendDelegateRewards(gaugeAddr, delegate, rewardTally);\n } else {\n rewardToken.safeTransfer(gaugeAddr, rewardTally);\n }\n } else if (gaugeType == 1) {\n // This is for the case of Perpetual contracts which need to be able to receive their reward tokens\n rewardToken.safeTransfer(gaugeAddr, rewardTally);\n IStakingRewards(gaugeAddr).notifyRewardAmount(rewardTally);\n } else {\n // Potentially override the gauge address\n address delegate = delegateGauges[gaugeAddr];\n if (delegate != address(0)) {\n _sendDelegateRewards(gaugeAddr, delegate, rewardTally);\n } else {\n ILiquidityGauge(gaugeAddr).deposit_reward_token(address(rewardToken), rewardTally);\n }\n }\n emit RewardDistributed(gaugeAddr, rewardTally);\n }\n\n /// @notice Helper to send `rewardTally` for `gaugeAddr` to the non zero `delegate` address\n function _sendDelegateRewards(\n address gaugeAddr,\n address delegate,\n uint256 rewardTally\n ) internal {\n rewardToken.safeTransfer(delegate, rewardTally);\n // If this delegate supports a specific interface, then rewards sent are notified through this\n // interface\n if (isInterfaceKnown[delegate]) {\n IAngleMiddlemanGauge(delegate).notifyReward(gaugeAddr, rewardTally);\n }\n }\n\n /// @notice Updates mining rate and supply at the start of the epoch\n /// @dev Any modifying mining call must also call this\n /// @dev It is possible that more than one week past between two calls of this function, and for this reason\n /// this function has been slightly modified from Curve implementation by Angle Team\n function _updateMiningParameters() internal {\n // When entering this function, we always have: `(block.timestamp - startEpochTime) / RATE_REDUCTION_TIME >= 1`\n uint256 epochDelta = (block.timestamp - startEpochTime) / RATE_REDUCTION_TIME;\n\n // Storing intermediate values for the rate and for the `startEpochSupply`\n uint256 _rate = rate;\n uint256 _startEpochSupply = startEpochSupply;\n\n startEpochTime += RATE_REDUCTION_TIME * epochDelta;\n miningEpoch += epochDelta;\n\n for (uint256 i = 0; i < epochDelta; i++) {\n // Updating the intermediate values of the `startEpochSupply`\n _startEpochSupply += _rate * RATE_REDUCTION_TIME;\n _rate = (_rate * BASE) / RATE_REDUCTION_COEFFICIENT;\n }\n rate = _rate;\n startEpochSupply = _startEpochSupply;\n emit UpdateMiningParameters(block.timestamp, _rate, _startEpochSupply);\n }\n\n /// @notice Toggles the fact that a gauge delegate can be used for automation or not and therefore supports\n /// the `notifyReward` interface\n /// @param _delegateGauge Address of the gauge to change\n function _toggleInterfaceKnown(address _delegateGauge) internal {\n bool isInterfaceKnownMem = isInterfaceKnown[_delegateGauge];\n isInterfaceKnown[_delegateGauge] = !isInterfaceKnownMem;\n emit InterfaceKnownToggled(_delegateGauge, !isInterfaceKnownMem);\n }\n\n // ================= Permissionless External Functions =========================\n\n /// @notice Distributes rewards to a staking contract (also called gauge)\n /// @param gaugeAddr Address of the gauge to send tokens too\n /// @return weeksElapsed Number of weeks elapsed since the last time rewards were distributed\n /// @return rewardTally Amount of tokens sent to the gauge\n /// @dev Anyone can call this function to distribute rewards to the different staking contracts\n function distributeReward(address gaugeAddr) external nonReentrant returns (uint256, uint256) {\n // Checking if distribution is on\n require(distributionsOn == true, \"109\");\n // Updating rate distribution parameters if need be\n if (block.timestamp >= startEpochTime + RATE_REDUCTION_TIME) {\n _updateMiningParameters();\n }\n return _distributeReward(gaugeAddr);\n }\n\n /// @notice Distributes rewards to multiple staking contracts\n /// @param gauges Addresses of the gauge to send tokens too\n /// @dev Anyone can call this function to distribute rewards to the different staking contracts\n /// @dev Compared with the `distributeReward` function, this function sends rewards to multiple\n /// contracts at the same time\n function distributeRewardToMultipleGauges(address[] memory gauges) external nonReentrant {\n // Checking if distribution is on\n require(distributionsOn == true, \"109\");\n // Updating rate distribution parameters if need be\n if (block.timestamp >= startEpochTime + RATE_REDUCTION_TIME) {\n _updateMiningParameters();\n }\n for (uint256 i = 0; i < gauges.length; i++) {\n _distributeReward(gauges[i]);\n }\n }\n\n /// @notice Updates mining rate and supply at the start of the epoch\n /// @dev Callable by any address, but only once per epoch\n function updateMiningParameters() external {\n require(block.timestamp >= startEpochTime + RATE_REDUCTION_TIME, \"108\");\n _updateMiningParameters();\n }\n\n // ========================= Governor Functions ================================\n\n /// @notice Withdraws ERC20 tokens that could accrue on this contract\n /// @param tokenAddress Address of the ERC20 token to withdraw\n /// @param to Address to transfer to\n /// @param amount Amount to transfer\n /// @dev Added to support recovering LP Rewards and other mistaken tokens\n /// from other systems to be distributed to holders\n /// @dev This function could also be used to recover ANGLE tokens in case the rate got smaller\n function recoverERC20(\n address tokenAddress,\n address to,\n uint256 amount\n ) external onlyRole(GOVERNOR_ROLE) {\n // If the token is the ANGLE token, we need to make sure that governance is not going to withdraw\n // too many tokens and that it'll be able to sustain the weekly distribution forever\n // This check assumes that `distributeReward` has been called for gauges and that there are no gauges\n // which have not received their past week's rewards\n if (tokenAddress == address(rewardToken)) {\n uint256 currentBalance = rewardToken.balanceOf(address(this));\n // The amount distributed till the end is `rate * WEEK / (1 - RATE_REDUCTION_FACTOR)` where\n // `RATE_REDUCTION_FACTOR = BASE / RATE_REDUCTION_COEFFICIENT` which translates to:\n require(\n currentBalance >=\n ((rate * RATE_REDUCTION_COEFFICIENT) * WEEK) / (RATE_REDUCTION_COEFFICIENT - BASE) + amount,\n \"4\"\n );\n }\n IERC20(tokenAddress).safeTransfer(to, amount);\n emit Recovered(tokenAddress, to, amount);\n }\n\n /// @notice Sets a new gauge controller\n /// @param _controller Address of the new gauge controller\n function setGaugeController(address _controller) external onlyRole(GOVERNOR_ROLE) {\n require(_controller != address(0), \"0\");\n controller = IGaugeController(_controller);\n emit GaugeControllerUpdated(_controller);\n }\n\n /// @notice Sets a new delegate gauge for pulling rewards of a type >= 2 gauges or of all type >= 2 gauges\n /// @param gaugeAddr Gauge to change the delegate of\n /// @param _delegateGauge Address of the new gauge delegate related to `gaugeAddr`\n /// @param toggleInterface Whether we should toggle the fact that the `_delegateGauge` is built for automation or not\n /// @dev This function can be used to remove delegating or introduce the pulling of rewards to a given address\n /// @dev If `gaugeAddr` is the zero address, this function updates the delegate gauge common to all gauges with type >= 2\n /// @dev The `toggleInterface` parameter has been added for convenience to save one transaction when adding a gauge delegate\n /// which supports the `notifyReward` interface\n function setDelegateGauge(\n address gaugeAddr,\n address _delegateGauge,\n bool toggleInterface\n ) external onlyRole(GOVERNOR_ROLE) {\n if (gaugeAddr != address(0)) {\n delegateGauges[gaugeAddr] = _delegateGauge;\n } else {\n delegateGauge = _delegateGauge;\n }\n emit DelegateGaugeUpdated(gaugeAddr, _delegateGauge);\n\n if (toggleInterface) {\n _toggleInterfaceKnown(_delegateGauge);\n }\n }\n\n /// @notice Changes the ANGLE emission rate\n /// @param _newRate New ANGLE emission rate\n /// @dev It is important to be super wary when calling this function and to make sure that `distributeReward`\n /// has been called for all gauges in the past weeks. If not, gauges may get an incorrect distribution of ANGLE rewards\n /// for these past weeks based on the new rate and not on the old rate\n /// @dev Governance should thus make sure to call this function rarely and when it does to do it after the weekly `distributeReward`\n /// calls for all existing gauges\n /// @dev As this function assumes that `distributeReward` has been called during the week, it also assumes that the `startEpochSupply`\n /// parameter has been put up to date\n function setRate(uint256 _newRate) external onlyRole(GOVERNOR_ROLE) {\n // Checking if the new rate is compatible with the amount of ANGLE tokens this contract has in balance\n // This check assumes, like this function, that `distributeReward` has correctly been called before\n require(\n rewardToken.balanceOf(address(this)) >=\n ((_newRate * RATE_REDUCTION_COEFFICIENT) * WEEK) / (RATE_REDUCTION_COEFFICIENT - BASE),\n \"4\"\n );\n rate = _newRate;\n emit RateUpdated(_newRate);\n }\n\n /// @notice Toggles the status of a gauge to either killed or unkilled\n /// @param gaugeAddr Gauge to toggle the status of\n /// @dev It is impossible to kill a gauge in the `GaugeController` contract, for this reason killing of gauges\n /// takes place in the `AngleDistributor` contract\n /// @dev This means that people could vote for a gauge in the gauge controller contract but that rewards are not going\n /// to be distributed to it in the end: people would need to remove their weights on the gauge killed to end the diminution\n /// in rewards\n /// @dev In the case of a gauge being killed, this function resets the timestamps at which this gauge has been approved and\n /// disapproves the gauge to spend the token\n /// @dev It should be cautiously called by governance as it could result in less ANGLE overall rewards than initially planned\n /// if people do not remove their voting weights to the killed gauge\n function toggleGauge(address gaugeAddr) external onlyRole(GOVERNOR_ROLE) {\n bool gaugeKilledMem = killedGauges[gaugeAddr];\n if (!gaugeKilledMem) {\n delete lastTimeGaugePaid[gaugeAddr];\n rewardToken.safeApprove(gaugeAddr, 0);\n }\n killedGauges[gaugeAddr] = !gaugeKilledMem;\n emit GaugeToggled(gaugeAddr, !gaugeKilledMem);\n }\n\n // ========================= Guardian Function =================================\n\n /// @notice Halts or activates distribution of rewards\n function toggleDistributions() external onlyRole(GUARDIAN_ROLE) {\n bool distributionsOnMem = distributionsOn;\n distributionsOn = !distributionsOnMem;\n emit DistributionsToggled(!distributionsOnMem);\n }\n\n /// @notice Notifies that the interface of a gauge delegate is known or has changed\n /// @param _delegateGauge Address of the gauge to change\n /// @dev Gauge delegates that are built for automation should be toggled\n function toggleInterfaceKnown(address _delegateGauge) external onlyRole(GUARDIAN_ROLE) {\n _toggleInterfaceKnown(_delegateGauge);\n }\n}\n" + }, + "contracts/mock/AngleDistributorEvents.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.7;\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport \"@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol\";\n\nimport \"../interfaces/CoreModuleInterfaces.sol\";\n\nimport \"../external/AccessControlUpgradeable.sol\";\n\n/// @title AngleDistributorEvents\n/// @author Angle Core Team\n/// @notice All the events used in `AngleDistributor` contract\ncontract AngleDistributorEvents {\n event DelegateGaugeUpdated(address indexed _gaugeAddr, address indexed _delegateGauge);\n event DistributionsToggled(bool _distributionsOn);\n event GaugeControllerUpdated(address indexed _controller);\n event GaugeToggled(address indexed gaugeAddr, bool newStatus);\n event InterfaceKnownToggled(address indexed _delegateGauge, bool _isInterfaceKnown);\n event RateUpdated(uint256 _newRate);\n event Recovered(address indexed tokenAddress, address indexed to, uint256 amount);\n event RewardDistributed(address indexed gaugeAddr, uint256 rewardTally);\n event UpdateMiningParameters(uint256 time, uint256 rate, uint256 supply);\n}\n" + }, + "contracts/mock/MockCoreBorrow.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\ncontract MockCoreBorrow {\n mapping(address => bool) public governors;\n mapping(address => bool) public guardians;\n\n function isGovernor(address admin) external view returns (bool) {\n return governors[admin];\n }\n\n function isGovernorOrGuardian(address admin) external view returns (bool) {\n return governors[admin] || guardians[admin];\n }\n\n function toggleGovernor(address admin) external {\n governors[admin] = !governors[admin];\n }\n\n function toggleGuardian(address admin) external {\n guardians[admin] = !guardians[admin];\n }\n}\n" + }, + "contracts/mock/MockMerklGaugeMiddleman.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"../middleman/MerklGaugeMiddleman.sol\";\n\ncontract MockMerklGaugeMiddleman is MerklGaugeMiddleman {\n address public angleDistributorAddress;\n IERC20 public angleAddress;\n DistributionCreator public manager;\n\n constructor(ICore _coreBorrow) MerklGaugeMiddleman(_coreBorrow) {}\n\n function angle() public view override returns (IERC20) {\n return angleAddress;\n }\n\n function merklDistributionCreator() public view override returns (DistributionCreator) {\n return manager;\n }\n\n function setAddresses(\n address _angleDistributorAddress,\n IERC20 _angleAddress,\n DistributionCreator _manager\n ) external {\n angleDistributorAddress = _angleDistributorAddress;\n angleAddress = _angleAddress;\n manager = _manager;\n }\n}\n" + }, + "contracts/mock/MockPool.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.7;\n\ncontract MockPool {\n address public token0;\n address public token1;\n uint32 public constant EPOCH_DURATION = 3600;\n\n function setToken(address token, uint256 who) external {\n if (who == 0) token0 = token;\n else token1 = token;\n }\n}\n" + }, + "contracts/mock/MockToken.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.7;\n\nimport \"@openzeppelin/contracts/token/ERC20/ERC20.sol\";\n\ncontract MockToken is ERC20 {\n event Minting(address indexed _to, address indexed _minter, uint256 _amount);\n\n event Burning(address indexed _from, address indexed _burner, uint256 _amount);\n\n uint8 internal _decimal;\n mapping(address => bool) public minters;\n address public treasury;\n\n constructor(\n string memory name_,\n string memory symbol_,\n uint8 decimal_\n ) ERC20(name_, symbol_) {\n _decimal = decimal_;\n }\n\n function decimals() public view override returns (uint8) {\n return _decimal;\n }\n\n function mint(address account, uint256 amount) external {\n _mint(account, amount);\n emit Minting(account, msg.sender, amount);\n }\n\n function burn(address account, uint256 amount) public {\n _burn(account, amount);\n emit Burning(account, msg.sender, amount);\n }\n\n function setAllowance(address from, address to) public {\n _approve(from, to, type(uint256).max);\n }\n\n function burnSelf(uint256 amount, address account) public {\n _burn(account, amount);\n emit Burning(account, msg.sender, amount);\n }\n\n function addMinter(address minter) public {\n minters[minter] = true;\n }\n\n function removeMinter(address minter) public {\n minters[minter] = false;\n }\n\n function setTreasury(address _treasury) public {\n treasury = _treasury;\n }\n}\n" + }, + "contracts/mock/MockTokenPermit.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.7;\n\nimport \"@openzeppelin/contracts/token/ERC20/extensions/draft-ERC20Permit.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\n\ncontract MockTokenPermit is ERC20Permit {\n using SafeERC20 for IERC20;\n event Minting(address indexed _to, address indexed _minter, uint256 _amount);\n\n event Burning(address indexed _from, address indexed _burner, uint256 _amount);\n\n uint8 internal _decimal;\n mapping(address => bool) public minters;\n address public treasury;\n uint256 public fees;\n\n bool public reverts;\n\n constructor(\n string memory name_,\n string memory symbol_,\n uint8 decimal_\n ) ERC20Permit(name_) ERC20(name_, symbol_) {\n _decimal = decimal_;\n }\n\n function decimals() public view override returns (uint8) {\n return _decimal;\n }\n\n function mint(address account, uint256 amount) external {\n _mint(account, amount);\n emit Minting(account, msg.sender, amount);\n }\n\n function burn(address account, uint256 amount) public {\n _burn(account, amount);\n emit Burning(account, msg.sender, amount);\n }\n\n function setAllowance(address from, address to) public {\n _approve(from, to, type(uint256).max);\n }\n\n function burnSelf(uint256 amount, address account) public {\n _burn(account, amount);\n emit Burning(account, msg.sender, amount);\n }\n\n function addMinter(address minter) public {\n minters[minter] = true;\n }\n\n function removeMinter(address minter) public {\n minters[minter] = false;\n }\n\n function setTreasury(address _treasury) public {\n treasury = _treasury;\n }\n\n function setFees(uint256 _fees) public {\n fees = _fees;\n }\n\n function recoverERC20(\n IERC20 token,\n address to,\n uint256 amount\n ) external {\n token.safeTransfer(to, amount);\n }\n\n function swapIn(\n address bridgeToken,\n uint256 amount,\n address to\n ) external returns (uint256) {\n require(!reverts);\n\n IERC20(bridgeToken).safeTransferFrom(msg.sender, address(this), amount);\n uint256 canonicalOut = amount;\n canonicalOut -= (canonicalOut * fees) / 10**9;\n _mint(to, canonicalOut);\n return canonicalOut;\n }\n\n function swapOut(\n address bridgeToken,\n uint256 amount,\n address to\n ) external returns (uint256) {\n require(!reverts);\n _burn(msg.sender, amount);\n uint256 bridgeOut = amount;\n bridgeOut -= (bridgeOut * fees) / 10**9;\n IERC20(bridgeToken).safeTransfer(to, bridgeOut);\n return bridgeOut;\n }\n}\n" + }, + "contracts/mock/MockTreasury.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\ncontract MockTreasury {\n address public stablecoin;\n address public governor;\n address public guardian;\n address public vaultManager1;\n address public vaultManager2;\n address public flashLoanModule;\n\n constructor(\n address _stablecoin,\n address _governor,\n address _guardian,\n address _vaultManager1,\n address _vaultManager2,\n address _flashLoanModule\n ) {\n stablecoin = _stablecoin;\n governor = _governor;\n guardian = _guardian;\n vaultManager1 = _vaultManager1;\n vaultManager2 = _vaultManager2;\n flashLoanModule = _flashLoanModule;\n }\n\n function isGovernor(address admin) external view returns (bool) {\n return (admin == governor);\n }\n\n function isGovernorOrGuardian(address admin) external view returns (bool) {\n return (admin == governor || admin == guardian);\n }\n}\n" + }, + "contracts/mock/MockUniswapV3Pool.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.7;\n\ncontract MockUniswapV3Pool {\n address public token0;\n address public token1;\n uint32 public constant EPOCH_DURATION = 3600;\n uint256 public fee;\n\n function setToken(address token, uint256 who) external {\n if (who == 0) token0 = token;\n else token1 = token;\n }\n\n function round(uint256 amount) external pure returns (uint256) {\n return (amount / EPOCH_DURATION) * EPOCH_DURATION;\n }\n}\n" + }, + "contracts/struct/DistributionParameters.sol": { + "content": "// SPDX-License-Identifier: BUSL-1.1\n\npragma solidity ^0.8.17;\n\nstruct DistributionParameters {\n // ID of the reward (populated once created)\n bytes32 rewardId;\n // Address of the UniswapV3 pool that needs to be incentivized\n address uniV3Pool;\n // Address of the reward token for the incentives\n address rewardToken;\n // Amount of `rewardToken` to distribute across all the epochs\n // Amount distributed per epoch is `amount/numEpoch`\n uint256 amount;\n // List of all position wrappers to consider or not for this contract. Some wrappers like Gamma or Arrakis\n // are automatically detected and so there is no need to specify them here. Check out the docs to find out\n // which need to be specified and which are not automatically detected.\n address[] positionWrappers;\n // Type (Arrakis, Gamma, Blacklist, ...) encoded as a `uint32` for each wrapper in the list above. Mapping between\n // wrapper types and their corresponding `uint32` value can be found in Angle Docs\n uint32[] wrapperTypes;\n // In the incentivization formula, how much of the fees should go to holders of token0\n // in base 10**4\n uint32 propToken0;\n // Proportion for holding token1 (in base 10**4)\n uint32 propToken1;\n // Proportion for providing a useful liquidity (in base 10**4) that generates fees\n uint32 propFees;\n // Timestamp at which the incentivization should start\n uint32 epochStart;\n // Amount of epochs for which incentivization should last\n uint32 numEpoch;\n // Whether out of range liquidity should still be incentivized or not\n // This should be equal to 1 if out of range liquidity should still be incentivized\n // and 0 otherwise\n uint32 isOutOfRangeIncentivized;\n // How much more addresses with a maximum boost can get with respect to addresses\n // which do not have a boost (in base 4). In the case of Curve where addresses get 2.5x more\n // this would be 25000\n uint32 boostedReward;\n // Address of the token which dictates who gets boosted rewards or not. This is optional\n // and if the zero address is given no boost will be taken into account\n address boostingAddress;\n // Additional data passed when distributing rewards. This parameter may be used in case\n // the reward distribution script needs to look into other parameters beyond the ones above.\n bytes additionalData;\n}\n" + }, + "contracts/struct/ExtensiveDistributionParameters.sol": { + "content": "// SPDX-License-Identifier: BUSL-1.1\n\npragma solidity ^0.8.17;\n\nimport \"./DistributionParameters.sol\";\n\nstruct UniswapTokenData {\n address add;\n uint8 decimals;\n string symbol;\n uint256 poolBalance;\n}\n\nstruct ExtensiveDistributionParameters {\n DistributionParameters base;\n // Uniswap pool data\n uint24 poolFee;\n UniswapTokenData token0;\n UniswapTokenData token1;\n // rewardToken data\n string rewardTokenSymbol;\n uint8 rewardTokenDecimals;\n}\n" + }, + "contracts/struct/RewardTokenAmounts.sol": { + "content": "// SPDX-License-Identifier: BUSL-1.1\n\npragma solidity ^0.8.17;\n\nstruct RewardTokenAmounts {\n address token;\n uint256 minimumAmountPerEpoch;\n}\n" + }, + "contracts/utils/Errors.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nerror InvalidDispute();\nerror InvalidLengths();\nerror InvalidParam();\nerror InvalidParams();\nerror InvalidProof();\nerror InvalidUninitializedRoot();\nerror InvalidReward();\nerror InvalidSignature();\nerror NoDispute();\nerror NotGovernor();\nerror NotGovernorOrGuardian();\nerror NotSigned();\nerror NotTrusted();\nerror NotWhitelisted();\nerror UnresolvedDispute();\nerror ZeroAddress();\n" + }, + "contracts/utils/UUPSHelper.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\n/*\n * █ \n ***** ▓▓▓ \n * ▓▓▓▓▓▓▓ \n * ///. ▓▓▓▓▓▓▓▓▓▓▓▓▓ \n ***** //////// ▓▓▓▓▓▓▓ \n * ///////////// ▓▓▓ \n ▓▓ ////////////////// █ ▓▓ \n ▓▓ ▓▓ /////////////////////// ▓▓ ▓▓ \n ▓▓ ▓▓ //////////////////////////// ▓▓ ▓▓ \n ▓▓ ▓▓ /////////▓▓▓///////▓▓▓///////// ▓▓ ▓▓ \n ▓▓ ,////////////////////////////////////// ▓▓ ▓▓ \n ▓▓ ////////////////////////////////////////// ▓▓ \n ▓▓ //////////////////////▓▓▓▓///////////////////// \n ,//////////////////////////////////////////////////// \n .////////////////////////////////////////////////////////// \n .//////////////////////////██.,//////////////////////////█ \n .//////////////////////████..,./////////////////////██ \n ...////////////////███████.....,.////////////////███ \n ,.,////////////████████ ........,///////////████ \n .,.,//////█████████ ,.......///////████ \n ,..//████████ ........./████ \n ..,██████ .....,███ \n .██ ,.,█ \n \n \n \n ▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓ ▓▓▓▓▓▓▓▓▓▓ \n ▓▓▓▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓ ▓▓ ▓▓▓▓ \n ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓ ▓▓▓▓▓ \n ▓▓▓ ▓▓ ▓▓▓ ▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ \n*/\n\npragma solidity ^0.8.17;\n\nimport \"@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol\";\n\nimport \"../interfaces/ICore.sol\";\nimport \"../utils/Errors.sol\";\n\n/// @title UUPSHelper\n/// @notice Helper contract for UUPSUpgradeable contracts where the upgradeability is controlled by a specific address\n/// @author Angle Labs., Inc\n/// @dev The 0 address check in the modifier allows the use of these modifiers during initialization\nabstract contract UUPSHelper is UUPSUpgradeable {\n modifier onlyGuardianUpgrader(ICore _core) {\n if (address(_core) != address(0) && !_core.isGovernorOrGuardian(msg.sender)) revert NotGovernorOrGuardian();\n _;\n }\n\n modifier onlyGovernorUpgrader(ICore _core) {\n if (address(_core) != address(0) && !_core.isGovernor(msg.sender)) revert NotGovernor();\n _;\n }\n\n constructor() initializer {}\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 100000 + }, + "viaIR": false, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + } + } +} \ No newline at end of file diff --git a/hardhat.config.ts b/hardhat.config.ts index 4171d10..5452ea6 100644 --- a/hardhat.config.ts +++ b/hardhat.config.ts @@ -81,7 +81,7 @@ const config: HardhatUserConfig = { // For the lists of Chain ID: https://chainlist.org networks: { hardhat: { - accounts: accounts('filecoin'), + accounts: accounts('coredao'), live: false, blockGasLimit: 125e5, initialBaseFeePerGas: 0, @@ -116,7 +116,7 @@ const config: HardhatUserConfig = { url: nodeUrl('polygonzkevm'), blockNumber: 3214816, */ - url: nodeUrl('filecoin'), + url: nodeUrl('coredao'), // blockNumber: 14188687, }, mining: argv.disableAutoMining @@ -330,6 +330,32 @@ const config: HardhatUserConfig = { }, }, }, + thundercore: { + live: true, + url: nodeUrl('thundercore'), + accounts: accounts('thundercore'), + gas: 'auto', + gasMultiplier: 1.3, + chainId: 108, + verify: { + etherscan: { + apiKey: etherscanKey('thundercore'), + }, + }, + }, + coredao: { + live: true, + url: nodeUrl('coredao'), + accounts: accounts('coredao'), + gas: 'auto', + gasMultiplier: 1.3, + chainId: 1116, + verify: { + etherscan: { + apiKey: etherscanKey('coredao'), + }, + }, + }, }, paths: { sources: './contracts', From 9cf929b6616925cd2da94bc4d46dbfef60c23283 Mon Sep 17 00:00:00 2001 From: Thibaud Date: Wed, 22 Nov 2023 16:27:21 +0100 Subject: [PATCH 3/3] refactor: small modifs (#45) --- scripts/deployMockToken.ts | 8 +++--- scripts/sendReward.ts | 53 ++++++++++++++++++++++---------------- 2 files changed, 35 insertions(+), 26 deletions(-) diff --git a/scripts/deployMockToken.ts b/scripts/deployMockToken.ts index 660a8a8..0d754b8 100644 --- a/scripts/deployMockToken.ts +++ b/scripts/deployMockToken.ts @@ -6,23 +6,23 @@ import { MockToken__factory } from '../typechain'; async function main() { const { deployer } = await ethers.getNamedSigners(); - const distributorCreator = `0xA9c076992F3917b47E2C619c46ff0b652d76e6B4`; + const distributorCreator = `TO_COMPLETE`; console.log(`DistributorCreator address ${distributorCreator}`); console.log(`Deploying MockToken with address ${deployer.address}...`); const MockToken = await new MockToken__factory(deployer).deploy('MockAngleReward', 'agReward', 18); // const MockToken = MockToken__factory.connect('0x84FB94595f9Aef81147cD4070a1564128A84bb7c', deployer); - console.log('...Deployed mock token at address', MockToken.address, '✅'); + console.log(`...Deployed mock token at address ${MockToken.address} ✅`); console.log(`Minting MockToken to ${deployer.address}...`); await ( - await MockToken.mint(deployer.address, parseEther('5000'), { + await MockToken.mint(deployer.address, parseEther('1000000'), { gasLimit: 300_000, maxPriorityFeePerGas: 100e9, maxFeePerGas: 700e9, }) ).wait(); - console.log('...Minted mock token to address', deployer.address, '✅'); + console.log(`...Minted mock token to address ${deployer.address} ✅`); console.log('Approving...'); await (await MockToken.connect(deployer).approve(distributorCreator, MAX_UINT256)).wait(); diff --git a/scripts/sendReward.ts b/scripts/sendReward.ts index a0a8ff1..e255668 100644 --- a/scripts/sendReward.ts +++ b/scripts/sendReward.ts @@ -2,42 +2,51 @@ import { parseEther } from 'ethers/lib/utils'; import { ethers, web3 } from 'hardhat'; import { ZERO_ADDRESS } from '../test/hardhat/utils/helpers'; -import { DistributionCreator__factory, MockCoreBorrow__factory } from '../typechain'; +import { DistributionCreator__factory } from '../typechain'; async function main() { const { deployer } = await ethers.getNamedSigners(); - const distributorCreator = `0xA9c076992F3917b47E2C619c46ff0b652d76e6B4`; - const mockTokenAddress = '0x84FB94595f9Aef81147cD4070a1564128A84bb7c'; - const pool = '0x3fa147d6309abeb5c1316f7d8a7d8bd023e0cd80'; + const distributionCreator = `0x8BB4C975Ff3c250e0ceEA271728547f3802B36Fd`; + const rewardTokenAddress = '0xC16B81Af351BA9e64C1a069E3Ab18c244A1E3049'; + const pool = '0x599a68d45e6eed05aa8c5c0c85e7efeb5086d8e1'; - const manager = DistributionCreator__factory.connect(distributorCreator, deployer); - const mockToken = MockCoreBorrow__factory.connect(mockTokenAddress, deployer); + const manager = DistributionCreator__factory.connect(distributionCreator, deployer); const params = { uniV3Pool: pool, - rewardToken: mockToken.address, - positionWrappers: ['0x1644de0A8E54626b54AC77463900FcFFD8B94542', '0xa29193Af0816D43cF44A3745755BF5f5e2f4F170'], - wrapperTypes: [0, 2], - amount: parseEther('350'), - propToken0: 4000, - propToken1: 2000, - propFees: 4000, + rewardToken: rewardTokenAddress, + positionWrappers: [], + wrapperTypes: [0], + amount: parseEther('1000'), + propToken0: 1000, + propToken1: 8000, + propFees: 1000, isOutOfRangeIncentivized: 0, - epochStart: 1676649600, - numEpoch: 500, + epochStart: 1700667000, + numEpoch: 24 * 2, boostedReward: 0, boostingAddress: ZERO_ADDRESS, - rewardId: web3.utils.soliditySha3('europtimism') as string, - additionalData: web3.utils.soliditySha3('europtimism') as string, + rewardId: web3.utils.soliditySha3('') as string, + additionalData: ethers.utils.defaultAbiCoder.encode(['uint256'], ['0x12']) as string, }; - // console.log('Approving'); - // await (await mockToken.connect(deployer).approve(manager.address, MAX_UINT256)).wait(); - - console.log('Depositing reward...'); - await (await manager.connect(deployer).createDistribution(params, { gasLimit: 1e6 })).wait(); + /** + * Create distribution + */ + const tx = await manager.connect(deployer).createDistribution(params, { gasLimit: 2_000_000 }); + await tx.wait(); console.log('...Deposited reward ✅'); + + /** + * Resolve dispute + */ + // const tx = await distributor.connect(deployer).resolveDispute(true); + // await tx.wait(); + + // const tx = await distributor.connect(deployer).toggleTrusted('0x435046800Fb9149eE65159721A92cB7d50a7534b'); + // await tx.wait(); + // console.log('...Toggled trusted ✅'); } main().catch(error => {